chat
Sends one message to an agent profile and returns reply, tool calls, trace ID, and session ID; reuse the session ID to continue the conversation.
Instructions
Run ONE chat turn against an agent through the same path the portal's test-chat widget uses: a POST to the profile's endpoint_path with your operator JWT, collected server-side. Returns {reply, tool_calls, trace_id, session_id, latency_ms, errors, served_by, status}. Pass the returned session_id back to continue the conversation.
Which config answers: profile_id ITSELF — a draft copy or a specialist
answers as itself (X-WAJ-Profile-Id, operator-only, same agent_kind as
the endpoint), exactly like the widget. profile_version_id instead pins a
saved snapshot. Each kind's own body is built for you (the AI-agents
demo's `agent` key + case_id); pass back the returned `state` with
session_id to continue a demo conversation.
env = this process's own environment runs in-process; the other env
goes to its default deployment target (deployment_targets).
tool_calls come from the persisted assistant message (name, input,
output — outputs capped at 2000 chars); trace_id is the turn's trace
(open with traces action=overview / transcript). Both can be null if
the agent doesn't persist/trace that turn; the reply is still
returned. This is a REAL turn: it runs the agent's tools and writes
chat history, as the widget does.Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"profile_id": "<profile_id>",
"message": "<message>"
},
"name": "chat"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Config branch: which `environment` rows of the AI config DB to read/write. staging = the editable working set (default); prod = what production serves. | staging |
| state | No | AI-agents demo kinds only: the `state` token the previous turn returned — pass it back with session_id to continue (it carries verification/sent status). | |
| locale | No | en | ar | tr | ru. | en |
| case_id | No | AI-agents demo kinds only: the use case to play (e.g. 'O01'; '' = the agent's first case). | |
| message | Yes | The user message for this turn. | |
| profile_id | Yes | Profile to talk to (list_profiles). Its endpoint_path is the route the message is sent to. | |
| session_id | No | Continue this conversation ('' = start a new one; the new id is returned). | |
| business_id | No | Business UUID to chat as (required by agents that read one business's data; '' = none). | |
| timeout_seconds | No | Give up after this many seconds (10-300). | |
| profile_version_id | No | Answer with this saved agent_profile_versions snapshot (X-WAJ-Profile-Version, operator-only) instead of profile_id's current config. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |