The Agent Object

The cycls.Agent() is the main class that holds all configuration for your AI agent. It manages dependencies, authentication, deployment settings, and the overall behavior of your agent.

Initialization

Create an agent by initializing the cycls.Agent() class:
import cycls

# Basic agent for local development
agent = cycls.Agent()

# Production agent with dependencies and configuration
agent = cycls.Agent(
    pip=["openai", "requests"],
    keys=["ak-<token_id>", "as-<token_secret>"],
    copy=["data"]
)

Parameters

agent
Agent Object

Example Configuration

agent = cycls.Agent(
    pip=["openai"],  # Python dependencies
    keys=["ak-<token_id>", "as-<token_secret>"],  # Required for cloud deployment
    front_end="my_theme",  # Optional custom UI
    copy=[".env", "data", "tools.py", "my_theme"],  # Local files to include
    api_token="sk-0123456789"  # Agent API key
)

The @agent Decorator

The @agent() decorator registers your function as an agent and configures its behavior:
# Basic agent
@agent()
async def my_agent(context):
    return "Hello, world!"

# Agent with custom configuration
@agent("my-agent", auth=True)
async def authenticated_agent(context):
    return "Hello, authenticated user!"

# Agent with UI customization
@agent("health-assistant", header=header, intro=intro, domain="health.ai")
async def health_agent(context):
    return "I'm your health assistant!"

Decorator Parameters

@agent
Decorator

UI Customization Example

# Define custom header and intro
header = """
<div class="bg-blue-500 text-white p-4">
    <h1 class="text-2xl font-bold">My Custom Agent</h1>
    <p>Welcome to my specialized AI assistant!</p>
</div>
"""

intro = """
<div class="p-4">
    <h2>Introduction</h2>
</div>
"""

# Use in decorator
@agent("my-agent", auth=True, header=header, intro=intro, domain="my-domain.ai")
async def custom_agent(context):
    return "Hello from my custom agent!"

Run or Push the Agent

Local Development

Use agent.run() to start a local development server:
# Default port (8000)
agent.run()

# Custom port
agent.run(port=9000)
agent.run()
Method
The local server provides:
  • Hot-reloading for rapid development
  • Web UI at http://127.0.0.1:port
  • Real-time debugging and testing

Cloud Deployment

Use agent.push() to deploy your agent to the cloud:
Subscribe to the Professional Plan to get your deployment keys and start deploying your agents to production.
# Development mode (default)
agent.push()  # Deploys to dev environment

# Production mode
agent.push(prod=True)  # Deploys to production with public URL
agent.push()
Method
How Deployment Works:
  • Your agent is packaged into a container with all dependencies
  • The container runs on Cycls cloud infrastructure
  • Automatic scaling handles traffic spikes
  • Global CDN ensures fast response times worldwide
Development Mode (prod=False):
  • Agent runs in development environment
  • No public URL generated
  • Used for testing and staging
Production Mode (prod=True):
  • Agent deploys to production environment
  • Public URL generated (e.g., your-agent.cycls.ai)
  • Live and accessible to users