Chio/Docs
LOGIN · JOIN

BuildFoundations

Examples Overview

Find the Chio example that matches your integration, from a single hello example to a multi-organization workflow.

Choose your example

Pick the page that matches the question you're actually asking:

  • "I want to see one governed call with the smallest setup" go to Hello Tool (native Rust service, no protocol, no HTTP).
  • "I have an MCP server and want to govern it" go to Hello MCP (stdio JSON-RPC edge with a bridge call that prints the receipt id).
  • "I run Express, Fastify, or Elysia (Bun)" go to Node HTTP Frameworks.
  • "I run FastAPI or Django" go to Python HTTP Frameworks.
  • "I run Spring Boot or ASP.NET Core" go to JVM and .NET HTTP Frameworks.
  • "I run Go (chi, gorilla, net/http) or C++ (Drogon)" go to Go and C++ HTTP Frameworks.
  • "I want zero code change, just put a sidecar in front of an existing OpenAPI service" run examples/hello-openapi-sidecar upstream and read Protect an API.
  • "I want to verify a receipt offline, with no kernel running" run examples/hello-receipt-verify upstream.
  • "I want a multi-org topology with budgets, settlement, and disputes" run examples/agent-commerce-network upstream.

One contract, every stack

Nine of the examples are the same application written nine times: hello-fastapi, hello-django, hello-express, hello-fastify, hello-elysia, hello-chi, hello-spring-boot, hello-dotnet, and hello-drogon. Each serves GET /healthz, GET /hello, and POST /echo against the same EchoRequest schema, behind the same sidecar. Only the registration line changes.

examples/hello-fastapi/app.py:40-44examples/hello-express/server.mjs:41-48examples/hello-chi/main.go:34-39examples/hello-spring-boot/src/main/kotlin/example/hello/HelloSpringBootApplication.kt:13-26examples/hello-dotnet/HelloApp.cs:9-16examples/hello-drogon/src/hello_app.cpp:89-94
    if enable_chio:
        app.add_middleware(
            ChioASGIMiddleware,
            config=chio_config or build_chio_config(),
        )

Everything downstream of that line is shared, including the policy, and the way it is shared is worth being precise about. Eight of the nine ship a policy.yaml next to the app, in two byte sequences that differ by one trailing blank line; hello-chi ships none. Nothing reads any of them. chio api protect has no policy option of any kind, no runner or smoke passes one, and repo-wide those eight files appear only in their own READMEs' file listings. So all nine inherit the same sidecar default, and the file is there as a starting point to edit rather than as the thing in force:

examples/hello-express/policy.yamlyaml
kernel:
  max_capability_ttl: 3600

capabilities:
  default:
    tools:
      - server: "*"
        tool: "*"
        operations: [invoke]
        ttl: 900

What actually governs the nine is the sidecar's method default. Safe methods get a session-scoped allow and side-effect methods are denied until a capability arrives, which is why GET /hello passes and POST /echo does not, in every one of them, with no policy file present:

crates/protocol/chio-openapi/src/policy.rs29-35rust
pub fn for_method(method: HttpMethod) -> PolicyDecision {
    if method.is_safe() {
        PolicyDecision::SessionAllow
    } else {
        PolicyDecision::DenyByDefault
    }
}

The command that puts the kernel in front of the app is byte-identical in all nine smoke.sh scripts:

examples/hello-fastapi/smoke.sh:57-67bash
(
  export CHIO_TRUSTED_ISSUER_KEY="${TRUSTED_ISSUER_KEY}"
  exec "${CHIO_BIN}" \
    --control-url "${CONTROL_URL}" \
    --control-token "${SERVICE_TOKEN}" \
    api protect \
    --upstream "${APP_URL}" \
    --spec "${EXAMPLE_ROOT}/openapi.yaml" \
    --listen "127.0.0.1:${SIDECAR_PORT}" \
    --receipt-store "${RECEIPT_STORE}"
) >"${LOG_DIR}/sidecar.log" 2>&1 &

So the choice of language decides which page you read, not which features you get. Each of them refuses POST /echo without a capability, and the refusal belongs to the sidecar rather than to the application, so the receipt names the same guard, CapabilityGuard, and carries the same reason, side-effect route requires a capability token.

What does differ is the JSON envelope that reason arrives in, and it varies by SDK family rather than by language. The six that sit on a shared substrate ( hello-express, hello-fastify, hello-elysia, hello-chi, hello-spring-boot, hello-dotnet) return four keys, error, message, receipt_id, suggestion. The two Python middlewares each shape their own. That is eight of the nine. hello-drogon is the fourth shape: the C++ SDK builds the body by hand and emits error, message and, only when the receipt id is non-empty, receipt_id, with no suggestion key at all (sdks/cpp/chio-drogon/src/drogon.cpp:358-376).

deny.json, hello-express (the shared-substrate shape)json
{"error":"chio_access_denied","message":"side-effect route requires a capability token","receipt_id":"e653e2621575a9e38e030e8e13bc9c05803eb95db8c1ccdd15652b9df0ca4078","suggestion":"provide a valid capability token in the X-Chio-Capability header or chio_capability query parameter"}
deny.json, hello-fastapijson
{"error": "CapabilityGuard", "message": "side-effect route requires a capability token", "status": 403}
deny.json, hello-djangojson
{"error": {"code": "CHIO_GUARD_DENIED", "message": "side-effect route requires a capability token", "guard": "CapabilityGuard"}}

Read the deny body from the page for your stack, not from a sibling. The receipt behind it is one shape everywhere, and that is the thing an auditor reads.


How to read these pages

Example pages use the same four sections:

  1. Walkthrough. The shape of the example: what it builds, what it wires together, and the few lines of code or config that do the work.
  2. Success criteria. The exact assertions in smoke.sh that decide whether the run passed. Status codes, JSON fields, header values, exit codes.
  3. Inspect after.commands you run after the smoke passes to confirm state landed: cat .artifacts/.../bridge-call.json, chio receipt list, header extraction. Commands include expected output.
  4. Decision rule. A short callout that says when to use the example and which sibling to use instead.

Getting the source

The examples live in the upstream chio repo. Clone the repo, build the workspace once, then run any example from its directory.

bash
git clone https://github.com/bb-connor/arc.git
cd arc
cargo build --workspace
cd examples/hello-tool

What an example directory holds varies, so read its own run path from the matrix below rather than assuming. The long-lived service examples ship a runner (run.sh, run-edge.sh, or run-trust.sh) and a smoke script (smoke.sh), and the one-shot ones do not: hello-tool is a Cargo crate with a README, an ARCHITECTURE.md and src/ and nothing else, hello-receipt-verify has a smoke and no runner, and the two guard examples and bilateral-invocation are crates you build.

Run a single smoke

From examples/ the runner ./run-hello-smokes.sh --list prints its 14 targets, which are the ones it knows how to stand up end to end:

hello-openapi-sidecar, hello-trust-control, hello-receipt-verify, hello-fastapi, hello-fastify, hello-chi, hello-express, hello-django, hello-elysia, hello-spring-boot, hello-dotnet, hello-mcp, hello-a2a, hello-acp.

Pass names to run a subset: ./run-hello-smokes.sh hello-fastapi hello-fastify. Run with no arguments to execute the full set. Examples outside that list run from their own README instead.


Integration matrix

Every row below is read out of examples/EXAMPLE_SURFACE_MATRIX.md upstream, so the example name, its kind, and the surfaces it teaches are the matrix's own words rather than a copy of them. There are 33 examples in the matrix. 27 of them have a page in this section, 3 are written up elsewhere in these docs, and 3 have no page at all: read those upstream from the run path in their own directory.

ExampleKindChio surfaces taughtPage
agent-commerce-networkFlagshiptrust serve, api protect, MCP edge, evidence review, federation-style artifact flowAgent Commerce Network
cognition-market-pilotFlagshipfinding operator, verified-fix admission, Python buyer and seller SDKsRun a Cognition Market
internet-of-agents-incident-networkFlagshiprecursive delegation, OpenAI SDK orchestration, MCP internal tools, ACP external jobs, offline evidence reviewIncident Network
internet-of-agents-web3-networkFlagshiptrust serve, api protect, MCP HTTP edge, recursive delegation, RFQ routing, x402 requirements, web3 settlement dispatch, passports, reputation, federation, budgets, behavioral feed, guardrails, optional Base Sepolia evidenceWeb3 Network
hello-toolNative serviceNative Chio service builder, manifest signing, manifest pricingHello Tool
dockerQuickstart topologytrust serve, hosted MCP edge, receipt dashboardDocker quickstart, below
anthropic-sdkEcosystem clientHosted Chio session, tool mapping, trust receipt lookupLangChain and Provider SDKs
openai-compatibleEcosystem clientHosted Chio session, OpenAI-compatible function mapping, trust receipt lookupLangChain and Provider SDKs
langchainEcosystem clientPython Chio SDK, hosted HTTP edge, trust receipt lookupLangChain and Provider SDKs
hello-trust-controlControl-plane adjunctTrust capability issuance, status, revocation, chio check, chio evidence verifyTrust Control
hello-receipt-verifyControl-plane adjunctOffline evidence verification, receipt lineage inspection, tamper detectionReceipt Verification
hello-openapi-sidecarHTTP sidecarchio api protect with OpenAPI, sidecar receipts, capability-gated side effectsOpenAPI Sidecar
hello-fastapiHTTP frameworkchio-asgi, chio-fastapiPython HTTP
hello-djangoHTTP frameworkchio-djangoPython HTTP
hello-fastifyHTTP framework@chio-protocol/fastifyNode HTTP
hello-elysiaHTTP framework@chio-protocol/elysiaNode HTTP
hello-expressHTTP framework@chio-protocol/expressNode HTTP
hello-chiHTTP frameworkchio-go-httpGo and C++ HTTP
hello-spring-bootHTTP frameworkchio-spring-bootJVM and .NET HTTP
hello-dotnetHTTP frameworkChioMiddlewareJVM and .NET HTTP
hello-drogonHTTP frameworksdks/cpp/chio-drogonGo and C++ HTTP
hello-mcpProtocol edgeMCP edge runtimeHello MCP
hello-a2aProtocol edgeA2A edge runtimeHello A2A
hello-acpProtocol edgeACP edge runtimeHello ACP
guards/tool-gateGuard examplechio-guard-sdk basic verdict logicBuilding Guards
guards/enriched-inspectorGuard examplechio-guard-sdk enriched fields + host functionsBuilding Guards
bilateral-invocationFederation demoBilateral cosign, DSSE signature-slice envelope, partial local verifierUpstream only
chio-3vendorFederation demochio-attest-loopback proof packages, selective disclosure, pheromone relay fixtures3-Vendor Walkthrough
cross-provider-policyPolicy demoOne Chio policy evaluated across eight native provider adaptersCross-Provider Policy
eval-receipt-ingestEvidence handoffchio.eval-report.bundle.v1, eval-receipt sign and verifyUpstream only
istio-ext-authzMesh integrationchio-envoy-ext-authz gRPC adapter, Istio AuthorizationPolicy CUSTOM actionIstio ext_authz
otel-genaiObservability integrationOTel GenAI contract, receipt and span bidirectional lookupOpenTelemetry
tee-sidecarPackaging smokechio-tee container packaging, sidecar TOML, spool volumeUpstream only

The 3 with no page are bilateral-invocation, eval-receipt-ingest, tee-sidecar. Each ships a README at its own run path, and the matrix row above is the whole of what these docs currently say about it.


Pick the entry point that matches your stack.

  1. hello-openapi-sidecar for the zero-code reverse-proxy shape.
  2. hello-fastapi for the first framework-native follow-on.
  3. One additional HTTP framework hello that matches your stack.
  4. hello-trust-control and hello-receipt-verify for the control-plane and evidence model.
  5. hello-mcp, hello-a2a, or hello-acp for protocol examples.
  6. hello-tool when you want to move from wrapped adapters to a native Chio service.
  7. The multi-organization examples once the entries above are familiar.

The hello contract

The nine HTTP examples, the three protocol edges, and hello-openapi-sidecar use the same structure:

  1. One safe read path (GET /hello or a discovery call).
  2. One governed path (POST /echo, tool/invoke, or message/send).
  3. A deny path without a capability token.
  4. An allow path with a trust-issued capability token.
  5. At least one Chio receipt or receipt id captured in the response.
  6. A single smoke.sh that runs all of the above.

The three remaining hello-* examples do not. hello-trust-control drives the trust plane with no app in front of it, hello-receipt-verify verifies a captured evidence package offline and has no runner, and hello-tool is a Cargo crate with no runner and no smoke at all.

The thirteen that do follow it use this layout:

text
hello-<surface>/
  README.md
  ARCHITECTURE.md
  run.sh, run-edge.sh, or run-trust.sh
  smoke.sh
  openapi.yaml    # the nine HTTP examples and hello-openapi-sidecar
  policy.yaml     # eight of the nine; hello-chi ships none and nothing reads any
  the app itself  # app.py, server.mjs, main.go, main.cpp, src/, ...

Shared helpers

The HTTP framework smokes share Bash helpers in examples/_shared/hello-http-common.sh for picking free ports, waiting for HTTP endpoints, and starting a local chio trust service plus chio api protect sidecar. If you copy a smoke into a CI pipeline, include those helpers with it.


Docker quickstart topology

For a containerized smoke that you can hand to a teammate, use examples/docker/. It builds two images from the repo root Dockerfile targets and runs them with one compose command.

examples/dockerbash
docker compose up -d --build
python3 smoke_client.py
# open http://127.0.0.1:8940/?token=demo-token to view the receipt
docker compose down -v

The compose file starts chio trust serve with the receipt dashboard on 127.0.0.1:8940 and chio mcp serve-http on 127.0.0.1:8931. The smoke script performs one governed echo_text call through the hosted edge, queries the receipt from the trust service, and prints the viewer URL.


Platform notes

  • Linux and macOS: examples run on both. The smokes assume bash, python3, curl, and jq are on PATH.
  • Drogon: hello-drogon needs CMake and the Drogon C++ framework installed. Both run.sh and smoke.sh skip with a clear message when CMake or Drogon is missing.
  • JVM: hello-spring-boot uses the Gradle wrapper; you need a JDK on the path.
  • .NET: hello-dotnet requires the .NET SDK that the HelloChio.csproj targets.
  • Python: hello-fastapi and hello-django are managed with uv. Their run.sh scripts call uv run directly.

Next