Use the Agentware SDK to add Kei governance to a custom agent harness. Agentware provides the middleware, audit, guardrails, and Kei policy integration; Kei is the metadata-only control plane that holds registration, policy, and audit metadata. Provider payloads, customer content, and credentials never enter Kei.
For a first look at what agentware does, see Govern an agent with agentware.
Six harness types#
Kei has six user-facing harness types. The SDK (Agentware) type covers harnesses built on the Agentware SDK:
| Harness type | Integration path |
|---|---|
| SDK (Agentware) | KeiProxyEvaluator → kei-proxy authorize, fail closed. Covers pydantic-ai, Gemini SDK, AWS AgentCore, and bespoke loops. API kind custom. |
| Claude Code | Native permission files + hook. |
| Codex | Native permission files + hook. |
| OpenCode | Native permission files + hook. |
| Pi | Own package + local-socket adapter. |
| Open WebUI | Own Python library (openwebui-kei), not the SDK path. |
Six-step path#
Bring up an Agentware SDK harness in this order:
- Install the Kei CLI and sign in —
curl -fsSL https://haikeilabs.com/install.sh | sh, thenkei login. You need an organization owner or admin to approve the device authorization flow. - Create a runtime installation —
kei bot initcreates pending installation metadata and provisions a runtime credential. The credential is shown once; deliver it directly into your approved secret manager. - Register the harness —
kei harness add --kind custom --installation INSTALLATION_IDregisters the SDK harness. The CLI resolves the assigned agent for that installation. - Register tools — Use
ToolSpecwith aharness_executorroute over the runtime socket (POST /v1/tools:register), or maintain atools.jsonmanifest and sync it withkei harness sync --harness custom --manifest tools.json. The manifest is tool metadata, not a permission grant. - Start the runtime daemon —
kei-proxy serveruns the policy enforcement point on a local Unix socket. The SDK discovers it throughKEI_RUNTIME_SOCKET_PATH. - Run the harness — Each governed tool call goes through
kei-proxy authorize. An explicit allow lets the tool run; a deny returnsreason_codeandhint; a socket or protocol failure fails closed.
Compatible versions#
| agentware SDK | kei-proxy (minimum) | kei-cli (minimum) |
|---|---|---|
| 0.11.0 | v0.3.0 | 0.2.0 |
Language guides#
Next steps#
- Runtime setup — connect a harness to a local
kei-proxydaemon. - Policy and audit — create policies and view audit entries.
- Deny reason codes — reference for every
reason_codeand itshint.
For the complete API reference, see the Agentware SDK repository.