POST
/
v1
/
agents
{
  "agent_id": "<string>",
  "created_at": "<string>"
}

Create a new AI agent with the specified configuration. The agent can be used to process inputs and generate responses based on its configuration.

Request Body

name
string
required

The name of the agent

instruction
string
required

The system instruction for the agent that defines its behavior

model
string
required

The LLM model to use (must be one of the supported models)

tool
string

Optional tool integration for the agent

component
string

Optional UI component override (defaults to ‘Chat’)

Response

agent_id
string

The unique identifier of the created agent

created_at
string

ISO 8601 timestamp of when the agent was created

curl -X POST https://www.trytruffle.ai/api/v1/agents \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Customer Support Agent",
    "instruction": "You are a helpful customer support agent",
    "model": "gpt-4",
    "tool": "search",
    "component": "Chat"
  }'
Response
{
    "success": true,
    "data": {
        "agent_id": "agent_123",
        "created_at": "2024-02-07T20:43:00Z"
    },
    "status": 200
}