#Agentic Streaming
Creatoria Agent supports advanced agentic streaming features, including thinking chains (Thinking), automatic planning (Planning), step execution (Step Execution), and tool calling (Tool Calling).
#Overview
When using streaming mode (stream: true) for chat, the system automatically enables the following advanced features based on the Agent's configuration and the hint parameter in the request:
User Message -> Thinking Chain -> Automatic Planning -> Step Execution (with Tool Calls) -> Final Reply
#Enabling Agentic Features
Control via the hint parameter in the Chat API request:
json{
"message": "Help me analyze the technical architecture of this project",
"stream": true,
"hint": {
"planning": "auto",
"onStepFailure": "continue"
}
}
#hint Parameters
| Field | Value | Description |
|---|---|---|
planning | force | Force generation of an execution plan |
planning | auto | LLM decides whether planning is needed |
planning | none | No planning, reply directly |
onStepFailure | stop | Stop execution when a step fails |
onStepFailure | continue | Continue to the next step when a step fails |
onStepFailure | auto | LLM decides whether to continue |
#SSE Event Types
#Thinking Chain Event (thinking)
Displays the LLM's reasoning process:
json{
"sessionId": "sess_xxx",
"thinking": {
"content": "The user is asking about technical architecture, I need to..."
}
}
Thinking chain content is streamed incrementally. The content from multiple thinking events should be concatenated.
#Planning Event (plan)
When the LLM decides planning is needed, it generates an execution plan:
json{
"sessionId": "sess_xxx",
"plan": {
"steps": [
{
"id": "step_1",
"title": "Search relevant documents",
"description": "Search for technical architecture-related documents in the knowledge base"
},
{
"id": "step_2",
"title": "Analyze architecture patterns",
"description": "Analyze the tech stack and design patterns used in the project"
},
{
"id": "step_3",
"title": "Output analysis report",
"description": "Compile and output a complete technical architecture analysis"
}
]
}
}
#Step Start Event (stepStart)
json{
"sessionId": "sess_xxx",
"stepStart": {
"stepId": "step_1",
"title": "Search relevant documents",
"index": 0
}
}
#Step Complete Event (stepComplete)
json{
"sessionId": "sess_xxx",
"stepComplete": {
"stepId": "step_1",
"status": "completed",
"summary": "Found 3 relevant documents"
}
}
#Tool Call Event (toolCall)
When the Agent calls a tool:
json{
"sessionId": "sess_xxx",
"toolCall": {
"id": "tc_xxx",
"name": "web-search",
"arguments": {
"query": "NestJS microservice architecture"
}
}
}
#Tool Result Event (toolResult)
json{
"sessionId": "sess_xxx",
"toolResult": {
"toolCallId": "tc_xxx",
"name": "web-search",
"success": true,
"content": "Search result content...",
"duration": 1200
}
}
#Content Delta Event (delta)
Normal incremental text content:
json{
"sessionId": "sess_xxx",
"delta": {
"content": "Based on the analysis, this project uses"
}
}
#Usage Event (usage)
json{
"sessionId": "sess_xxx",
"usage": {
"inputTokens": 500,
"outputTokens": 1200,
"totalTokens": 1700
}
}
#Done Event (done)
json{
"sessionId": "sess_xxx",
"done": true,
"sources": [
{
"documentId": "doc_xxx",
"title": "Architecture Document",
"score": 0.95
}
],
"usage": {
"inputTokens": 500,
"outputTokens": 1200,
"totalTokens": 1700
}
}
#Error Event (error)
json{
"sessionId": "sess_xxx",
"error": "Tool execution failed: timeout"
}
#Complete Event Stream Example
data: {"sessionId":"sess_xxx","thinking":{"content":"The user wants to know about..."}}
data: {"sessionId":"sess_xxx","thinking":{"content":"I need to handle this step by step"}}
data: {"sessionId":"sess_xxx","plan":{"steps":[{"id":"step_1","title":"Search documents"},{"id":"step_2","title":"Analyze and summarize"}]}}
data: {"sessionId":"sess_xxx","stepStart":{"stepId":"step_1","title":"Search documents","index":0}}
data: {"sessionId":"sess_xxx","toolCall":{"id":"tc_1","name":"web-search","arguments":{"query":"..."}}}
data: {"sessionId":"sess_xxx","toolResult":{"toolCallId":"tc_1","name":"web-search","success":true,"content":"...","duration":800}}
data: {"sessionId":"sess_xxx","stepComplete":{"stepId":"step_1","status":"completed","summary":"Found relevant information"}}
data: {"sessionId":"sess_xxx","stepStart":{"stepId":"step_2","title":"Analyze and summarize","index":1}}
data: {"sessionId":"sess_xxx","delta":{"content":"Based on the search results, "}}
data: {"sessionId":"sess_xxx","delta":{"content":"the project's architecture..."}}
data: {"sessionId":"sess_xxx","stepComplete":{"stepId":"step_2","status":"completed"}}
data: {"sessionId":"sess_xxx","done":true,"usage":{"inputTokens":500,"outputTokens":800,"totalTokens":1300}}
data: [DONE]
#Agentic Data in History Messages
When reopening a session, the metadata field of history messages contains the full agentic data:
json{
"role": "assistant",
"content": "The final reply content...",
"metadata": {
"thinking": "Full thinking chain content",
"plan": {
"steps": [...]
},
"stepResults": [
{
"stepId": "step_1",
"title": "Search documents",
"status": "completed",
"summary": "Found relevant documents",
"toolCalls": [
{
"id": "tc_1",
"name": "web-search",
"arguments": {"query": "..."},
"status": "success",
"result": "Search results...",
"duration": 800
}
]
}
]
}
}
#Tool Types
Agents can use the following types of tools:
#Built-in Tools
| Tool Name | Description |
|---|---|
web-search | Web search |
code-search | Code search |
fetch-url | URL content fetching |
Controlled via the Agent's settings.toolsEnabled and settings.allowedToolCategories.
#Custom Tools
Associate custom code tools via settings.customToolIds. These tools execute user-defined code in a sandboxed environment.