Pular para o conteúdo

Agent Chat

POST
/api/v1/ai/agents/instances/{instance_id}/chat

Chat with a conversational agent instance.

Sprint 29: This endpoint allows direct chat with an agent, used for testing conversational agents and API integrations.

When tools_enabled=True, implements a mini ReAct loop that:

  • Executes tools configured for the agent
  • Records all iterations for orchestration analysis
  • Stores orchestration_data in AIMessage (superadmin only)

Returns Server-Sent Events with incremental response chunks when stream=True.

Event types:

  • content: Text chunk from LLM
  • tool_call: Tool execution started (name, input)
  • tool_result: Tool execution completed (name, output, duration_ms)
  • iteration: ReAct iteration progress
  • done: Final completion with stats and orchestration_data
  • error: Error occurred
instance_id
required
Instance Id
integer
x-tenant-id
Any of:
integer
AgentChatRequest

Request schema for agent chat endpoint.

object
message
required
Message
string
>= 1 characters <= 10000 characters
conversation_id
Any of:
integer
stream
Stream
boolean
default: true
tools_enabled
Tools Enabled
boolean
context_type
Any of:
string
context_id
Any of:
integer

Successful Response

Validation Error

HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string