Runtime API
These endpoints expose or mutate daemon-wide runtime state. They are operational controls, not per-run settings.Endpoint inventory
Inspection:GET /v1/capabilitiesGET /v1/runtimeGET /v1/runtime/learning-policyGET /v1/runtime/secretsGET /v1/runtime/secrets/{secret_ref}GET /v1/runtime/auth/accountsGET /v1/runtime/auth/accounts/{slot_id}GET /v1/runtime/auth/subjects/{subject_id}GET /v1/runtime/auth/leases/{lease_id}GET /v1/runtime/connectorsGET /v1/runtime/connectors/{kind}/{name}GET /v1/runtime/hooksGET /v1/skillsGET /v1/skills/{skill_name}
POST /v1/runtime/modelPOST /v1/runtime/learning-policyPOST /v1/runtime/secretsPOST /v1/runtime/auth/accountsPOST /v1/runtime/auth/accounts/mcp-oauthPOST /v1/runtime/auth/accounts/{slot_id}/refreshPOST /v1/runtime/auth/accounts/{slot_id}/revokePOST /v1/runtime/auth/subjects/{subject_id}/revokePOST /v1/runtime/auth/leases/{lease_id}/revokeDELETE /v1/runtime/auth/accounts/{slot_id}DELETE /v1/runtime/secrets/{secret_ref}POST /v1/runtime/permission-modePOST /v1/runtime/system-promptPOST /v1/runtime/hooksPOST /v1/runtime/debug-levelPUT /v1/runtime/connectors/{kind}/{name}DELETE /v1/runtime/connectors/{kind}/{name}
GET /v1/events/stream
GET /v1/capabilities
This is the coarse daemon feature advertisement.
Current fields include:
control_plane_versionapprovalssidechainsmailboxessession_eventsrestart_restorelive_events
GET /v1/runtime
This is the main operator snapshot for a live daemon.
Important fields:
default_route: the daemon-wide fallback route when no session or run override appliesroute_id: the active default route identifierproviderandmodel: compatibility fields derived from the active default routeroutes: the full daemon route inventorylearning_policypermission_modesystem_prompthooksdebug_levelmcpskills
route_id, auth_ref, and coarse capability flags such as multimodal input, native web search, image generation, and image editing.
These route flags are intentionally coarse. Audio generation is currently surfaced through control-tool availability rather than one dedicated route capability field.
MCP snapshot
When MCP is enabled,mcp includes:
config_path: Codex-compatible MCP config path when one was loaded.selected_profiles: built-in MCP catalog profiles selected through--mcp-profileorKHEISH_MCP_PROFILES.servers: per-server snapshots.tool_names: daemon-global MCP helper and qualified MCP tool names before session/persona filtering.
serversource:codex_configorbuilt_in_catalogprofiles: built-in profile names that selected the server when it came from the catalogcatalog_entry_id: built-in catalog entry id when applicabletransportuses_credentialscredential_secret_refs: daemon auth-store refs used by the server, without secret valuesconnectedtoolserrorinstructions
Learning automation policy
GET /v1/runtime/learning-policy returns the daemon-owned LearningAutomationPolicyConfig.
POST /v1/runtime/learning-policy replaces the full learning automation policy.
Current top-level fields:
modecapturepublicationjudge
manual_onlyshadowenabled
modedefaults toshadowcapture.run_summary_candidatesdefaults totruecapture.semantic_candidates.enableddefaults tofalsecapture.semantic_candidates.max_candidates_per_rundefaults to2publication.default_actiondefaults tomanual_reviewpublication.allow_api_origin_active_publicationdefaults tofalsejudge.enableddefaults tofalse
Evidence note
- Code verified:
crates/kheish-mcp/src/manager.rs,crates/kheish-daemon/src/state.rs,crates/kheish-daemon/src/api/types.rs,crates/kheish-daemon/src/api/handlers.rs,crates/kheish-auth/src/types.rs,crates/kheish-auth/src/backends/mcp_oauth.rs. - CLI verified:
runtime get,runtime auth accounts list/get/refresh/revoke, andmcp oauth status/login/refresh/logout. - Daemon live tested: yes, using a fresh daemon with
--mcp-profile docsand the generic MCP OAuth true-binary protocol harness. - Provider-specific tested: no provider-specific model behavior is required for this control-plane snapshot.
POST /v1/runtime/learning-policyreplaces the full policy- send
modeexplicitly when mutating policy, because omitting that field is not the same thing as applying the effective runtime default
run_summary_candidatessemantic_candidates
semantic_candidates currently contains:
enabledmodeltimeout_msmax_candidates_per_run
timeout_msmust be greater than zero when providedmax_candidates_per_runmust be between1and8
default_actionallow_api_origin_active_publicationquarantined_rule_namesrules
namescope_kindscope_idkindsensitivitymin_confidencerequire_evidencerequire_source_runrequire_source_sessionactionexpires_after_ms
manual_reviewrejectpublish_provisionalpublish_active
publication.default_actioncannot bepublish_active- a
publish_activerule must declare an explicitkind publish_activeis not supported forprocedurelearningsquarantined_rule_namesmust be non-empty and unique
require_evidence,require_source_run, andrequire_source_sessiononly count as trusted rule inputs for daemon-owned candidates- this trusted-input rule only affects rule matching; API-created candidates can still auto-publish when another rule matches, but automatic
activepublication is still subject toallow_api_origin_active_publicationand daemon-owned verification
active rule:
- API-origin candidates are downgraded from automatic
publish_activetopublish_provisionalunlessallow_api_origin_active_publication=true publish_activestill requires daemon-owned verification before prompt visibility
enabledmodeltimeout_ms
manual_review in enabled mode when execution fails.
Example:
Change the default route
POST /v1/runtime/model changes the daemon default route. It does not rewrite session route policies, queued runs, active runs, or already suspended runs.
Request body:
provider: optional route identifier such asopenai,anthropic, oropenroutermodel: required backend model string
- On a named-route daemon,
provideris the daemon route id. - The concrete model stays in
model.
- request
providerselects a configured route id - secret-slot
providernames the underlying auth/backend family
Secret slots
The runtime secret surface stores daemon-managed auth material. Read endpoints returnAuthSlotStatus, not raw secret values.
AuthSlotStatus fields:
slot_idprovidermodesummaryupdated_at_msdetails: backend-specific redacted metadata, such as expiry, source, issuer, resource, scopes, or last refresh outcome
POST /v1/runtime/secrets
This endpoint accepts a full AuthSlotRecord:
slot_idprovidermodestateupdated_at_ms
Generic opaque secret example
Useful for connector secret references and MCP token slots such asmcp.linear.LINEAR_API_KEY.
KHEISH_AUTH_STORE_MASTER_KEY or KHEISH_AUTH_STORE_MASTER_KEY_FILE. MCP and connector token slots should use provider: "generic" with mode: "opaque_secret" unless you are writing a provider route key such as OpenAI or Anthropic.
For MCP, a stored secret is useful only when a loaded built-in catalog entry or explicit MCP config references that mcp.* slot. Built-in catalog slots can be inspected with mcp auth slots <entry-id>, and explicit MCP config can reference slots through bearer_token_secret_ref, http_header_secret_refs, or env_secret_refs.
MCP inventory is loaded at daemon startup. After writing or rotating a secret used by an MCP server, restart the daemon so that server reconnects with the new value.
OpenAI API key example
- Anthropic:
{"kind":"api_key","api_key":"..."} - Google:
{"kind":"api_key","api_key":"..."} - OpenRouter:
{"kind":"api_key","api_key":"..."} - xAI:
{"kind":"api_key","api_key":"..."}
state is backend-specific and more verbose than simple API-key records.
OAuth account endpoints
These endpoints expose redacted account status and write-only MCP OAuth import. They never return tokens.GET /v1/runtime/auth/accounts: lists only slots wheremodeisoauth_account.GET /v1/runtime/auth/accounts/{slot_id}: returns one OAuth account status and rejects non-OAuth slots.POST /v1/runtime/auth/accounts/{slot_id}/refresh: forces one backend refresh and returns redacted status. The endpoint rejects non-OAuth slots.POST /v1/runtime/auth/accounts/{slot_id}/revokeandDELETE /v1/runtime/auth/accounts/{slot_id}: delete the local OAuth account after normal dependency checks.POST /v1/runtime/auth/accounts/mcp-oauth: stores one completed MCP OAuth authorization-code login. This is the endpoint used bykheish-daemon mcp oauth login.POST /v1/runtime/auth/accounts: compatibility alias for the same MCP OAuth import body. Prefer/v1/runtime/auth/accounts/mcp-oauthin new clients.
- slot ids must use the
mcp.namespace - resource, issuer, authorization endpoint, and token endpoint must use
https, except loopbackhttptest URLs - empty core fields are rejected
- refresh responses cannot add scopes that were not already approved
DELETE /v1/runtime/secrets/{secret_ref}returns{"accepted": true}when the slot was removed.- Deletion returns
409 Conflictwhen a runtime connector or loaded MCP server still references that slot.
Brokered runtime auth
Kheish exposes operator-facing inspection for the broker that resolves auth-backed route and connector access at execution time.Subject endpoints
GET /v1/runtime/auth/subjects/{subject_id}POST /v1/runtime/auth/subjects/{subject_id}/revoke
AuthSubjectStatus fields:
subject_idcurrent_epochrevokedactive_connector_lease_idsactive_route_lease_idsactive_mcp_lease_ids
session:{session_id}agent:{agent_id}connector:{connector_name}daemon
Lease endpoints
GET /v1/runtime/auth/leases/{lease_id}POST /v1/runtime/auth/leases/{lease_id}/revoke
CredentialLeaseStatus fields:
leaserevokedactive
lease payload includes:
idgrant_idsubject_idsubject_epochaudienceissued_at_msexpires_at_ms
{"type":"route","route_id":"openai","slot_id":"openai.prod"}{"type":"connector","connector":"slack-prod","env_keys":["BOT_TOKEN"]}{"type":"mcp_server","server":"acme","slot_id":"mcp.oauth.acme","scopes_hash":"..."}
Permission mode
POST /v1/runtime/permission-mode replaces the daemon-wide permission mode.
Request body:
defaultacceptEditsbypassPermissionsplandontAsk
System prompt settings
POST /v1/runtime/system-prompt replaces the current SystemPromptSettings.
Fields:
override_promptcustom_promptappend_promptlanguageoutput_style
Hooks
GET /v1/runtime/hooks returns the current HookSettings.
POST /v1/runtime/hooks replaces the full hook map.
Minimal example:
Debug capture
POST /v1/runtime/debug-level replaces the daemon-wide debug capture level.
Example:
offonredactedfull
full is daemon-global and should only be enabled on isolated instances.
Runtime connectors
Detailed connector payloads and ingress behavior are documented in Connectors API. The important runtime behavior is:GET /v1/runtime/connectorsreturns the full connector inventoryGET /v1/runtime/connectors/{kind}/{name}returns one projected connector viewPUT /v1/runtime/connectors/{kind}/{name}creates or updates one daemon-managed connectorDELETE /v1/runtime/connectors/{kind}/{name}removes one daemon-managed connector after dependency checks
telegramslackhttp
- The connector
PUTsurface behaves like a field-aware upsert. - Fields present in the JSON payload are applied.
- Fields omitted from the payload keep their current stored value.
PUT here is not a blind full-record replacement.
Daemon-wide event stream
GET /v1/events/stream exposes the daemon-wide SSE stream used by control-plane observers.
tracesession_state_changedsession_snapshotoutputrun_updatedinterruptedruntime_updated
GET /v1/runtime.