Execute an agent with the provided input to generate a response. Optionally maintain conversation context using a session ID.
Path Parameters
The unique identifier of the agent
Request Body
The input text for the agent to process
Optional session ID for continuing a conversation
Response
The agent’s response to the input
The session ID for this conversation
Additional information about the execution including model used, tokens, and tools
curl -X POST https://www.trytruffle.ai/api/v1/agents/agent_123/run \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "How can I help you today?",
"session_id": "optional_session_123"
}'
{
"success": true,
"data": {
"output": "I'm here to assist you with any questions or concerns you may have.",
"session_id": "session_123",
"metadata": {
"model": "gpt-4",
"tool_used": "search",
"tokens": {
"prompt": 150,
"completion": 25,
"total": 175
}
}
},
"status": 200
}