Architecture
APF governs what agents may do in two ways. It projects signed policy into the runtime’s own controls, so a sandbox is built from policy the enterprise approved, and it decides each governed request the runtime hands it, so a call that the sandbox allows can still be denied or edited for what it carries.
- Signed policy, projected. A bundle is authored, reviewed, and signed outside APF. The policy service verifies it and compiles it into the form each enforcement point consumes. The runtime applies that projection when it creates a sandbox, and refuses edits that bypass it.
- Decisions on request. The policy gateway evaluates each governed request against the same signed policy, with facts from registered providers when it needs them, and returns allow or deny with any edits. The runtime carries the decision out.
Policy flows one way. The policy service reads a signed bundle from a registry, verifies it, and serves projections. The policy gateway fetches those projections and hosts the adapters that face the runtime: an OpenShell interceptor that hands OpenShell its sandbox policy at admission, and an OpenShell middleware that returns a decision for each request OpenShell routes to it. OpenShell builds the sandbox and enforces. Every APF component writes audit events, joined by a correlation ID and the digest of the bundle that decided.
Components
In the standard policy vocabulary, the policy service is the administration point, the policy gateway is the decision point, providers are information points, and the runtime is the enforcement point. Refer to the Glossary. Each role is held by a different party, so no component can both write policy and enforce it.
The repository is a Rust workspace. The two services, apf-policy-service and apf-policy-gateway, are the only long-running processes; the OpenShell adapters are libraries linked into them, with the projector in the policy service and the OpenShell interceptor, OpenShell middleware, and caller authentication in the gateway. OpenShell-specific code lives in the apf-openshell-* crates, so a second enforcement point adds its own adapters without changing the shared libraries. Refer to APF Adapter. Tool invocation and credential handling are outside APF.
Trust Boundary
The signing authority, the policy service, the policy gateway, and the runtime each hold one job, and the boundaries between them are what the design protects. Authority sits with whoever holds the signing key. The services that read and enforce a bundle cannot change it, and the runtime that applies a decision cannot make one.
How a Request Travels
- At creation, OpenShell asks the OpenShell interceptor for the sandbox’s policy. The interceptor fetches the projection, injects it, and stamps provenance. A later validate step checks the stamp before OpenShell admits the sandbox.
- OpenShell enforces its own layer first: reachable destinations, permitted tools and methods, from the projection. A request that fails here never reaches APF.
- If the request is routed to APF, OpenShell sends it to the OpenShell middleware before adding credentials, so APF evaluates a credential-free request.
- The decision layer looks up facts from registered providers, runs annotators, evaluates the Cedar rules, and applies effects.
- The OpenShell middleware returns allow or deny with any edits. OpenShell rejects the request or applies the edits and forwards it. Both sides write an audit record.
Refer to The Governed Path for each layer in detail.
Evaluation Pipeline
Up to four stages run on each governed request. If providers are registered, Enrichment looks up their facts first and exposes them to rules as context.<domain>. Annotators then inspect the request and set named signals, Cedar rules decide from those signals and facts together with the request’s subject, tool, arguments, and target, and effects apply the edits and findings an allowing rule names. An evaluation error is a deny. Refer to Request Evaluation.
Control Plane and Data Plane
APF’s control plane distributes policy. Its data plane decides requests.
Both OpenShell seams sit on APF’s data plane. At admission APF serves a projection, and per request APF serves a decision. Neither seam distributes policy.
How Enforcement Points Attach
Every enforcement point follows the same contract: it receives APF’s policy in its own native form, it applies that policy itself, and it carries out each decision APF returns. It never decides on its own.
OpenShell owns the sandbox lifecycle, the network namespace, extension registration, trusted service CAs, credential injection, and authenticating itself to APF. APF owns which policy applies, whether a request is permitted, which edits apply, and the trust anchor it uses to authenticate OpenShell as a caller. Refer to OpenShell Integration.
How Components Authenticate
Each connection has its own credential, and the three trust anchors are separate: the trust roots that verify bundles, the document signing key that signs provenance tokens, and the OpenShell extension trust profile that authenticates OpenShell’s calls. None can stand in for another.
The gateway checks the trust profile, certificate, and key files before a listener reports ready, and refuses a listener with a partial set. For local research only, a listener can opt out of TLS and caller authentication with an explicit flag. Refer to Configure Service Authentication, Trust Boundaries, and Service APIs.
Working With Your Existing Infrastructure
APF does not prescribe the systems around it. Bring your own signing authority: the policy service accepts Ed25519 and ECDSA P-256 trust roots. Keep bundles where you keep other artifacts: a local file or any HTTPS source the service can poll. Register the systems of record you already run as providers, so rules read facts from them without code changes. Ship the audit files with your own log collector. A new runtime attaches through an adapter pair and leaves the policy model unchanged. Refer to External Policy Authorities, Policy Information Providers, Export Audit Events, and APF Adapter.
Next Steps
- To follow one action across both seams, refer to The Governed Path.
- To see how the services are deployed today, refer to Deployment Models.
- To review what each boundary protects, refer to Trust Boundaries.
- To check which capabilities are available today, refer to Support and Compatibility.