Interactive chat
Chat lets you describe what you want in plain language. An orchestrator model decides which
Tasks to create, runs them, checks on them, and reports back, streaming its progress as it
goes. You can chat from the dashboard, from the CLI with orka run, or over the API.
Try it
With the API port-forwarded and a client token in ORKA_TOKEN
and at least one Provider created, send one
message. The orchestrator decides what to do, creates the Tasks it needs, and streams
its progress back:
curl -N -H "Authorization: Bearer ${ORKA_TOKEN}" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"message": "Run a container task that prints the date, then tell me what it printed.", "namespace": "orka-system"}' \
http://localhost:8080/api/v1/chat
Swap Accept: text/event-stream for Accept: application/json to get one JSON
reply instead of a stream. From the CLI, the same conversation is:
Without --session, each orka run starts a new conversation.
orka run --session incident-123 "Run a container task that prints the date, then tell me what it printed."
orka run --session incident-123 "What did that task print?"
Endpoint
POST /api/v1/chat — Send a message (SSE streaming or JSON response)
GET /api/v1/chat/config — Get chat configuration and available tools
DELETE /api/v1/chat/:sessionId — Cancel a chat session
Architecture
User ──POST /api/v1/chat──▶ API Server ──▶ Concurrency Semaphore
│
├─▶ context.WithTimeout (--chat-max-duration, default 30m)
├─▶ Resolve Provider CRD → get LLM client
├─▶ Load/create chat session (prefix: chat-session-)
├─▶ Build structured system prompt (cached per request)
├─▶ Call LLM with tools
│ │
│ ├─▶ create_ai_task
│ ├─▶ create_container_task
│ ├─▶ create_agent_task
│ ├─▶ check_task_progress
│ ├─▶ fetch_task_output
│ ├─▶ wait_for_task
│ ├─▶ cancel_task
│ ├─▶ list_agents / list_tools / list_tasks
│ ├─▶ create_agent / update_agent / delete_agent (on-demand)
│ ├─▶ create_tool / delete_tool (on-demand)
│ └─▶ delete_session (on-demand)
│
├─▶ Stream response via SSE (with heartbeats)
└─▶ Detect client disconnect → cleanup
Request format
{
"message": "Create an AI task that summarizes Kubernetes best practices",
"sessionId": "my-session",
"provider": "anthropic",
"model": "claude-opus-5",
"namespace": "default",
"maxTokens": 4096,
"systemPrompt": "Focus on security topics",
"agentRef": "my-agent"
}
Only message is required. All other fields are optional:
sessionId: Existing session for continuity (auto-created if omitted)provider/model: Override the default LLM provider and modelagentRef: Use an Agent CRD for provider/model/temperature defaultssystemPrompt: Appended to the built-in orchestrator promptnamespace: Namespace for task operations
Response formats
SSE streaming (default)
All SSE events use a structured envelope:
id: <monotonic-seq>
event: <type>
data: {"sessionId":"...","content":"...","toolCall":{...},"error":{...},"usage":{...}}
Event types:
| Event | Description |
|---|---|
status | Stream opened — confirms session, provider, model |
message | Text content delta |
tool_call | Tool invocation (name + args) |
tool_result | Tool execution result |
error | Error with code and message |
done | Stream complete with usage stats |
JSON response
Send Accept: application/json for a blocking JSON response:
{
"sessionId": "chat-session-abc123",
"message": "I created an AI task...",
"toolCalls": [{"name": "create_ai_task", "args": {...}, "result": {...}}],
"usage": {"inputTokens": 4200, "outputTokens": 1800, "llmCalls": 3}
}
Available Tools
Core Tools (always loaded)
| Tool | Description |
|---|---|
create_ai_task | Create an AI/LLM-powered task |
create_container_task | Create a container task for shell commands |
create_agent_task | Create an ACP Task using an existing Agent configured with a built-in runtime or a ready external-v2 runtimeRef. |
check_task_progress | Get task phase/status conditions |
fetch_task_output | Get completed task result (truncated to 2K chars) |
wait_for_task | Wait for task completion (max 60s per call, non-blocking) |
cancel_task | Cancel/delete a task |
list_agents | List Agent CRDs with projected summaries |
list_tools | List Tool CRDs and built-in tools |
list_tasks | List tasks with optional status filter |
Management Tools (loaded on demand)
These are only included when the user's message signals CRUD intent:
| Tool | Description |
|---|---|
create_agent | Create an Agent CRD |
update_agent | Update an Agent CRD |
delete_agent | Delete an Agent CRD |
create_tool | Create a Tool CRD with HTTP endpoint |
delete_tool | Delete a Tool CRD |
delete_session | Delete a session and transcript |
System prompt
The system prompt uses XML-delimited sections for optimal tool-calling accuracy:
<identity>
You are the Orka orchestrator — an AI assistant that manages
Kubernetes-native task execution.
</identity>
<capabilities>...</capabilities>
<task_types>container, ai, agent with usage guidance</task_types>
<available_agents>...dynamically injected...</available_agents>
<available_tools>...dynamically injected...</available_tools>
<rules>Operational invariants</rules>
<examples>Complete multi-step tool-calling traces</examples>
Dynamic context (agents, tools) is built once at request start and cached for the tool loop duration.
Safety mechanisms
Concurrency control
- Bounded semaphore (
--chat-max-concurrent, default 10) - Returns
429 Too Many Requestswhen full
Timeouts
--chat-max-duration(default 30m): Wall-clock timeout per request--chat-tool-timeout(default 60s): Per-tool execution timeout--chat-max-iterations(default 50): Max tool execution loops
Resource limits
--chat-max-tasks-per-turn(default 5): Max tasks created per chat turn- Task names use session-scoped prefix to prevent collisions
Stuck-state detection
- Repetition detector: Same tool called with identical args 3 times → warning injected, 5 iterations penalized
- Progress assertion: Every 5 iterations, LLM must summarize progress
- Graceful termination: On iteration exhaustion, LLM must provide final summary
Error handling
Structured error responses help the LLM self-correct:
{
"success": false,
"error": "Agent 'my-agent' not found in namespace 'default'",
"errorType": "not_found",
"suggestion": "Use list_agents to see available agents"
}
Session management
- Chat sessions use prefix
chat-session-and typechatin the session store - Sessions store message summaries, not full tool outputs
- Auto-truncation when session exceeds
--chat-max-session-size(default 500KB) - First user message is always preserved for context
Namespace scoping
- Default to namespace from
ChatRequestor authenticated user's namespace kube-systemandkube-publicare blocked- All orchestrator-created resources get labels:
orka.ai/created-by: orchestrator,orka.ai/chat-session: <sessionId>
Configuration
Chat is on by default (--chat-enabled). --chat-provider and --chat-model set the default
Provider and model, and the limits above have their own flags. All of them are listed under
Controller flags.
Example usage
# Chat with SSE streaming
curl -N http://localhost:8080/api/v1/chat \
-H "Authorization: Bearer ${ORKA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"message": "Create an AI task that summarizes Kubernetes best practices",
"sessionId": "my-session"
}'
# Chat with JSON response
curl http://localhost:8080/api/v1/chat \
-H "Authorization: Bearer ${ORKA_TOKEN}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"message": "List all available agents"}'
# Get chat configuration
curl http://localhost:8080/api/v1/chat/config \
-H "Authorization: Bearer ${ORKA_TOKEN}"
# Cancel a chat session
curl -X DELETE http://localhost:8080/api/v1/chat/my-session \
-H "Authorization: Bearer ${ORKA_TOKEN}"