Agent Loops are autonomous AI workflows that can execute multi-step tasks, access tools via MCP (Model Context Protocol) servers, and operate without direct user interaction.
Agent loops overview
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
Unlike bots (which respond to user messages), Agent Loops are proactive and task-oriented.
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:
You are a data analyst. Every day at 9 AM, you:1. Fetch yesterday's sales data from the database2. Calculate key metrics (total sales, top products)3. Generate a summary report4. Send the report via webhook
System prompt configuration
User Message
The task or question given to the agent:
Generate today's sales report and send it to the team.
User message input
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
MCP server configuration
Callback Webhook
Where to send results when the agent completes its task:
Callback webhook setup
Creating an Agent Loop
1
Navigate to Agent Loops
From your dashboard, click Agent Loops in the sidebar.
Agent loops list
2
Click Create
Click Create Agent Loop to open the form.
Create agent loop form
3
Name Your Agent
Give it a descriptive name:
Agent loop named
4
Write System Prompt
Define the agent’s role and behavior.
5
Set User Message
Provide the task or question.
6
Configure MCP Servers
Add any tools the agent needs (optional but recommended).
7
Add Callback Webhook
Specify where to send results (optional).
8
Configure Advanced Settings
Set model, max iterations, timeout, etc.
Advanced settings
9
Save
Click Create to save the agent loop.
Complete agent loop
Running Agent Loops
Manual Execution
Run an agent loop on demand:
1
Open Agent Loop
Navigate to the agent loop details page.
2
Click Run
Click the Run button to start execution.
3
Monitor Progress
Watch the execution log for status updates.
4
Review Results
Check the output and any callback webhook responses.
HTTP 200 status indicates success.Learn more in Callbacks.
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
More iterations = longer execution time.
Timeout
Maximum execution time in seconds:
60s: Quick tasks
300s (5 min): Standard
900s (15 min): Long-running tasks
3600s (1 hour): Maximum
Agent stops if timeout is reached.
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:
You are a sales analyst. Your task is to:1. Query the database for yesterday's orders2. Calculate total revenue and average order value3. Identify top 5 products by sales4. Format the results as a JSON report5. Send the report via the callback webhook
Bad:
Analyze sales data.
Be specific about steps, data sources, and expected output.
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.