Skip to main content
Version: main 🚧

CAIPE UI API Reference

The CAIPE UI API is a Next.js App Router backend-for-frontend (BFF). It serves the browser, enforces UI-facing auth and authorization, persists configuration in MongoDB, and proxies selected requests to the supervisor, Dynamic Agents runtime, and RAG server.

This page is based on the current route files under ui/src/app/api.

Base URLs

EnvironmentBase URL
Local UIhttp://localhost:3000
Production UIhttps://<your-caipe-ui-host>

The BFF also calls these backend services when the corresponding features are enabled:

ServiceConfigurationDefault
Dynamic Agents runtimeDYNAMIC_AGENTS_URLhttp://localhost:8100
Legacy supervisor SSE streamSUPERVISOR_SSE_URLhttp://localhost:8000/chat/stream
RAG serverRAG_SERVER_URL or NEXT_PUBLIC_RAG_URLhttp://localhost:9446
MongoDBMONGODB_URI and related UI configRequired for saved chats, agents, skills, workflows, teams, settings, and admin data

Authentication

Most BFF routes require one of these authentication paths:

Auth pathUsed byNotes
NextAuth session cookieBrowser and regular UI callswithAuth requires a session when SSO is enabled. When SSO is disabled, selected routes can fall back to anonymous@local.
Bearer tokenProgrammatic chat, workflow run, and skills callsRoutes that use dual auth accept Authorization: Bearer <token> before falling back to the NextAuth session.
Catalog API keyRead-only skills catalog accessSend X-Caipe-Catalog-Key for catalog API calls that support supervisor-minted keys.
Session access token forwarded to RAG/api/rag/*The BFF reads the NextAuth accessToken and forwards it to the RAG server as Authorization: Bearer <token>.

Admin endpoints require session.role === "admin" unless the route explicitly supports admin-view access. In local no-SSO mode, ALLOW_ANONYMOUS_ADMIN=true promotes the anonymous fallback user to admin.

Response Shapes

Many MongoDB-backed routes use the shared response helpers:

{
"success": true,
"data": {}
}

Paginated responses use:

{
"success": true,
"data": {
"items": [],
"total": 0,
"page": 1,
"page_size": 20,
"has_more": false
}
}

Errors from shared middleware use:

{
"success": false,
"error": "Human readable message",
"code": "OPTIONAL_CODE"
}

Proxy routes can return the backend service's native response shape instead of the wrapper above. There is no generated /api/openapi.json route for the UI BFF today; use this page and the route files as the source of truth. FastAPI services such as RAG and Dynamic Agents expose their own OpenAPI documents on their backend ports.

Health, Config, and Version

MethodRoutePurposeAuth
GET/api/healthUI process health check. Returns {status, service, timestamp}.Public
GET/api/versionBuild metadata from public/version.json plus package.json version when available.Public
GET/api/configClient-visible UI configuration.Public
GET/api/changelogUI changelog data.Public
GET/api/auth/roleCurrent user's role and admin visibility state.Session
GET/api/user/infoProxy to RAG /v1/user/info; forwards session access and ID tokens when present.Session optional

Chat and Runtime Proxies

The current Dynamic Agents chat API lives under /api/v1/chat/*. These routes authenticate the caller, validate required fields, and transparently proxy to the Dynamic Agents backend at the same path.

MethodRouteBackendRequestResponse
POST/api/v1/chat/stream/startDYNAMIC_AGENTS_URL/api/v1/chat/stream/startmessage, conversation_id, agent_id, optional protocol, trace_id, client_contextServer-Sent Events
POST/api/v1/chat/stream/resumeDYNAMIC_AGENTS_URL/api/v1/chat/stream/resumeconversation_id, agent_id, resume_data, optional protocol, trace_idServer-Sent Events
POST/api/v1/chat/stream/cancelDYNAMIC_AGENTS_URL/api/v1/chat/stream/cancelconversation_id, agent_idJSON cancellation result
POST/api/v1/chat/invokeDYNAMIC_AGENTS_URL/api/v1/chat/invokemessage, conversation_id, agent_id, optional trace_id, client_contextJSON agent result
POST/api/chat/streamSUPERVISOR_SSE_URLLegacy supervisor AG-UI payloadServer-Sent Events

Example streaming request:

curl -N -X POST http://localhost:3000/api/v1/chat/stream/start \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"message": "Check the status of production ArgoCD apps",
"conversation_id": "conv-123",
"agent_id": "agent-platform-engineer"
}'

The BFF preserves the backend SSE stream and returns:

Content-Type: text/event-stream
Cache-Control: no-cache, no-transform
Connection: keep-alive

Chat History

Chat history is stored in MongoDB and scoped to the current user.

MethodRoutePurpose
GET, POST/api/chat/conversationsList or create conversations.
GET, PUT, DELETE/api/chat/conversations/:idRead, rename/update, or delete a conversation.
GET, POST/api/chat/conversations/:id/messagesList or append messages.
GET, POST/api/chat/conversations/:id/turnsRead or append structured chat turns.
PATCH/api/chat/conversations/:id/metadataUpdate conversation metadata.
POST/api/chat/conversations/:id/archiveMove a conversation to archive/trash.
POST/api/chat/conversations/:id/restoreRestore an archived conversation.
POST/api/chat/conversations/:id/pinPin or unpin a conversation.
GET, POST, PATCH/api/chat/conversations/:id/shareManage shared conversation links.
GET/api/chat/conversations/trashList archived or trashed conversations.
PUT/api/chat/messages/:idUpdate a message.
GET/api/chat/searchSearch conversation history.
GET/api/chat/sharedResolve shared conversation data.
GET, POST/api/chat/bookmarksList or create bookmarks.

Dynamic Agent Configuration

Dynamic agent configuration is stored in MongoDB. The BFF owns config writes; the Dynamic Agents backend is treated as a runtime reader.

MethodRoutePurposeAuth
GET/api/dynamic-agentsList agents visible to the caller. Supports page, page_size, and enabled_only=true.Session
POST/api/dynamic-agentsCreate an agent. Generates _id as agent-<slugified-name>.Admin
PUT/api/dynamic-agents?id=<agent_id>Update allowed mutable fields. Config-driven agents are read-only.Admin
DELETE/api/dynamic-agents?id=<agent_id>Delete a non-system, non-config-driven agent.Admin
GET/api/dynamic-agents/agents/:idFetch one agent if the caller can access it.Session
GET/api/dynamic-agents/availableList enabled agents the caller can chat with.Session
GET/api/dynamic-agents/available-subagents?id=<agent_id>List valid subagents, excluding self and cyclic references.Admin
GET/api/dynamic-agents/builtin-toolsList built-in tool definitions.Session
GET/api/dynamic-agents/middlewareList middleware definitions.Session
GET/api/dynamic-agents/modelsList configured model options.Session
GET/api/dynamic-agents/teamsList teams available for sharing.Session
GET/api/dynamic-agents/healthProxy Dynamic Agents health.Session
POST/api/dynamic-agents/chat/restart-runtimeRestart or reload the runtime.Session

Create agent body:

{
"name": "Platform Engineer",
"description": "Helps operate platform services",
"system_prompt": "You are a platform engineering assistant.",
"model": {
"id": "claude-sonnet-4-20250514",
"provider": "anthropic-claude"
},
"visibility": "team",
"shared_with_teams": ["platform-team"],
"allowed_tools": {},
"builtin_tools": {
"fetch_url": {
"enabled": true,
"allowed_domains": "*.cisco.com"
},
"workflows": ["wf-123"]
},
"subagents": [
{
"agent_id": "agent-rag-helper",
"name": "rag_helper",
"description": "Searches internal knowledge bases"
}
],
"skills": [],
"enabled": true
}

Visibility rules for subagents:

Parent visibilityAllowed subagent visibility
privateprivate, team, global
teamteam, global
globalglobal only

MCP Server Configuration

MCP server definitions are stored in MongoDB and consumed by Dynamic Agents.

MethodRoutePurposeAuth
GET/api/mcp-serversList configured MCP servers. Supports page and page_size.Admin
POST/api/mcp-serversCreate an MCP server config. Adds mcp- prefix to the submitted id when missing.Admin
PUT/api/mcp-servers?id=<server_id>Update mutable fields on a non-config-driven server.Admin
DELETE/api/mcp-servers?id=<server_id>Delete a non-config-driven server.Admin
POST/api/mcp-servers/probeProbe a server and return discovered tools or an error.Session

Create body:

{
"id": "github",
"name": "GitHub MCP",
"transport": "sse",
"endpoint": "https://mcp.example.com/github/sse",
"enabled": true
}

For stdio transport, command is required. For sse and http, endpoint is required.

Workflow APIs

CAIPE has two workflow-related APIs:

APIStoragePurpose
/api/workflow-configs and /api/workflow-runsworkflow_configs, workflow_runsCurrent engine-backed multi-step workflows that run Dynamic Agents through AG-UI and expose run polling, events, cancellation, and resume.
/api/task-configstask_configsSelf-service task configuration consumed by the supervisor agent. This mirrors task_config.yaml and is separate from workflow-engine runs.

Workflow Configs

MethodRoutePurpose
GET/api/workflow-configsList configs visible to the caller. Admins see all configs.
GET/api/workflow-configs?id=<workflow_config_id>Fetch one visible config.
POST/api/workflow-configsCreate a config.
PUT/api/workflow-configs?id=<workflow_config_id>Update a non-config-driven config owned by the caller or any config when admin.
DELETE/api/workflow-configs?id=<workflow_config_id>Delete a non-config-driven config owned by the caller or any config when admin.

Create body:

{
"name": "Production release check",
"description": "Validate deployment and recent incidents before release",
"visibility": "team",
"shared_with_teams": ["platform-team"],
"steps": [
{
"type": "step",
"display_text": "Check ArgoCD applications",
"agent_id": "agent-argocd",
"prompt": "Check sync and health for production applications. User context: {{ user_context }}",
"on_error": "retry",
"retry": {
"max_attempts": 2
},
"config_override": null
}
]
}

Workflow config constraints:

FieldRule
nameRequired.
stepsRequired and non-empty. In v1 every entry must have type: "step"; parallel groups are rejected.
display_text, agent_id, promptRequired for every step.
on_errorabort, skip, or retry.
retry.max_attemptsRequired and at least 1 when on_error is retry.
visibilityprivate, team, or global. Team visibility requires shared_with_teams.

Workflow Runs

MethodRoutePurpose
POST/api/workflow-runsStart a workflow run and return immediately.
GET/api/workflow-runs?run_id=<run_id>Poll one run and include stream events keyed by step index.
GET/api/workflow-runs?workflow_config_id=<workflow_config_id>List recent runs for one workflow config.
GET/api/workflow-runsList recent runs visible to the caller.
PUT/api/workflow-runs?id=<run_id>Legacy-compatible run update.
DELETE/api/workflow-runs?id=<run_id>Delete a run and best-effort cleanup its files and events. Requires config owner or admin.
POST/api/workflow-runs/:id/resumeResume a run waiting for human input.
POST/api/workflow-runs/:id/cancelCancel a running workflow.

Start a run:

curl -X POST http://localhost:3000/api/workflow-runs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"workflow_config_id": "wf-123",
"user_context": "Release 2026.05.21 to production",
"trigger_info": {
"triggered_by": "webui",
"context": {
"source": "release-readiness"
}
}
}'

Response:

{
"run_id": "workflow-abc123",
"status": "running"
}

Poll a run:

curl "http://localhost:3000/api/workflow-runs?run_id=workflow-abc123" \
-H "Authorization: Bearer $ACCESS_TOKEN"

Run status values are pending, running, waiting_for_input, completed, failed, and cancelled. Step status values are pending, running, completed, failed, skipped, and waiting_for_input.

Resume a run that is waiting for input:

curl -X POST http://localhost:3000/api/workflow-runs/workflow-abc123/resume \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"step_index": 1,
"resume_data": "Approve the proposed restart window"
}'

Workflow runs are retained for WORKFLOW_RUN_RETENTION_DAYS, defaulting to 7. Set it to 0 to disable opportunistic cleanup.

Task Configs

MethodRoutePurpose
GET/api/task-configsList visible task configs.
GET/api/task-configs?id=<task_config_id>Fetch one task config.
GET/api/task-configs?format=yamlReturn configs in task_config.yaml compatible shape.
POST/api/task-configsCreate a user-owned task config.
PUT/api/task-configs?id=<task_config_id>Update a config if owned by the caller, or system config when admin.
DELETE/api/task-configs?id=<task_config_id>Delete a config if owned by the caller, or system config when admin.
GET, POST/api/task-configs/seedSeed task configs.

Task config steps require display_text, llm_prompt, and subagent. Visibility is private, team, or global.

RAG Proxy

The UI exposes a catch-all RAG proxy:

MethodRouteBackend
GET, POST, PUT, DELETE/api/rag/*pathRAG_SERVER_URL/<path>

Examples:

curl http://localhost:3000/api/rag/healthz

curl http://localhost:3000/api/rag/v1/user/info

curl -X POST http://localhost:3000/api/rag/v1/mcp/invoke \
-H "Content-Type: application/json" \
-d '{
"tool_name": "search",
"arguments": {
"query": "How do I troubleshoot failed ArgoCD syncs?",
"limit": 5,
"thought": "Find relevant runbook material"
}
}'

The proxy forwards query parameters for GET and DELETE, JSON bodies for POST and PUT, and the current session's access token when available. For direct RAG endpoints, roles, ingestion APIs, graph APIs, and MCP tool management, see RAG API Reference.

Skills and Catalog APIs

Skills APIs support the Skills Gateway, local skill configuration, catalog imports, scan history, and installation helpers.

MethodRoutePurpose
GET/api/skillsList skills visible to the caller or catalog key.
POST/api/skills/refreshRefresh skills from configured sources.
POST/api/skills/scan-allScan all configured skills.
GET/api/skills/scan-historyList scan history.
GET/api/skills/supervisor-statusCheck supervisor skill status.
POST/api/skills/tokenMint or return a skills token.
GET, POST/api/skills/seedSeed skills data.
GET/api/skills/live-skillsServe live skills helper content.
GET/api/skills/install.shServe install script.
GET/api/skills/hooks/caipe-catalog.shServe catalog hook script.
GET/api/skills/helpers/caipe-skills.pyServe helper script.
POST/api/skills/importImport skill content.
POST/api/skills/import-githubImport from GitHub.
POST/api/skills/templates/importImport a template.
POST/api/skills/generateGenerate skill content.
POST, GET, PUT, DELETE/api/skills/configsManage local skill configs.
GET, PUT, DELETE/api/skills/configs/:id/filesManage config files.
POST/api/skills/configs/:id/scanScan a config.
POST/api/skills/configs/:id/cloneClone a config.
GET/api/skills/configs/:id/exportExport a config.
GET/api/skills/configs/:id/revisionsList revisions.
GET/api/skills/configs/:id/revisions/:revisionIdFetch one revision.
POST/api/skills/configs/:id/revisions/:revisionId/restoreRestore a revision.
GET, POST/api/catalog-api-keysList and mint catalog API keys.
DELETE/api/catalog-api-keys/:keyIdRevoke a catalog API key.
GET, POST/api/skill-hubsList and create skill hubs.
PATCH, DELETE/api/skill-hubs/:idUpdate or delete a hub.
POST/api/skill-hubs/:id/refreshRefresh a hub.
POST/api/skill-hubs/crawlCrawl a hub.
GET/api/skills/hub/:hubId/:skillId/filesList hub skill files.
GET/api/skills/hub/:hubId/:skillId/files/contentFetch hub skill file content.
POST/api/skills/hub/:hubId/:skillId/scanScan a hub skill.
GET/api/skill-templatesList skill templates.
POST/api/skill-templates/:id/scanScan a template.

Settings, Policies, Reviews, Feedback, and Users

MethodRoutePurpose
GET, PUT/api/settingsRead or update user settings.
PATCH/api/settings/defaultsUpdate default settings.
PATCH/api/settings/notificationsUpdate notification preferences.
PATCH/api/settings/preferencesUpdate user preferences.
GET, PUT, POST/api/policiesRead, update, or create policy data.
GET/api/policies/seedSeed policy data.
GET/api/review-configsList AI review configurations.
GET, PUT/api/review-configs/:idFetch or update a review config.
POST/api/ai/assistAI-assisted content helper.
POST/api/ai/reviewAI review helper.
GET, POST/api/feedbackSubmit or list feedback.
GET/api/users/meFetch current user profile.
PUT/api/users/meUpdate current user profile.
GET, PUT/api/users/me/favoritesManage favorites.
GET/api/users/me/insightsCurrent user insights.
GET/api/users/me/insights/skillsCurrent user's skills insights.
GET/api/users/me/statsCurrent user stats.
GET/api/users/searchSearch users.
GET/api/users/debugUser debugging data.
GET, POST/api/llm-modelsList or create LLM model entries.
PUT, DELETE/api/llm-modelsUpdate or delete LLM model entries by query ID.
GET, POST/api/nps/active, /api/npsRead active NPS campaign and submit NPS feedback.

Admin APIs

Admin APIs require admin role unless the implementation explicitly uses admin-view access.

MethodRoutePurpose
GET/api/admin/usersList users.
GET/api/admin/users/:emailFetch one user.
PATCH/api/admin/users/:email/roleUpdate user role.
GET, POST/api/admin/teamsList or create teams.
GET, PATCH, DELETE/api/admin/teams/:idManage one team.
POST, DELETE/api/admin/teams/:id/membersAdd or remove team members.
GET/api/admin/audit-logsList audit logs.
GET/api/admin/audit-logs/exportExport audit logs.
GET/api/admin/audit-logs/ownersList audit-log owners.
GET/api/admin/audit-logs/:id/messagesRead audit log messages.
DELETE/api/admin/audit-logs/:idDelete an audit log.
GET/api/admin/feedbackReview submitted feedback.
GET, POST/api/admin/metricsRead or write admin metrics.
GET/api/admin/statsAdmin stats overview.
GET/api/admin/stats/checkpointsCheckpoint stats.
GET/api/admin/stats/skillsSkills stats.
GET/api/admin/npsNPS admin overview.
POST, GET, PATCH/api/admin/nps/campaignsManage NPS campaigns.
GET, PATCH/api/admin/platform-configRead or update platform config.
POST/api/admin/migrate-conversationsRun conversation migration.
POST, DELETE/api/admin/skills/:source/:source_id/scan-overrideManage skill scan overrides.
POST, DELETE/api/admin/skills/hub/:hubId/:skillId/scan-overrideManage hub skill scan overrides.

Files and Utilities

MethodRoutePurpose
GET/api/files/listList files from the Dynamic Agents file API.
GET, PUT, DELETE/api/files/contentRead, write, or delete file content.
GET/api/agents/toolsList agent tool metadata.

Backend Dynamic Agents REST Surface

The BFF proxies a subset of the Dynamic Agents FastAPI service. Direct backend endpoints are available when you call the runtime itself:

MethodBackend routePurpose
GET/healthzLiveness.
GET/readyzReadiness.
GET/debug/configRuntime config diagnostics.
GET/debug/runtimesRuntime state diagnostics.
POST/api/v1/chat/stream/startStart streaming chat.
POST/api/v1/chat/stream/resumeResume interrupted streaming chat.
POST/api/v1/chat/stream/cancelCancel an active stream.
POST/api/v1/chat/invokeNon-streaming invocation.
POST/api/v1/chat/restart-runtimeRestart runtime.
GET/api/v1/conversations/:conversation_id/interrupt-stateRead interrupt state.
POST/api/v1/conversations/:conversation_id/metadataEnsure conversation metadata.
POST/api/v1/conversations/:conversation_id/clearClear conversation checkpoints.
GET/api/v1/files/listList runtime files.
GET, PUT, DELETE/api/v1/files/contentManage runtime file content.
DELETE/api/v1/files/namespaceDelete a runtime file namespace.
GET/api/v1/builtin-toolsList built-in tools.
POST/api/v1/mcp-servers/:server_id/probeProbe an MCP server.
GET/api/v1/middlewareList middleware registry entries.
POST/api/v1/assistant/suggestAssistant suggestions.