Routine Requirements
Every routine module needs:- Config - A Pydantic BaseModel with parameters (docstring becomes the description)
- run(config, context) - Async function that executes the routine and returns a string
- CONTINUOUS = True (optional) - Mark as continuous routine with internal loop
Create a Custom Routine
1. Create the File
In your agent’sroutines/ folder:
2. Register the Routine
Add to your agent’s config or the routine will be auto-discovered.3. Use in Agent
Update youragent.md:
4. Test
Run a dry run to verify:Creating with Condor
You can ask Condor to create routines for you via natural language:/routines.
Routine Best Practices
Keep routines deterministic
Keep routines deterministic
Same input should always produce same output. Avoid randomness or time-based logic that would make results unpredictable.
Return formatted strings
Return formatted strings
Return human-readable strings for Telegram display. Use markdown formatting for clarity.
Handle errors gracefully
Handle errors gracefully
Return error messages rather than raising exceptions:
Use Config docstrings
Use Config docstrings
The Config class docstring becomes the routine description in the UI. Use
Field(description=...) to document each parameter.Handle cancellation in continuous routines
Handle cancellation in continuous routines
Continuous routines must catch
asyncio.CancelledError to clean up gracefully when stopped.Global vs Agent-Specific
| Location | Scope |
|---|---|
~/condor/routines/ | Available to all agents |
trading_agents/{slug}/routines/ | Specific to one agent |

