Overview
The Agents Beta API provides powerful endpoints for creating, executing, and managing AI agents with support for tools, memory, knowledge bases, and real-time streaming.Prerequisites
- Set up a new Project, if you want to follow along you can name it
agents. This will be also used as apathto create your resources.

Executing an Agent
Running an agent involves a two-step process:- Create an Agent - Define the agent’s configuration (role, instructions, model, tools, etc.)
- Execute the Agent - Send a message to the agent using the Responses API
The Agents payloads are built on the A2A protocol, standardizing agent to agent communication, to learn more, see The A2A Protocol Website
Step 1: Create an Agent
Step 2: Execute the Agent
task detail containing the status and metadata, including a unique id.
Setbackground: false(default) to wait for the agent execution to complete. Setbackground: trueto return immediately without waiting for completion. Use the task id in subsequent calls to continue the conversation with the agent.
Model Parameter Format
Themodel parameter supports two formats:
Object format (recommended) - Allows you to specify model parameters like temperature:
For a complete list of supported model parameters, see the API Reference.
Continuing a Task
After receiving a task response, you can continue the conversation by sending additional messages to the same agent. This allows for multi-turn interactions where the agent maintains context from previous exchanges. To continue a task, use the/v2/agents/{key}/responses endpoint and provide the task_id from the previous response. The task must be in an inactive state to continue.
task_id: Optional task ID to continue an existing agent execution. When provided, the agent will continue the conversation from the existing task state.
Note: The agent maintains full context from the previous conversation.
Agent and Tasks States
Agents run through the following states when processing tasks:| State | Description |
|---|---|
| Active | Execution in progress, continuation requests blocked |
| Inactive | Waiting for user input or tool results, ready for continuation |
| Error | Execution failed, continuation blocked |
| Approval Required | Tool execution requires manual approval (coming soon) |
| State | Description |
|---|---|
| Submitted | Task created and queued for execution |
| Working | Agent actively processing |
| Input Required | Waiting for user input or tool results |
| Completed | Task finished successfully |
| Failed | Task encountered an error |
| Canceled | Task was manually canceled |