Create Agent API Definition
The Create Agent API enables you to define and deploy intelligent AI agents within the Vectara platform that can orchestrate complex workflows, execute tool-based actions, and maintain conversational context across multi-turn interactions. This API supports the creation of autonomous digital workers that combine retrieval-augmented generation with external system integration through the Model Context Protocol (MCP).
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.
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 capabilitiestools
(object, required): A map of tools available to the agent where:- Key: tool_id following pattern
tol_.*
- Value: 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 for corpora_search): User-configurable settings for corpus search
- Key: tool_id following pattern
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 |