
Overview
An Agent Loop is an AI agent that:- Runs Autonomously: Executes tasks without user messages
- Uses Tools: Accesses MCP servers for capabilities like file systems, databases, APIs
- Makes Decisions: Determines which tools to use and when
- Sends Results: Delivers output via callback webhooks
- Iterates: Can run multiple reasoning steps to complete tasks
Use Cases
Scheduled Reports
Generate and send daily/weekly reports automatically
Data Processing
Process files, databases, or API data on schedule
Monitoring
Check systems and alert on issues
Content Generation
Create blog posts, summaries, or documentation
Agent Loop Components
System Prompt
Instructions that define the agent’s behavior:
User Message
The task or question given to the agent:
MCP Servers
Tools the agent can use:- File System: Read/write files
- Database: Query SQL databases
- HTTP: Make API requests
- Custom: Your own tool implementations

Callback Webhook
Where to send results when the agent completes its task:
Creating an Agent Loop
Running Agent Loops
Manual Execution
Run an agent loop on demand:Scheduled Execution (Coming Soon)
Future support for:- Cron-based schedules (daily, weekly, monthly)
- Interval-based triggers (every N minutes/hours)
- Event-based triggers (webhook received, file uploaded)
API Execution
Trigger agent loops via API:MCP Servers
Model Context Protocol (MCP) servers provide tools for agents:Built-in MCP Servers
File System:- Read files
- Write files
- List directories
- Make GET/POST/PUT/DELETE requests
- Handle authentication
- Parse responses
- Query SQL databases
- Execute statements
- Transaction support
Custom MCP Servers
Deploy your own MCP servers:
Learn more in MCP Servers.
Callback Webhooks
Send agent results to external systems:Webhook Format
The callback webhook receives:Response Expected
Your webhook should return:Advanced Settings
Max Iterations
Limit how many reasoning steps the agent can take:| Iterations | Use Case |
|---|---|
| 5 | Simple tasks |
| 10 (default) | Standard tasks |
| 20 | Complex multi-step tasks |
| 50+ | Very complex workflows |
Timeout
Maximum execution time in seconds:- 60s: Quick tasks
- 300s (5 min): Standard
- 900s (15 min): Long-running tasks
- 3600s (1 hour): Maximum
Best Practices
Clear Instructions
Write explicit system prompts and tasks
Right Tools
Provide only necessary MCP servers
Set Limits
Use appropriate iteration and timeout limits
Test First
Run manually before scheduling
System Prompt Tips
Good:Troubleshooting
Agent Doesn’t Complete
Check:- Max iterations is sufficient
- Timeout is long enough
- MCP servers are accessible
- System prompt is clear
Tool Calls Fail
Check:- MCP server URLs are correct
- Authentication is configured
- Server is running and responsive
- Agent has permission to access tools
No Callback Received
Check:- Callback URL is correct
- Webhook endpoint is accessible
- Agent loop completed successfully
- Check execution logs for errors
API Access
Manage agent loops programmatically using the API.Create an agent loop via API
Create an agent loop via API
- cURL
- JavaScript
- PHP
- Python
Run an agent loop
Run an agent loop
- cURL
- JavaScript
- PHP
- Python
List agent loop executions
List agent loop executions
- cURL
- JavaScript
- PHP
- Python
Complete API Reference
View the full API specification with all endpoints, parameters, and response schemas.
Next Steps
Getting Started
Create your first agent loop
MCP Servers
Configure tool access
Callbacks
Set up result webhooks



