Agent API

REST API for managing and executing AI agents.

Base URL

https://api.cloud.tenzro.com/agent

Endpoints

Create Agent

POST /agent/agents
Content-Type: application/json
X-Project-ID: proj_xyz
{
"name": "customer-support",
"description": "Customer support agent",
"system_prompt": "You are a helpful customer support agent.",
"ai_model": "gemini-2.5-flash",
"orchestration_pattern": "SINGLE",
"tools": ["search_docs", "create_ticket"]
}
# Response
{
"agent_id": "agent_abc123",
"name": "customer-support",
"status": "active",
"created_at": "2024-01-15T00:00:00Z"
}

List Agents

GET /agent/agents
X-Project-ID: proj_xyz
# Response
{
"agents": [
{
"agent_id": "agent_abc123",
"name": "customer-support",
"status": "active",
"executions": 150
}
]
}

Chat with Agent

POST /agent/agents/{agent_id}/chat
Content-Type: application/json
{
"message": "I need help with my order #12345",
"conversation_id": "conv_xyz",
"context": {
"user_id": "user_123"
}
}
# Response
{
"message": {
"role": "assistant",
"content": "I'd be happy to help with order #12345..."
},
"conversation_id": "conv_xyz",
"tool_calls": [
{
"name": "search_docs",
"arguments": { "query": "order #12345" },
"result": { "found": true, "status": "shipped" }
}
]
}

Execute Agent

POST /agent/agents/{agent_id}/execute
Content-Type: application/json
{
"task": "Process refund for order #12345",
"inputs": {
"order_id": "12345",
"reason": "damaged"
},
"max_iterations": 10
}
# Response
{
"execution_id": "exec_abc123",
"status": "completed",
"result": {
"refund_processed": true,
"amount": 99.99
},
"steps": [
{ "action": "verify_order", "result": "success" },
{ "action": "process_refund", "result": "success" }
]
}

Streaming Chat

POST /agent/agents/{agent_id}/chat
Content-Type: application/json
{
"message": "Help me write a report",
"stream": true
}
# Response (Server-Sent Events)
data: {"type": "thinking", "content": "Analyzing request..."}
data: {"type": "tool_call", "name": "search_docs"}
data: {"type": "tool_result", "result": {...}}
data: {"type": "delta", "content": "Based on my analysis..."}
data: [DONE]

Get Conversation History

GET /agent/agents/{agent_id}/conversations/{conversation_id}
# Response
{
"conversation_id": "conv_xyz",
"messages": [
{ "role": "user", "content": "Hello" },
{ "role": "assistant", "content": "Hi! How can I help?" }
],
"created_at": "2024-01-15T00:00:00Z"
}

Update Agent

PATCH /agent/agents/{agent_id}
Content-Type: application/json
{
"system_prompt": "Updated system prompt",
"temperature": 0.5
}
# Response
{
"agent_id": "agent_abc123",
"updated_at": "2024-01-15T12:00:00Z"
}

Delete Agent

DELETE /agent/agents/{agent_id}
# Response
{
"success": true,
"deleted_at": "2024-01-15T12:00:00Z"
}

Orchestration Patterns

PatternDescription
SINGLESingle agent execution
SEQUENTIALChain of agents in order
PARALLELMultiple agents simultaneously
HIERARCHICALSupervisor with sub-agents

Error Responses

{
"error": {
"code": "agent_not_found",
"message": "Agent 'agent_xyz' not found",
"status": 404
}
}