Skip to main content
POST
/
agents
/
{id}
/
query-with-routing
Chat con routing automático de agente
curl --request POST \
  --url https://app.braviloai.com/api/agents/{id}/query-with-routing \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "conversationId": "<string>",
  "streaming": true,
  "channel": "dashboard",
  "machineId": "<string>",
  "fromUrl": "<string>"
}
'

Documentation Index

Fetch the complete documentation index at: https://docs.braviloai.com/llms.txt

Use this file to discover all available pages before exploring further.

Envía un mensaje a un agente con routing automático. Si hay triggers configurados, Bravilo detecta el agente correcto según el contexto y redirige la conversación.

Streaming

Cuando streaming está habilitado, el endpoint devuelve un stream text/event-stream con eventos SSE:
import { fetchEventSource } from '@microsoft/fetch-event-source';

const ctrl = new AbortController();

await fetchEventSource(`https://app.braviloai.com/api/agents/${agentId}/query-with-routing`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
signal: ctrl.signal,
body: JSON.stringify({
query: 'Hola, quiero saber el estado de mi pedido #1234',
streaming: true,
conversationId,
}),
onmessage: (event) => {
if (event.event === 'routing') {
console.log('Routing:', JSON.parse(event.data));
} else if (event.event === 'answer') {
console.log('Chunk:', event.data);
} else if (event.data === '[DONE]') {
ctrl.abort();
},
});

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string
required

ID del agente

Body

application/json
query
string
required

Mensaje del usuario

conversationId
string
streaming
boolean
default:true
channel
string
default:dashboard
machineId
string
fromUrl
string

Response

Respuesta del agente o stream SSE