Skip to main content
Deploying your agent to production takes just one command. Cycls handles the infrastructure, scaling, and security for you.

Getting Started

Before deploying your agent, you’ll need a Cycls API key.
  1. Go to the Cycls Console and sign in or create an account.
  2. Navigate to the API Keys section.
  3. Create a new API key and copy it securely.

Deploying to Production

To deploy your agent, set your API key and call app.deploy():
import cycls
import os

cycls.api_key = os.getenv("CYCLS_API_KEY")

@cycls.app(pip=["openai"], copy=[".env"])
async def app(context):
    from openai import AsyncOpenAI

    client = AsyncOpenAI()
    response = await client.chat.completions.create(
        model="gpt-4o-mini",
        messages=context.messages,
        stream=True
    )
    async for chunk in response:
        content = chunk.choices[0].delta.content
        if content:
            yield content

app.deploy()

Environment Variables & Secrets

Create a .env file in your project root and include it with copy=[".env"]:
CYCLS_API_KEY=cy-...
OPENAI_API_KEY=sk-...
Cycls automatically loads the .env file—environment variables are available via os.getenv() inside your function without needing any additional packages.
import cycls
import os

cycls.api_key = os.getenv("CYCLS_API_KEY")

@cycls.app(pip=["openai"], copy=[".env"])
async def app(context):
    from openai import AsyncOpenAI

    # Environment variables from .env are automatically loaded
    client = AsyncOpenAI(api_key=os.getenv("OPENAI_API_KEY"))
    response = await client.chat.completions.create(
        model="gpt-4o-mini",
        messages=context.messages,
        stream=True
    )
    async for chunk in response:
        content = chunk.choices[0].delta.content
        if content:
            yield content

app.deploy()

What Happens During Deployment?

When you run app.deploy(), Cycls performs the following steps:
  1. Build: Creates a Docker image containing your code, dependencies (pip), and system packages (apt).
  2. Push: Uploads the image to the private Cycls Container Registry.
  3. Provision: Sets up the serverless infrastructure to host your agent.
  4. Deploy: Launches your agent and assigns it a permanent URL (e.g., https://app.cycls.ai).

Deployment Output

🚀 Deploying...
 Deployment successful!
🔗 Service is available at: https://app.cycls.ai

Updating Your Agent

To update your agent, simply make changes to your code and run the script again. Cycls will build a new version and seamlessly update the deployment with zero downtime.

Local vs Cloud

Featureapp.local()app.deploy()
URLhttp://localhost:8080https://<name>.cycls.ai
Hot ReloadYes (default)No
SSLNoYes (automatic)
ScalingSingle containerAuto-scaling
AuthOptionalOptional

Monitoring & Management

The Cycls Dashboard lets you monitor your agent’s performance, view real-time logs, and manage your deployments.