Overview
A callback is an HTTP POST request sent to your specified endpoint when an Agent Loop finishes:Configuring Callbacks
1
Create/Edit Agent Loop
Open the agent loop you want to configure.
2
Find Callback Section
Scroll to the Callback Webhook configuration section.
3
Enter Webhook URL
Provide your webhook endpoint:
4
Add Headers (Optional)
Include authentication or custom headers:
5
Save
Click Save to enable callbacks.
Callback Payload
Your webhook receives a POST request with this JSON structure:Payload Fields
Status Values
completed: Agent successfully finished the task
failed: Agent encountered an error
timeout: Execution exceeded time limit
Implementing a Callback Webhook
Example: Node.js/Express
Example: Python/Flask
Response Expected
Your webhook should return a JSON response with HTTP 200 status:Use Cases
Send to Messaging Platforms
Forward agent results to Slack, Teams, or Discord:Save to Database
Store results for historical tracking:Trigger Workflows
Start additional workflows based on results:Send Emails
Email reports to stakeholders:Security
Use HTTPS
Always use HTTPS endpoints for callbacks
Authenticate Requests
Verify requests come from Chatbot Platform
Validate Payload
Check payload structure before processing
Rate Limiting
Implement rate limits on your endpoint
Authenticating Callbacks
Add a secret token to callback headers: Agent Loop Configuration:Request Signature (Coming Soon)
Future support for HMAC-SHA256 signature verification:Testing Callbacks
Manual Testing
Use a service like webhook.site:1
Create Test Endpoint
Go to webhook.site and copy your unique URL.
2
Configure Agent Loop
Set the webhook.site URL as your callback URL.
3
Run Agent Loop
Execute the agent loop manually.
4
View Request
Check webhook.site to see the callback payload.
Local Testing with Ngrok
Test with your local development server:1
Start Ngrok
2
Use Ngrok URL
Configure agent loop with the ngrok URL:
3
Run Agent
Execute and receive callback on your local server.
Troubleshooting
Callback Not Received
Check:- Callback URL is correct and accessible
- Your endpoint is running
- Firewall allows incoming requests
- Agent loop completed successfully
Callback Failed
Check:- Endpoint returns 200 status
- Response is valid JSON
- No timeout on your endpoint
- Check execution logs for details
Duplicate Callbacks
If you receive multiple callbacks:- Check for retry logic (future feature)
- Verify webhook is not called multiple times in your code
- Use
execution_idto deduplicate
Best Practices
Always respond with HTTP 200 status quickly. Process the callback data asynchronously if it takes time.
- Return 200 immediately
- Process data in background jobs
- Log all callbacks for debugging
- Validate payload structure
- Handle errors gracefully
- Perform long operations synchronously
- Return errors for non-critical issues
- Skip authentication
- Assume payload structure won’t change
Async Processing Pattern
Next Steps
Getting Started
Create your first agent loop
MCP Servers
Add tools to your agents