Use this file to discover all available pages before exploring further.
This tutorial walks you through the different ways to use the REST API to create and communicate with AMAS agents. You’ll learn how to load sessions from YAML, from existing agents, execute messages, and pass variables and files to your agents.
curl -X POST https://api-be.atthene.com/api/v1/runtime/session_abc123/execute/ \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "content": "Hello! I need help with my account." }'
Response:
{ "id": "session_abc123", "object": "agent.session", "status": "completed", "created_at": 1704067200, "completed_at": 1704067215, "config": {}, "messages": [ { "id": "msg_def456", "role": "assistant", "content": "Hello! I'd be happy to help you with your account. What specific issue are you experiencing?", "created_at": 1704067210 } ], "execution_time": 15, "metadata": { "correlation_id": null, "event_count": 3, "execution_id": "exec_789", "usage": { "input_tokens": 125, "output_tokens": 42 } }}
Send follow-up messages. The agent maintains context from previous messages:
curl -X POST https://api-be.atthene.com/api/v1/runtime/session_abc123/execute/ \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "content": "How do I reset my password?" }'
The response includes all new messages generated during this execution. The agent has full access to previous messages in the session and provides context-aware responses.
Session-level variables (persist across requests):
curl -X POST https://api-be.atthene.com/api/v1/runtime/session_abc123/execute/ \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "content": "Hello, I need help", "inputs": { "user_id": "user_12345", "user_email": "john@example.com" } }'
On subsequent requests, these variables load automatically from the checkpoint.Request-level variables (fresh on every request):
curl -X POST https://api-be.atthene.com/api/v1/runtime/session_abc123/execute/ \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "content": "What is your refund policy?", "inputs": { "current_query": "What is your refund policy?" } }'
Request-level variables must be provided on every execution. The inputs field accepts a dictionary of variables that are available to your agents via {{ variables.key }}.
You can pass images and files to your agent for analysis. This feature is experimental — if you use it, please provide feedback on your experience.
Experimental Feature: Image and file input handling via REST API is not fully tested. If you encounter issues or limitations, please report them to support with details about your use case.
Method 1: The “Upload First” Method (Highly Recommended)
If you are building an interface where users upload local files, you should upload the image to the Atthene API first. This returns a temporary, secure URL that you then pass to the agent. This method reduces LLM token consumption by ~95% compared to Base64 encoding.Step 1: Upload the Image
If your image is already hosted publicly on the internet (e.g., a product image on your website), you can pass that URL directly. This is also highly efficient for token usage.
curl -X POST https://api-be.atthene.com/api/v1/runtime/session_abc123/execute/ \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "content": [ { "type": "text", "text": "What is shown in this image?" }, { "type": "image_url", "image_url": { "url": "https://example.com/public-image.jpg" } } ] }'
You can encode the image directly into the JSON payload. This is easy for prototyping but incurs high token costs and inflates your request size significantly. It is not recommended for large files in production.