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}/chatSends 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
| Parameter | Type | Required | Description |
|---|---|---|---|
teamId | string | Yes | The team’s unique identifier |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | The user’s message text |
sessionId | string | Yes | Unique session identifier |
conversationId | string | No | Existing conversation ID (for continuity) |
Headers
| Header | Value | Required |
|---|---|---|
Authorization | Bearer agx_live_YOUR_KEY | Yes |
Content-Type | application/json | Yes |
Response
The response is a streaming text response, identical in format to the single-agent Chat API. Additional headers provide routing information:
| Header | Description |
|---|---|
X-Agent-Id | The ID of the agent that handled this message |
X-Agent-Name | The name of the agent that handled this message |
X-Routing-Reason | Why this agent was selected (e.g., “intent match: billing”) |
X-Conversation-Id | The 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:
- Intent Analysis - The platform analyzes the message to determine the user’s intent
- Agent Matching - Each team member agent has a description and specialization. The router matches the intent to the best agent
- 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
- 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, orrandom - 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
| Status | Code | When |
|---|---|---|
400 | - | Missing message or sessionId |
401 | MISSING_API_KEY | No API key provided |
401 | INVALID_API_KEY | Invalid API key |
404 | - | Team not found, not public, or not active |
500 | - | Internal routing or processing error |
Last updated on