Skip to main content
Create custom routines to extend agent capabilities with deterministic Python code.

Routine Requirements

Every routine module needs:
  1. Config - A Pydantic BaseModel with parameters (docstring becomes the description)
  2. run(config, context) - Async function that executes the routine and returns a string
  3. CONTINUOUS = True (optional) - Mark as continuous routine with internal loop

Create a Custom Routine

1. Create the File

In your agent’s routines/ folder:

2. Register the Routine

Add to your agent’s config or the routine will be auto-discovered.

3. Use in Agent

Update your agent.md:

4. Test

Run a dry run to verify:

Creating with Condor

You can ask Condor to create routines for you via natural language:
Condor generates the routine:
The routine is auto-discovered and immediately available via /routines.

Routine Best Practices

Same input should always produce same output. Avoid randomness or time-based logic that would make results unpredictable.
Return human-readable strings for Telegram display. Use markdown formatting for clarity.
Return error messages rather than raising exceptions:
The Config class docstring becomes the routine description in the UI. Use Field(description=...) to document each parameter.
Continuous routines must catch asyncio.CancelledError to clean up gracefully when stopped.

Global vs Agent-Specific

Agent-specific routines override global ones with the same name.