Create Agent API Definition
The Create Agent API lets you design and deploy smart AI agents capable of managing sophisticated workflows, running tool-based actions, and also keep conversational context across multi-turn dialogues. Using the Model Context Protocol (MCP), this API enables the development of autonomous digital workers that combine retrieval-augmented generation with external system integration.
By configuring agents with specific tools, behavioral instructions, and model parameters, enterprises can deploy specialized agents for customer support, business intelligence, workflow automation, and technical assistance scenarios. These agents operate as configurable, decision-making entities that can reason through problems, coordinate multiple tools, and adapt their responses based on conversation context and available capabilities.
What is an agent?
An agent is comprised of three main components of functionality:
- Instructions: Known as a system prompt in other platforms.
- Steps: The workflow the agent executes.
- Tools: Resources available to resolve steps and instructions.
To use an agent, create a new session (called a thread or chat in other platforms), and send new inputs to the agent to get responses.
Create Agent Request and Response
To create an agent, send a POST request to /v2/agents
. You specify the
following parameters in the request body:
key
(string, optional): A user provided key that uniquely identifies this agent. If not provided, one will be auto-generated based on the agent name. Pattern:[0-9a-zA-Z_-]+$
name
(string, required): The human-readable name of the agentdescription
(string, optional): Detailed description of agent purpose and capabilitiestool_configurations
(object, required): A map of tool configurations available to the agent where:- Key: A user-defined name for the tool configuration (e.g.,
customer_search
) - Value: An
AgentToolConfiguration
object with:type
(string, required): Tool configuration type (mcp
,corpora_search
, orweb_search
)argument_override
(object, optional): Optional hardcoded arguments for tool callsquery_configuration
(object, required forcorpora_search
): User-configurable settings for corpus search
- Key: A user-defined name for the tool configuration (e.g.,
model
(object, required): Model configuration for agent reasoningname
(string, required): Model name (e.g.,gpt-4
)parameters
(object, optional): Model-specific parameters like temperature and max_tokens
first_step
(object, required): Initial execution step configurationtype
(string, required): Step type (must beconversational
)instructions
(array, required): List of instruction objects- Reference instructions:
type
(string, required): Must bereference
id
(string, required): Instruction identifier following patternins_[0-9a-zA-Z_-]+$
version
(integer, optional): Specific instruction version
- Inline instructions:
type
(string, required): Must beinline
name
(string, required): Human-readable instruction nametemplate_type
(string, optional): Must bevelocity
(default)template
(string, required): Instruction template contentdescription
(string, optional): Instruction description
- Reference instructions:
output_parser
(object, required): Output parser configurationtype
(string, required): Parser type (must bedefault
)
metadata
(object, optional): Arbitrary key-value pairs for organization and trackingenabled
(boolean, optional): Whether agent is active upon creation (defaults totrue
)
The response includes the complete agent configuration with system-generated fields including the unique agent key, creation timestamp, and update timestamp.
Example Request
1
Example Response
1
Error Responses
The API returns standard HTTP error codes with detailed error information:
HTTP Code | Error Code | Description |
---|---|---|
400 | invalid_request | Missing required fields or malformed request structure |
400 | invalid_tool_reference | Referenced tool does not exist or is inaccessible |
400 | invalid_instruction_reference | Referenced instruction does not exist or is inaccessible |
400 | invalid_model_configuration | Invalid model name or unsupported parameters |
401 | unauthorized | Invalid or missing API key |
403 | forbidden | Insufficient permissions for agent creation |
429 | rate_limit_exceeded | Agent creation rate limit exceeded |