Skip to main content
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.

Prerequisites

1

Get API Key

Generate an API key from the Artaios Agent Studio settings
2

Base URL

All API requests use: https://api.artaios.ai/api/v1
3

Authentication

Include your API key in the x-api-key header with every request
Never expose your API key in client-side code or public repositories. Use environment variables or secure credential storage.

Creating Sessions

Learn the different ways to create and initialize a session with your agents.

Option 1: Load Session from YAML Configuration

Create a session by providing a complete agent configuration in YAML format (as JSON):
Response:

Option 2: Load Session from Existing Agent

Create a session from an agent already configured in Artaios Agent Studio. Use the agent’s unique key:
Response:

Communicating with a Session

Once you have a session ID, you can execute messages and interact with your agent.

Execute a Simple Message

Send a message to the agent and get a response:
Response:

Continue Conversation

Send follow-up messages. The agent maintains context from previous messages:
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.

Pass Variables with Your Message

Inject variables into the agent’s context. Variables are substituted into agent prompts and maintain state across executions.
Learn more in the Using Variables in REST API guide.
Session-level variables (persist across requests):
On subsequent requests, these variables load automatically from the checkpoint. Request-level variables (fresh on every request):
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 }}.

Multimodal Input: Images and Files

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.

Send an Image with Your Message

AMAS officially supports three different methods for sending images to an agent. If you are building an interface where users upload local files, you should upload the image to the Artaios 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
Response:
Step 2: Send the URL to the Agent

Method 2: Direct Public URL

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.

Method 3: Direct Base64 String

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.
Response from the agent:

Send a File for Processing

Pass files (PDFs, documents, etc.) to the agent:
File upload via REST execute endpoint is not fully tested. Known limitations:
  • File size limits may apply
  • Some file types may not be supported
  • Error handling may be incomplete
If you encounter issues, please report them with details about file type, size, and error message.
Expected response (if supported):

Error Handling

Common errors and how to handle them:

Next Steps

Variables Guide

Master passing variables to your agents

API Reference

Complete endpoint documentation

YAML Configuration

Learn agent configuration syntax

Chatbot Integration

Build real-time chat interfaces