Syte API
v0.9.2 · Machine-readable: /api/ai.json · Sycord: /sycord/api/ · Hash routes like #agent/agent-change
External page integration
Minimal flow to drive a Syte cloud agent from an external site (token API under /api).
- Create token Use Users → Create token when an authenticated operator session is available; programmatic callers must send an existing operator credential to
POST /api/tokens. SendX-API-Keyon every later call. - Warm runtime
POST /api/agent_warmwith{"uuid"}, then pollGET /api/agent_status?uuid=untilagent_status="running"andagent_healthy=true. Running-since =agent_last_started_at(not a stream event). - Send work
POST /api/agent_change(preferred for external pages — background). Response includesturso_session_id+request_id. - Follow progress Open SSE
GET /api/agent_activity/stream?uuid=&since_id=and/or poll durableGET /api/agent_session/{turso_session_id}?since_id=N. - Answer questions On
questionevents, callPOST /api/agent_answer_question. - Interrupt / stop
POST /api/agent_interruptor/agent_cancelfor the turn;/agent_stopfor the runtime.
curl -s -X POST https://host/api/agent_change \
-H "X-API-Key: $TOKEN" -H "Content-Type: application/json" \
-d '{"uuid":"my-site","message":"Add a pricing page"}'
# → { "ok": true, "request_id": "req_…", "turso_session_id": "sess_…", "status": "accepted" }
token_delta, thinking_delta — skip Turso; slim wire onlyid, event_type, detail, payload.{delta,request_id,session,agent}gzip/br when Accept-Encoding allowsagent_session_event in backgroundGET /api/agent_session/{id}?since_id=Nid: 130
event: token_delta
data: {"id":130,"event_type":"token_delta","detail":"I'll add a pricing","payload":{"delta":"I'll add a pricing","request_id":"req_8f2a","session":3,"agent":"main"}}
id: 150
event: tool_call_started
data: {"id":150,"event_type":"tool_call_started","role":"assistant","title":"write_file","detail":"app/app/pricing/page.tsx","payload":{"tool":"write_file","tool_call_id":"call_91","request_id":"req_8f2a","session":3,"agent":"main"},"source":"agent","created_at":"2026-07-25T21:00:10Z"}
: heartbeat
GUI / cookie session uses the same capabilities under /api/projects/{uuid}/agent/*. External pages should prefer the flat token API (/api/agent_*) with X-API-Key.
GET /api/projects/{uuid}/agent ↔ GET /api/agent_status…/agent/warm|start|stop|interrupt|restartGET …/agent/activity/stream ↔ /api/agent_activity/streamGET …/agent/sessions ↔ /api/agent_sessionsPOST …/agent/chat ↔ /api/agent_communicate / agent_changeAuthentication
All external API endpoints require an API key, except GET /api/health. Token management additionally accepts an authenticated same-origin operator session.
{
"ok": true,
"token": "syte_abc123…",
"prefix": "syte_abc…"
}Bearer syte_your_token_here.curl -H "X-API-Key: syte_…" https://host/api/agent_status?uuid=my-site
Platform & Managed Databases
Provision private database containers (PostgreSQL, MySQL, MariaDB, MongoDB, Redis, KeyDB, Dragonfly, ClickHouse), view connections, and schedule logical backups.
{
"engines": [
{ "id": "postgres", "name": "PostgreSQL", "default_version": "16", "default_port": 5432 },
{ "id": "mysql", "name": "MySQL", "default_version": "8.0", "default_port": 3306 },
{ "id": "redis", "name": "Redis", "default_version": "7.2", "default_port": 6379 }
]
}
[
{
"uuid": "db-pg-12345",
"name": "app-postgres",
"engine": "postgres",
"version": "16",
"status": "running",
"created_at": "2025-01-15T12:00:00Z"
}
]
{
"uuid": "db-pg-12345",
"name": "app-postgres",
"engine": "postgres",
"status": "running",
"connection_url": "postgres://postgres:password@db-pg-12345:5432/postgres"
}
{
"uuid": "db-pg-12345",
"DATABASE_URL": "postgres://postgres:secret@db-pg-12345:5432/postgres",
"internal_host": "db-pg-12345",
"port": 5432
}
[
{
"uuid": "bck-sched-01",
"database_uuid": "db-pg-12345",
"cron_expression": "0 2 * * *",
"enabled": true
}
]
{
"execution_id": "exec-991",
"status": "completed",
"file_path": "/var/lib/syte/backups/db-pg-12345-20250115.sql.gz"
}
{ "success": true, "message": "Database restored successfully from local artifact" }
Project
Create, delete, start, and stop deployment projects.
github.com/user/repo.gitmain.false. Prefer issue_deploy.{
"ok": true,
"uuid": "my-site-a1b2c3",
"status": "created"
}
{"uuid":"my-site-a1b2c3"}
{"ok":true,"uuid":"…","running":true}
{"ok":true,"uuid":"…","running":false}
Workspace
List, read, write, and execute inside the project workspace.
app/package.json. UTF-8 or base64 for binary.{"ok":true,"path":"app/package.json","content":"{…}","encoding":"utf-8"}
uuid, path, file.issue_deploy for production builds.app.{"ok":true,"exit_code":0,"output":"…","command":"npm run lint"}
command, optional cwd, timeout, stop_on_error.Deploy / Preview / Env
Production deploy, fast HMR preview, and environment variables.
{"ok":true,"uuid":"…","stream_url":"/api/projects/…/logs/stream?live=1"}
api_key query param.{"type":"build","text":"Step 1/21 …"}
dev script.{
"ok": true,
"preview_url": "https://previewk-mysite.example.com",
"preview_ready": true,
"preview_running": true
}
preview_ready: true.{"NODE_ENV":"production"}true — merge; false replaces all.{"uuid":"…","env_vars":{"NODE_ENV":"production"},"merge":true}
Agent (token API)
Manage a project agent from an external page. Base /api, header X-API-Key. Session-auth mirrors live at /api/projects/{uuid}/agent/*.
syra-nano (Go / Gemini 2.5), syra-ultra (Air / Aliyun Qwen), and syra-havy (Metal / VyceAI Claude Sonnet 4.6). Configure keys in Settings → AI. Prefer agent_change (background) for external UIs; agent_communicate waits for the turn.agent_last_started_at is the "running since" timestamp — it is not a stream event. agent_turso_sync drives the brain indicator.{
"ok": true,
"uuid": "my-site",
"agent_status": "running",
"agent_running": true,
"agent_busy": false,
"agent_healthy": true,
"agent_last_started_at": "2026-07-25T20:59:50Z",
"agent_last_error": "",
"agent_turso_sync": {
"turso_configured": true,
"session": 3,
"turso_session_id": "sess_9c1e…",
"total_messages": 12,
"synced_messages": 12,
"all_saved": true
},
"agent_model": {"profile": "syra-nano", "model": "gemini-2.5-flash"}
}
agent_started.{"uuid":"my-site","ok":true,"status":"warming","already_warming":false}
{"uuid":"my-site"}
syra-nano|syra-ultra|syra-havy{"uuid":"my-site","model_profile":"syra-nano"}
{"ok":true,"uuid":"…","logs":"…","stream_url":"/api/projects/…/agent/logs/stream?live=1"}
last or session number — filter that session only.GET /api/agent_session/{{id}}.{
"ok": true,
"events": […],
"sessions_url": "/api/agent_sessions?uuid=…",
"stream_url": "/api/agent_activity/stream?uuid=…&since_id=0"
}
token_delta/thinking_delta are minimal-delta; body may be gzip/brotli. Heartbeat : heartbeat ~15s.last or session number.gzip, br for compressed SSE.GET /api/agent_activity/stream?uuid=my-site&since_id=0 X-API-Key: syte_… Accept: text/event-stream Accept-Encoding: gzip, br
id: 130
event: token_delta
data: {"id":130,"event_type":"token_delta","detail":"Hello","payload":{"delta":"Hello","request_id":"req_1","session":1,"agent":"main"}}
: heartbeat
id: 150
event: tool_call_started
data: {"id":150,"event_type":"tool_call_started",…}
{
"ok": true,
"turso_configured": true,
"sessions": [{{"id":"sess_…","session_url":"/api/agent_session/sess_…"}}],
"open_session": "sess_…",
"resume_session": "sess_…"
}
project_id).{
"ok": true,
"id": "sess_9c1e…",
"project_id": "my-site",
"status": "open",
"events": [{{"id": 12, "event_type": "assistant_message", …}}],
"next_since_id": 12
}
all_saved: true → green brain; false → red (unsynced local messages).{
"ok": true,
"turso_configured": true,
"session": 3,
"turso_session_id": "sess_…",
"total_messages": 12,
"synced_messages": 12,
"all_saved": true
}
{
"ok": true,
"request_id": "req_…",
"turso_session_id": "sess_…",
"reply": "…",
"status": "completed"
}
model_name.{
"ok": true,
"request_id": "req_8f2a",
"turso_session_id": "sess_9c1e…",
"status": "accepted",
"change_applied": null
}
{"ok":true,"questions":[{{"id":"q_7","prompt":"Which tiers?","status":"pending","options":[…]}}]}
{"uuid":"my-site","question_id":"q_7","answer":"Free / Pro / Enterprise"}
/api/projects/{{uuid}}/agent/mcp (+ connect/call)./api/projects/{{uuid}}/agent/skills.Stream events
Every activity event key emitted on /api/agent_activity/stream. Use mini-tabs to jump. Hot keys are slim; everything else is full cold JSON.
/api/projects/{{uuid}}/agent/activity/stream and Sycord /sycord/api/agent_activity/stream.id: + event: + data: JSON. Idle connections receive comment heartbeats.token_delta, thinking_deltaid, event_type, detail, tiny payloadContent-Encoding: gzip|br when acceptedagent_status.agent_last_started_at — not a stream key{
"id": 101,
"event_type": "request_started",
"role": "system",
"title": "Request started",
"detail": "Build a pricing page",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"turso_session_id": "sess_9c1e…"
},
"source": "api",
"created_at": "2026-07-25T21:00:00Z"
}id: …
event: request_started
data: {…}
{
"id": 102,
"event_type": "processing",
"role": "system",
"title": "Processing",
"detail": "Planning layout",
"payload": {"request_id": "req_8f2a", "session": 3, "agent": "main"},
"source": "agent",
"created_at": "2026-07-25T21:00:01Z"
}id: …
event: processing
data: {…}
{
"id": 103,
"event_type": "status",
"role": "system",
"title": "Status",
"detail": "Waiting for preview",
"payload": {"request_id": "req_8f2a", "session": 3, "agent": "main", "level": "info"},
"source": "agent",
"created_at": "2026-07-25T21:00:02Z"
}id: …
event: status
data: {…}
{
"id": 10,
"event_type": "agent_started",
"role": "system",
"title": "Cloud agent ready",
"detail": "VM-native Syte cloud runtime is ready",
"payload": {"runtime": "syte-cloud"},
"source": "syte-cloud",
"created_at": "2026-07-25T20:59:50Z"
}id: …
event: agent_started
data: {…}
{
"id": 400,
"event_type": "agent_stopped",
"role": "system",
"title": "Agent stopped",
"detail": "Runtime shut down",
"payload": {},
"source": "api",
"created_at": "2026-07-25T22:00:00Z"
}id: …
event: agent_stopped
data: {…}
{
"id": 50,
"event_type": "agent_restarted",
"role": "system",
"title": "Cloud session restarted",
"detail": "",
"payload": {},
"source": "syte-cloud",
"created_at": "2026-07-25T21:10:00Z"
}id: …
event: agent_restarted
data: {…}
{
"id": 110,
"event_type": "thinking",
"role": "assistant",
"title": "Thinking",
"detail": "I should inspect the existing layout before editing…",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"content": "I should inspect the existing layout before editing…"
},
"source": "agent",
"created_at": "2026-07-25T21:00:03Z"
}id: …
event: thinking
data: {…}
id: …
event: thinking_delta
data: {
"id": 111,
"event_type": "thinking_delta",
"detail": " before editing",
"payload": {
"delta": " before editing",
"request_id": "req_8f2a",
"session": 3,
"agent": "main"
}
}
{
"id": 120,
"event_type": "plan",
"role": "assistant",
"title": "Plan",
"detail": "1. Audit home 2. Add pricing section 3. Wire CTA",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"plan_id": "plan_12",
"steps": [
{"id": "s1", "text": "Audit home", "status": "done"},
{"id": "s2", "text": "Add pricing section", "status": "running"},
{"id": "s3", "text": "Wire CTA", "status": "pending"}
]
},
"source": "agent",
"created_at": "2026-07-25T21:00:05Z"
}id: …
event: plan
data: {…}
id: …
event: token_delta
data: {
"id": 130,
"event_type": "token_delta",
"detail": "I'll add a pricing",
"payload": {
"delta": "I'll add a pricing",
"request_id": "req_8f2a",
"session": 3,
"agent": "main"
}
}
{
"id": 140,
"event_type": "message_snapshot",
"role": "assistant",
"title": "Assistant",
"detail": "I'll add a pricing section with three tiers…",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"content": "I'll add a pricing section with three tiers…"
},
"source": "agent",
"created_at": "2026-07-25T21:00:08Z"
}id: …
event: message_snapshot
data: {…}
{
"id": 200,
"event_type": "assistant_message",
"role": "assistant",
"title": "Assistant",
"detail": "Done — pricing section is live on /pricing.",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"content": "Done — pricing section is live on /pricing."
},
"source": "agent",
"created_at": "2026-07-25T21:01:20Z"
}id: …
event: assistant_message
data: {…}
{
"id": 100,
"event_type": "user_message",
"role": "user",
"title": "User",
"detail": "Build a pricing page",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"content": "Build a pricing page"
},
"source": "external_api",
"created_at": "2026-07-25T21:00:00Z"
}id: …
event: user_message
data: {…}
{
"id": 150,
"event_type": "tool_call_started",
"role": "assistant",
"title": "write_file",
"detail": "app/app/pricing/page.tsx",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"tool": "write_file",
"tool_call_id": "call_91",
"args": {"path": "app/app/pricing/page.tsx"}
},
"source": "agent",
"created_at": "2026-07-25T21:00:10Z"
}id: …
event: tool_call_started
data: {…}
{
"id": 151,
"event_type": "tool_call_finished",
"role": "tool",
"title": "write_file",
"detail": "wrote 1842 bytes",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"tool": "write_file",
"tool_call_id": "call_91",
"ok": true,
"result": {"bytes": 1842}
},
"source": "agent",
"created_at": "2026-07-25T21:00:11Z"
}id: …
event: tool_call_finished
data: {…}
{
"id": 152,
"event_type": "tool_error",
"role": "tool",
"title": "execute_command",
"detail": "exit 1",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"tool": "execute_command",
"tool_call_id": "call_92",
"ok": false,
"error": "npm ERR! Missing script: lint"
},
"source": "agent",
"created_at": "2026-07-25T21:00:15Z"
}id: …
event: tool_error
data: {…}
{
"id": 153,
"event_type": "tool_call",
"role": "assistant",
"title": "read_file",
"detail": "app/package.json",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"tool": "read_file",
"path": "app/package.json"
},
"source": "agent",
"created_at": "2026-07-25T21:00:06Z"
}id: …
event: tool_call
data: {…}
{
"id": 160,
"event_type": "file_created",
"role": "system",
"title": "Created file",
"detail": "app/app/pricing/page.tsx",
"payload": {"path": "app/app/pricing/page.tsx", "request_id": "req_8f2a", "session": 3, "agent": "main"},
"source": "agent",
"created_at": "2026-07-25T21:00:11Z"
}id: …
event: file_created
data: {…}
{
"id": 161,
"event_type": "file_modified",
"role": "system",
"title": "Modified file",
"detail": "app/components/Header.tsx",
"payload": {"path": "app/components/Header.tsx", "request_id": "req_8f2a", "session": 3, "agent": "main"},
"source": "agent",
"created_at": "2026-07-25T21:00:12Z"
}id: …
event: file_modified
data: {…}
{
"id": 162,
"event_type": "file_deleted",
"role": "system",
"title": "Deleted file",
"detail": "app/app/old-promo/page.tsx",
"payload": {"path": "app/app/old-promo/page.tsx", "request_id": "req_8f2a", "session": 3, "agent": "main"},
"source": "agent",
"created_at": "2026-07-25T21:00:13Z"
}id: …
event: file_deleted
data: {…}
{
"id": 163,
"event_type": "file_read",
"role": "system",
"title": "Read file",
"detail": "app/package.json",
"payload": {"path": "app/package.json", "request_id": "req_8f2a", "session": 3, "agent": "main"},
"source": "agent",
"created_at": "2026-07-25T21:00:04Z"
}id: …
event: file_read
data: {…}
{
"id": 164,
"event_type": "file_search",
"role": "system",
"title": "Search",
"detail": "pricing",
"payload": {"query": "pricing", "hits": 4, "request_id": "req_8f2a", "session": 3, "agent": "main"},
"source": "agent",
"created_at": "2026-07-25T21:00:04Z"
}id: …
event: file_search
data: {…}
{
"id": 165,
"event_type": "file_changed",
"role": "system",
"title": "File changed",
"detail": "app/app/page.tsx",
"payload": {"path": "app/app/page.tsx", "op": "modify", "request_id": "req_8f2a", "session": 3, "agent": "main"},
"source": "agent",
"created_at": "2026-07-25T21:00:14Z"
}id: …
event: file_changed
data: {…}
{
"id": 170,
"event_type": "command_run",
"role": "system",
"title": "Command",
"detail": "npm install lucide-react",
"payload": {
"command": "npm install lucide-react",
"cwd": "app",
"exit_code": 0,
"request_id": "req_8f2a",
"session": 3,
"agent": "main"
},
"source": "agent",
"created_at": "2026-07-25T21:00:16Z"
}id: …
event: command_run
data: {…}
{
"id": 171,
"event_type": "command_output",
"role": "system",
"title": "Output",
"detail": "added 1 package in 1s",
"payload": {
"command": "npm install lucide-react",
"stream": "stdout",
"chunk": "added 1 package in 1s",
"request_id": "req_8f2a",
"session": 3,
"agent": "main"
},
"source": "agent",
"created_at": "2026-07-25T21:00:16Z"
}id: …
event: command_output
data: {…}
{
"id": 180,
"event_type": "screenshot",
"role": "system",
"title": "Screenshot",
"detail": "Homepage",
"payload": {
"screenshot_id": "ss_44",
"url": "/api/agent_screenshots?uuid=my-site…",
"preview_url": "https://previewk-mysite.example.com",
"request_id": "req_8f2a",
"session": 3,
"agent": "main"
},
"source": "agent",
"created_at": "2026-07-25T21:00:40Z"
}id: …
event: screenshot
data: {…}
{
"id": 190,
"event_type": "question",
"role": "assistant",
"title": "Question",
"detail": "Which pricing tiers should we show?",
"payload": {
"question_id": "q_7",
"prompt": "Which pricing tiers should we show?",
"options": ["Free / Pro / Enterprise", "Starter / Growth / Scale"],
"request_id": "req_8f2a",
"session": 3,
"agent": "main"
},
"source": "agent",
"created_at": "2026-07-25T21:00:20Z"
}id: …
event: question
data: {…}
{
"id": 191,
"event_type": "question_answered",
"role": "user",
"title": "Answer",
"detail": "Free / Pro / Enterprise",
"payload": {
"question_id": "q_7",
"answer": "Free / Pro / Enterprise",
"request_id": "req_8f2a",
"session": 3,
"agent": "main"
},
"source": "external_api",
"created_at": "2026-07-25T21:00:45Z"
}id: …
event: question_answered
data: {…}
{
"id": 230,
"event_type": "request_completed",
"role": "system",
"title": "Completed",
"detail": "Done — pricing section is live on /pricing.",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"turso_session_id": "sess_9c1e…",
"status": "completed"
},
"source": "agent",
"created_at": "2026-07-25T21:01:21Z"
}id: …
event: request_completed
data: {…}
{
"id": 231,
"event_type": "request_failed",
"role": "system",
"title": "Failed",
"detail": "provider_error",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"error": "provider_error",
"message": "Upstream 429"
},
"source": "agent",
"created_at": "2026-07-25T21:01:21Z"
}id: …
event: request_failed
data: {…}
{
"id": 240,
"event_type": "session_stopped",
"role": "system",
"title": "Session stopped",
"detail": "User stopped session 3",
"payload": {"session": 3, "reason": "user"},
"source": "api",
"created_at": "2026-07-25T22:00:00Z"
}id: …
event: session_stopped
data: {…}
{
"id": 229,
"event_type": "usage",
"role": "system",
"title": "Usage",
"detail": "12.4k tokens · $0.042",
"payload": {
"request_id": "req_8f2a",
"session": 3,
"agent": "main",
"input_tokens": 8200,
"output_tokens": 3100,
"thinking_tokens": 1100,
"total_tokens": 12400,
"cost_usd": 0.042,
"cost_label": "$0.042"
},
"source": "agent",
"created_at": "2026-07-25T21:01:20Z"
}id: …
event: usage
data: {…}
{
"id": 175,
"event_type": "service_action",
"role": "system",
"title": "Preview started",
"detail": "https://previewk-mysite.example.com",
"payload": {
"action": "start_preview",
"preview_url": "https://previewk-mysite.example.com",
"request_id": "req_8f2a",
"session": 3,
"agent": "main"
},
"source": "agent",
"created_at": "2026-07-25T21:00:35Z"
}id: …
event: service_action
data: {…}
event: error
data: {"event_type":"error","error":"stream_failed","message":"…"}
: heartbeat
Turso persistence
Durable cross-host storage for sessions, events, messages, requests, and subagents. Hot stream deltas never write here.
- Open session On turn start Syte opens/reuses an
agent_sessionand returnsturso_session_idfromagent_change/agent_communicate. - record_request Inserts
agent_request(statusrunning, cost null). - Cold events Background mirror into
agent_session_event. Chat rows go toagent_message. - Subagents
record_subagent_task→ activity lines →finalize_subagent_task. - finalize_request Closes the request with reply, usage, cost, activity_count.
Settings → AI: set turso_database_url and turso_auth_token. Without them, local fallback keeps sessions on the host disk.
// Settings → AI turso_database_url = "libsql://your-db.turso.io" turso_auth_token = "eyJ…"
GET /api/agent_turso_sync?uuid= (also nested in agent_status.agent_turso_sync).
turso_configured: false and all_saved: true (local-only OK)GET /api/agent_turso_debug?uuid=.GET /api/agent_session/sess_9c1e…?since_id=0 X-API-Key: syte_… # then GET /api/agent_session/sess_9c1e…?since_id=42
{
"request_id": "req_8f2a",
"session_id": "sess_9c1e…",
"project_id": "my-site",
"session_number": 3,
"source": "sycord",
"model_profile": "syra-nano",
"request": "Build a pricing page",
"status": "running",
"started_at": "2026-07-25T21:00:00Z"
}
{
"task_id": "sub_3",
"session_id": "sess_9c1e…",
"project_id": "my-site",
"parent_request_id": "req_8f2a",
"task": "Implement PricingCard",
"mode": "build",
"profile": "syra-nano",
"files": ["app/components/PricingCard.tsx"],
"status": "running"
}
{
"request_id": "req_8f2a",
"status": "completed",
"reply": "Done — pricing section is live.",
"activity_count": 28,
"subagent_count": 1,
"input_tokens": 8200,
"output_tokens": 3100,
"total_tokens": 12400,
"cost_usd": 0.042,
"ended_at": "2026-07-25T21:01:21Z"
}