Appearance
Assistant API
Project-scoped AI assistant for managing monitors and servers. Uses the same DeepSeek-backed stack as incident analysis and counts toward ai_analysis_limit_per_month.
Architecture (durable runs)
Assistant LLM/tool/SSH execution does not run inside the HTTP request.
POST .../messages(orPOST .../resume) creates anAssistantRunand enqueuesAssistantChatJobon the Quedefaultqueue (priority 10).- The
que_default/ ECSque-defaultworker runsAssistantAgent+ tools (including Net::SSH) and finalizes the assistant message. - Progress streams to clients over ActionCable (
AssistantConversationChannel). - Closing the browser tab does not cancel the run.
Statuses: queued → running → (waiting_human) → succeeded | failed | cancelled.
Authentication
Requires project authentication (Authorization: Bearer <project_or_user_token>). When using a user token, send X-Project-UUID if needed.
ActionCable requires a user authentication token (session cookie or ?token= / Authorization: Bearer <user_authentication_token>). The channel rejects non-members of the conversation's project.
ActionCable
| URL | wss://api.uptinio.com/cable?token=<user_authentication_token> (local: ws://localhost/cable?token=...) |
| Channel | AssistantConversationChannel |
| Params | { "conversation_uuid": "ASC..." } |
| Stream | assistant_conversation_<uuid> |
| Auth | User must be a project member |
| Origins | SPA origins allowlisted via action_cable.allowed_request_origins (same list as CORS: www/uptinio.com, staging, Vite localhost) |
Subscribe before posting a message so you do not miss early status / delta events.
Cross-process broadcasts (Que → browser) use Solid Cable on the primary Postgres database (solid_cable_messages). REDIS_URL is not required. Web and Que must share the same DB (they already do for Que jobs).
Host nginx in front of the container must forward WebSocket upgrades for /cable (see nginx-host-cable.conf and assistant-cable-ops.md). If Upgrade headers are stripped, ActionCable returns plain 404 Page not found and the SPA hangs on Thinking….
Client timeout / polling fallback
Clients must not wait forever for subscription confirmation or for done. Recommended:
- Timeout subscription ready (~8–15s) with a clear cable/proxy error.
- Timeout the run wait (~90–180s); then
GET /api/v1/assistant/runs/:run_uuidand/or refetch the conversation. - If the run is
succeeded/failed/waiting_human, settle UI from persisted messages even if cable was silent.
Get run status
GET /api/v1/assistant/runs/:uuid
json
{
"run": {
"uuid": "ASR...",
"kind": "chat",
"status": "succeeded",
"error": null,
"conversation_uuid": "ASC...",
"message_uuid": "ASM...",
"started_at": "...",
"finished_at": "...",
"created_at": "..."
},
"conversation": { "uuid": "ASC...", "messages": [ "...included when terminal or waiting_human..." ] }
}Event shapes
Every event includes run_uuid, conversation_uuid, and run_status.
type | When | Client should |
|---|---|---|
status | Run start, each tool start/end, SSH progress | Update activity label (not only “Thinking…”) |
delta | Token/chunk of assistant reply (frequent) | Append content to the in-progress assistant bubble |
tool | Tool start / end / recorded | Optional structured activity / debug UI |
error | Run failed | Show error and stop waiting |
done | Run finished (or paused for human) | Settle UI from message / refetch |
needs_credentials / needs_approval | Waiting on human | Show credential / approval widget |
json
{ "type": "status", "content": "Thinking…", "run_uuid": "ASR...", "conversation_uuid": "ASC...", "run_status": "running" }
{ "type": "status", "content": "Looking up recent incidents…", "run_uuid": "ASR...", "conversation_uuid": "ASC...", "run_status": "running" }
{ "type": "tool", "name": "list_incidents", "phase": "start", "arguments": { "status": "ongoing" }, "run_uuid": "ASR...", "conversation_uuid": "ASC...", "run_status": "running" }
{ "type": "tool", "name": "list_incidents", "phase": "end", "success": true, "run_uuid": "ASR...", "conversation_uuid": "ASC...", "run_status": "running" }
{ "type": "delta", "content": "Created ", "run_uuid": "ASR...", "conversation_uuid": "ASC...", "run_status": "running" }
{ "type": "tool", "name": "create_monitor", "phase": "recorded", "action": { "...": "..." }, "run_uuid": "ASR...", "conversation_uuid": "ASC...", "run_status": "running" }
{ "type": "error", "success": false, "error": "...", "run_uuid": "ASR...", "conversation_uuid": "ASC...", "run_status": "failed" }
{ "type": "done", "success": true, "conversation_uuid": "ASC...", "message": { "...": "..." }, "actions_taken": [], "run_uuid": "ASR...", "run_status": "succeeded" }
{ "type": "needs_credentials", "success": true, "pending_action": { "...": "..." }, "message": { "...": "..." }, "run_uuid": "ASR...", "run_status": "waiting_human" }
{ "type": "needs_approval", "success": true, "pending_action": { "...": "..." }, "message": { "...": "..." }, "run_uuid": "ASR...", "run_status": "waiting_human" }When a run pauses for credentials/approval, clients also receive a done event with waiting_human: true.
Streaming contract: clients must append every delta.content as it arrives. Do not wait for done to render the reply — done only finalizes persistence metadata. If the model withholds token deltas after tool rounds, the worker still emits progressive delta chunks (split from the final text) before done.
Activity status examples: Looking up recent incidents…, Listing monitors…, Checking server details…, Connecting over SSH…, SSH still running… (Ns / Ts), then back to Thinking… between tool rounds.
Conversations
List conversations
GET /api/v1/assistant/conversations
json
{
"data": [
{
"uuid": "ASC...",
"title": "Create HTTP monitor",
"created_at": "2026-11-10T12:00:00Z",
"updated_at": "2026-11-10T12:05:00Z"
}
]
}Create conversation
POST /api/v1/assistant/conversations
Body (optional):
json
{ "title": "Optional title" }Get conversation
GET /api/v1/assistant/conversations/:uuid
Returns the conversation with messages (oldest first).
Delete conversation
DELETE /api/v1/assistant/conversations/:uuid
Resume (credentials / command approval)
POST /api/v1/assistant/conversations/:uuid/resume
When a tool needs secrets or allowlist approval, the assistant message includes metadata.ui and the run emits needs_credentials / needs_approval:
credential_form— collect credentials via the Credentials API, then resume with refs only (or cancel)command_approval— allow, allow_and_remember, or deny
Credentials submitted (secrets already stored; only UUIDs):
json
{ "type": "credentials_submitted", "credential_uuids": ["CRD..."] }Credentials cancelled (dismiss the credential form without submitting):
json
{ "type": "credentials_cancelled" }Command approval:
json
{ "type": "command_approval", "decision": "allow" }decision may be allow, allow_and_remember (adds the binary to the project allowlist), or deny.
Response (202 Accepted) — run is queued; watch ActionCable for completion:
json
{
"success": true,
"conversation_uuid": "ASC...",
"run_uuid": "ASR...",
"status": "queued",
"pending_action": { "...": "..." }
}Conversation JSON may include pending_action while a widget is outstanding.
Messages
Send a message
POST /api/v1/assistant/conversations/:uuid/messages
json
{ "content": "Create an HTTP monitor for https://example.com every 5 minutes" }Success response (202 Accepted):
json
{
"success": true,
"conversation_uuid": "ASC...",
"conversation_title": "Create an HTTP monitor…",
"run_uuid": "ASR...",
"status": "queued",
"user_message": {
"uuid": "ASM...",
"role": "user",
"content": "Create an HTTP monitor…",
"metadata": {},
"actions_taken": [],
"created_at": "2026-11-10T12:01:00Z"
},
"pending_action": null
}The assistant reply is not in this response. Subscribe to AssistantConversationChannel and wait for done (or needs_credentials / needs_approval / error).
When the monthly AI limit is reached, the API returns 402 with limit_reached: true.
Streaming note
stream=true / Accept: text/event-stream no longer runs the agent inside the HTTP request. The POST still returns the enqueue JSON above. Use ActionCable for real-time tokens, status, and tool activity.
Capabilities
The assistant can:
- List / get / create / update / pause / resume / delete network monitors
- List / get servers, update alert settings, delete servers
- Return Linux agent install instructions (servers self-register; no REST create)
- Check latest server-agent release via
get_server_agent_latest_version(optional compare to a server's reportedagentversion) - Update an agent over SSH with a short path:
get_server_install_instructionsthen onerun_ssh_commandusingupdate_command/install_command(timeout max 300s; ActionCable emits SSH progress status events) - Search incidents with filters, inspect incident detail, and read incident event timelines
- List monitor check transactions to correlate failures with incident history
- Inspect tool schemas via
get_tool_info(arguments, required fields, and option enums) - Request credentials via
request_credentials(form schema only — never secret plaintext; see Credentials API) - Run customer-server commands via
run_server_command(enqueuesServerCommandJobfor the Go agent) - SSH into customer hosts via
run_ssh_command/ install packages viainstall_on_server(vaultedssh_pemorusername_password; see Assistant SSH) - No local/platform shell on the Uptinio application host (
run_commandis removed) - Record tool-gap alerts when a capability is missing
Ops / security invariants
- Workflow: clarify → plan → execute; support
@servermentions by hostname/UUID and@credentialmentions by name - Model/AI only sees credential refs (
cred:CRD…, names, or@name) — noread_secrettool;CredentialBrokerstrips@and matches slugified names - Commands (Go agent + SSH) pass
CommandAllowlistFilterunlessproject.allow_all_commands - SSH tools never return private keys/passwords; stdout/stderr are secret-scrubbed
- Unknown/missing tools soft-message the user and record a project-scoped
ToolGapAlert - Approval policy: allowlist + remember +
pending_action/waiting_human(unchanged product behavior)
Incident tools
| Tool | Purpose | Key filters / args |
|---|---|---|
list_incidents | Search project incidents | status, severity, incident_type, monitorable_type, resource_uuid, confirmed (true/false/all), snoozed, start_date, end_date, search, has_ai_analysis, include_logs, include_statistics, limit |
get_incident | Full incident detail + optional logs | uuid, include_logs |
get_incident_events | Timeline / history messages | uuid, limit, order |
list_monitor_transactions | Check-result history | monitor_uuid, start_date, end_date, transaction_type, status, include_statistics, limit |
list_incidents defaults to confirmed incidents (confirmed=true) to match the public incidents API. Pass confirmed=all or confirmed=false when investigating flapping/unconfirmed checks.
Supported check regions for monitor create/update: us and eu only.
Destructive deletes require an explicit confirmation turn in chat before the tool runs with confirmed=true.