Skip to main content
This guide shows you how to integrate the google-genai SDK into your Cycls agent to access Gemini models. You will learn how to:
  • Define dependencies for the Docker environment.
  • Configure the Gemini API client inside the agent handler.
  • Stream responses from Gemini back to the user.

Prerequisites

  • Python 3.9+
  • cycls package installed
  • Google AI Studio API Key
  • Docker installed (for local testing)

Step 1: Create the Agent

Create a new file called app.py:

Step 2: Configure Environment

Create a .env file in the same directory with your API key:

Step 3: Run the Agent

Execute your agent script:
The agent will start locally and provide an endpoint for interaction.

Full Code

Here is the complete app.py file:

Deploy to Cloud

To deploy to production: