Integration Overview
Once you’ve built and tested your agent in the Playground, you can integrate it into your applications using three methods:REST API
Server-side integration with request/response pattern
WebSocket
Real-time streaming for interactive applications
Embedded Chatbot
Drop-in chat widget for websites
Before You Start
Get Your Credentials
1
Create an API Key
Navigate to Settings in the platform and generate an API key for authentication.
2
Get Your Agent Key
Find your agent’s unique identifier in Agent Overview or Agent Settings.
3
Enable Public Access (if needed)
For external integrations, enable public access and set an allowed origin URL in Agent Settings.
API Base URLs
- REST API:
https://api-be.atthene.com/api/v1/ - WebSocket:
wss://api-be.atthene.com/ws/amas
Authentication
All API requests require authentication using your API key:Other headers
On POST requests, you can use Content-Type:application/json or application/yaml (see API Introduction for more details).
REST API Integration
Step 1: Create a Session
Before sending messages, create a session to establish context. An agent session represents a loaded configuration. Sessions can be created directly from a configuration or from an existing agent. (deployed version)- From Saved Agent
- From YAML Config
Use this method when connecting to a saved agent:Headers:Response:
Step 2: Send Messages
Once you have a session ID, you can execute a user message on a session:- Text Message
- Multimodal Message
- File Upload
For simple text messages, use a string:
content(required): User input - either a simple text string or an array of content blocks for multimodal messagescorrelation_id(optional): Custom tracking ID for response identification.
type: Always “execution_result”client_type: Always “backend”session_id: The session ID used for executionstatus: Execution status - “completed”, “error”, or “timeout”execution_time: Time taken to execute in secondsmessages: Array of messages generated during execution (typically assistant responses)error: Error message if status is “error”, otherwise nullevents: Raw events collected during executiontimestamp: ISO timestamp when execution completedcorrelation_id: The correlation ID from the original request (if provided)
Direct WebSocket Integration
Currently only supported with the embedded chatbot. Please let us know if you need this feature.Embedded Chatbot
TODO The easiest way to add your agent to a website is using the embedded chatbot widget.Step 1: Configure Public Access
- Go to Agent Overview and select your agent
- Open Agent Settings
- Enable Public Access
- Set Allowed Origin URL to your website domain
- Example:
https://your-website.com - This prevents unauthorized use of your agent
- Example:
Step 2: Get the Embed Code
The platform provides a JavaScript snippet to embed your agent:Step 3: Customize the Widget
Complete Embedding Example
Widget API
Control the widget programmatically:Testing Your Integration
Test in Development
- Use Agent Preview First: Always test in the Playground before integrating
- Start with REST API: Simpler to debug than WebSocket
- Check Authentication: Verify your API key works with a simple GET request
- Monitor Tracing: Use the Tracing section to see what your agent receives
Common Integration Issues
401 Unauthorized
401 Unauthorized
403 Forbidden (Embedded Widget)
403 Forbidden (Embedded Widget)
Problem: Origin URL not allowedSolutions:
- Add your domain to Allowed Origin URL in Agent Settings
- Include protocol:
https://your-site.comnotyour-site.com - Check for typos in domain name
WebSocket Connection Failed
WebSocket Connection Failed
Problem: Can’t establish WebSocket connectionSolutions:
- Ensure session was created via REST API first
- Check that you’re using
wss://(secure WebSocket) - Verify firewall/proxy settings allow WebSocket
- Check browser console for detailed errors
No Response from Agent
No Response from Agent
Problem: Messages sent but no responseSolutions:
- Check agent status in Agent Overview
- Verify session_id is correct
- Look at Tracing logs for errors
- Ensure agent configuration is valid
What’s Next?
Additional Resources
API Reference
Complete API documentation with all endpoints
YAML Configuration
Learn about complete agent configuration
Agent Capabilities
Explore tools, streaming, and other capabilities
Give Feedback
Request features or report integration issues