Agent Integration
This page is the compact contract a coding agent should follow when adding Keel to an application. It does not require access to Keel’s private architecture.
Integration algorithm
- Inventory consequential actions. Find every path that can spend money, send data, mutate external state, call tools, execute code, or use privileged credentials. Inventory direct SDK calls, raw HTTP, queues, retries, fallbacks, background workers, and tool callbacks—not only the main request handler.
- Choose an enforcement boundary. Prefer a supported Keel-managed route when Keel should own dispatch. Use permit-first only when a trusted component in the application will enforce the decision before the downstream call.
- Keep credentials human-owned. Ask the operator to create and place Keel and provider credentials through an approved secrets path. Never request, print, commit, or persist a raw credential in generated code or chat.
- Use the documented request shape. Validate requests against the generated schema and route reference. Supply a client-controlled idempotency key on retryable operations.
- Require positive authority. A negative safeguard or unmatched rule is not authorization. For consequential public Permit admission, the exact action must be covered by applicable positive policy authority. An unmatched evaluator result alone is not authority to dispatch.
- Branch on the public decision vocabulary. Only
allowauthorizes the exact action.deny,review, andthrottleare blocking outcomes. Apply all returned constraints before dispatch. - Fail safely. On authentication, validation, timeout, unavailable-service, unknown-decision, or malformed-response failures, do not send the governed downstream request. A fallback that calls the provider directly is a bypass.
- Preserve evidence identifiers. Record the Keel request ID and Permit UUID without logging secrets or sensitive payloads. Use documented receipt, proof-pack, or export verification for the evidence level required.
- Test both outcomes. Prove that an allowed test request reaches the intended downstream system and that a denied request produces no downstream effect. Use a provider-side or target-side oracle for the latter; a Keel decision record alone does not prove absence of execution.
- Re-scan for bypasses. Search for direct provider clients, alternate credentials, retry fallbacks, async workers, and ungoverned tool paths after the integration is complete.
Decision handling
const permit = await createPermit(request)
switch (permit.decision) {
case 'allow':
return dispatchWithConstraints(permit.constraints)
case 'throttle':
return retryLater(permit)
case 'deny':
case 'review':
return holdWithoutDispatch(permit)
default:
return failClosed('unknown Keel decision')
}For Keel-managed SDK wrappers, a non-allow result is normally surfaced before provider dispatch. Use the SDK’s supported governance metadata helper rather than assuming the provider response object exposes raw HTTP headers.
Enforcement boundaries
| Pattern | Who dispatches | Required safety rule |
|---|---|---|
Managed execution (/v1/executions, supported /v1/execute, proxy, enrolled MCP :call) | Keel | Do not add a direct-provider fallback around the managed route. |
Permit-first (/v1/permits) | Your trusted component | Dispatch only on allow, honor constraints, and bind the decision to the exact request. |
| MCP decide/prepare | Your trusted component | Enforce the returned decision and exact prepared request before calling the MCP server. |
| Observed evidence routes | Your application or provider | Do not describe observation as enforcement. |
Always confirm the exact action in Surface Maturity and the Capability Matrix. A route being mounted does not establish that every nested provider tool or operation is governed.
Evidence and verification boundary
Signature and hash verification can establish supported integrity, authenticity, binding, and lineage properties under the selected trust root. It does not by itself prove that every relevant event was captured, that policy was correct, or that an external side effect occurred—or did not occur. Use Verifying Evidence and keep downstream-effect tests separate from Keel evidence validation.
Completion checklist
- Every consequential path is either governed or explicitly documented as out of scope.
- Unknown decisions and Keel unavailability block the downstream action.
- Only
allowopens the exact authorized action. - Constraints are enforced at the final trusted dispatch boundary.
- A denied integration test shows no downstream effect using independent target-side evidence.
- Permit and request IDs are retained; secrets and raw sensitive payloads are not logged.
- The selected route and action are marked public-claim-eligible at the needed maturity level.