Skip to main content

Sending Chat Prompts

The /chat/query endpoint lets you send user prompts to the LLM and get back a response.

Depending on the user query, the LLM decides, with guidance from the system persona whether to simply answer the prompt or invoke one or more agent tools to generate the answer.

If agent tools are used, the response will include a run_id indicating that a run was created. You can then query the run's metadata using GET /chat/run/{run_id}.

If run_id is empty, you can assume it's a direct response from the LLM without tool invocation.

You may also receive artifacts, such as images or scripts generated by the agent, and suggestions: quick follow-up actions the user might take. You can ignore those completely, or present them to your user as quick follow-up choices.


Send a User Prompt​

POST /chat/query

Payload example:

{
"session_id": "52544d1b-5cd6-44f4-96dd-e29e4f5546fa",
"query": "Hello world"
}

Response Examples​

Simple LLM Response (no actions)​

{
"status": "ok",
"data": {
"role": "assistant",
"content": "Hello! 😊 Welcome to the world of codingβ€”or just saying hi! How can I assist you today? πŸš€",
"type": "message",
"status": "ok",
"run_id": "",
"suggestions": []
}
}

Here, the run_id is empty, so no tools were used.


Response with Actions & Artifacts​

{
"status": "ok",
"data": {
"role": "assistant",
"content": "The pie chart showing Query Inc's best-selling products has been created successfully. If you need further analysis or another type of visualization, feel free to ask!",
"type": "chat",
"status": "ok",
"run_id": "f4ea6730-3887-4bc2-9d04-754bfe930e67",
"artifacts": [
"/artifacts/711711aa-b288-484f-bb75-2ece6fc737f2/0x66028b34b195a3e5f20117c4fd37fb374f6ecf71/7921bb20-766c-4d6a-af60-bf3ad0bbcfff.png",
"/artifacts/711711aa-b288-484f-bb75-2ece6fc737f2/0x66028b34b195a3e5f20117c4fd37fb374f6ecf71/7921bb20-766c-4d6a-af60-bf3ad0bbcfff.py"
],
"suggestions": []
}
}

Here, a run_id is present, so agent tools were invoked, and artifacts were generated.


Response with Suggestions​

{
"status": "ok",
"data": {
"role": "assistant",
"content": "Ayy, that's what I'm talkin' about! Glad it's all smooth now, bro. If you need more help or just wanna vibe, hit me up anytime. Catch ya later! πŸš€πŸ˜Ž",
"type": "chat",
"status": "ok",
"run_id": "",
"artifacts": [],
"suggestions": [
"Add more modals for different actions",
"Optimize session fetching",
"Style the menu with animations"
]
}
}

Here, the response includes suggestions β€” helpful next actions the user might take.

Note: suggestions are not stored anywhere!