Skip to Content
API ReferenceTeams API

Teams API

Agent Teams allow multiple specialized agents to collaborate on conversations. The platform automatically routes messages to the most appropriate agent based on intent analysis.

Send a Message to a Team

POST /api/public/teams/{teamId}/chat

Sends a message to an agent team. The team’s routing logic determines which agent handles the message based on the conversation context and each agent’s specialization.

Path Parameters

ParameterTypeRequiredDescription
teamIdstringYesThe team’s unique identifier

Request Body

FieldTypeRequiredDescription
messagestringYesThe user’s message text
sessionIdstringYesUnique session identifier
conversationIdstringNoExisting conversation ID (for continuity)

Headers

HeaderValueRequired
AuthorizationBearer agx_live_YOUR_KEYYes
Content-Typeapplication/jsonYes

Response

The response is a streaming text response, identical in format to the single-agent Chat API. Additional headers provide routing information:

HeaderDescription
X-Agent-IdThe ID of the agent that handled this message
X-Agent-NameThe name of the agent that handled this message
X-Routing-ReasonWhy this agent was selected (e.g., “intent match: billing”)
X-Conversation-IdThe conversation ID

Example

curl -X POST https://app.agentix.cl/api/public/teams/team_abc/chat \ -H "Authorization: Bearer agx_live_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{ "message": "I need help with my recent order", "sessionId": "visitor-session-001" }'

How Routing Works

When a message arrives at a team endpoint:

  1. Intent Analysis - The platform analyzes the message to determine the user’s intent
  2. Agent Matching - Each team member agent has a description and specialization. The router matches the intent to the best agent
  3. Context Continuity - If a conversation is already in progress with a specific agent, messages continue to route to that agent unless a clear topic change is detected
  4. Fallback - If no agent matches, the team’s default agent handles the message

Team Configuration

Teams are configured in the Agentix dashboard under Agent Teams:

  • Name - Team display name
  • Description - What the team handles
  • Routing Strategy - intent (AI-based routing), round-robin, or random
  • Members - Agents assigned to the team with their specialization descriptions
  • Default Agent - Fallback agent when no match is found
  • Public - Whether the team is accessible via the public API

JavaScript Example

const response = await fetch( 'https://app.agentix.cl/api/public/teams/team_abc/chat', { method: 'POST', headers: { 'Authorization': 'Bearer agx_live_YOUR_KEY', 'Content-Type': 'application/json', }, body: JSON.stringify({ message: 'I need help with my recent order', sessionId: 'visitor-session-001', }), } ) // Check which agent handled the request const agentName = response.headers.get('X-Agent-Name') const routingReason = response.headers.get('X-Routing-Reason') console.log(`Handled by: ${agentName} (${routingReason})`) // Read streaming response const reader = response.body.getReader() const decoder = new TextDecoder() while (true) { const { done, value } = await reader.read() if (done) break process.stdout.write(decoder.decode(value)) }

Error Responses

StatusCodeWhen
400-Missing message or sessionId
401MISSING_API_KEYNo API key provided
401INVALID_API_KEYInvalid API key
404-Team not found, not public, or not active
500-Internal routing or processing error
Last updated on