Examples Overview
The examples/ tree teaches Chio one surface at a time. Small hello-* examples isolate a single integration shape; flagship examples compose them into multi-org workflows. This page is the index.
Choose your example
Pick the page that matches the question you're actually asking:
- "I want to see one governed call, end to end, with the smallest moving parts" 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-sidecarupstream and read Protect an API. - "I want to verify a receipt offline, with no kernel running" run
examples/hello-receipt-verifyupstream. - "I want a multi-org topology with budgets, settlement, and disputes" run
examples/agent-commerce-networkupstream.
How to read these pages
Every example page in this section follows the same four-part shape so you can scan any of them in under two minutes:
- 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.
- Success criteria. The exact assertions in
smoke.shthat decide whether the run passed. Status codes, JSON fields, header values, exit codes. - Inspect after. Concrete commands you run after the smoke passes to confirm state landed:
cat .artifacts/.../bridge-call.json,chio receipt list, header extraction, and so on. Every command shows expected output. - Decision rule. A short callout that says when to use the example and which sibling to use instead.
Getting the source
Every example lives in the upstream chio repo (working name chio). Clone the repo, build the workspace once, then run any example from its directory.
git clone https://github.com/backbay-labs/chio.git
cd chio
cargo build --workspace
cd examples/hello-toolEach example ships with a README.md, a runner (run.sh, run-edge.sh, or run-trust.sh), and a smoke script (smoke.sh) that exercises the supported flows end-to-end.
Run a single smoke
examples/ the runner ./run-hello-smokes.sh --list prints every smoke target. Pass names to run a subset: ./run-hello-smokes.sh hello-fastapi hello-fastify. Run with no arguments to execute the full set.Surface matrix
Each example teaches a specific Chio surface. Use this table to find the example that matches the integration shape you need.
| Example | Kind | Surface taught | Page |
|---|---|---|---|
hello-tool | Native service | NativeChioServiceBuilder, signed manifests, manifest pricing | Hello Tool |
hello-mcp | Protocol edge | MCP edge over stdio JSON-RPC, kernel-mediated tools/call | Hello MCP |
hello-a2a | Protocol edge | A2A edge with deferred task lifecycle | Upstream only |
hello-acp | Protocol edge | ACP invoke plus stream/resume | Upstream only |
hello-openapi-sidecar | HTTP sidecar | chio api protect with OpenAPI | Upstream only |
hello-fastapi | HTTP framework | chio-asgi, chio-fastapi | Python HTTP |
hello-django | HTTP framework | chio-django middleware | Python HTTP |
hello-express | HTTP framework | @chio-protocol/express | Node HTTP |
hello-fastify | HTTP framework | @chio-protocol/fastify | Node HTTP |
hello-elysia | HTTP framework | @chio-protocol/elysia | Node HTTP |
hello-chi | HTTP framework | chio-go-http | Go and C++ HTTP |
hello-spring-boot | HTTP framework | chio-spring-boot servlet filter | JVM and .NET HTTP |
hello-dotnet | HTTP framework | ChioMiddleware for ASP.NET | JVM and .NET HTTP |
hello-drogon | HTTP framework | chio::drogon::ChioMiddleware | Go and C++ HTTP |
hello-trust-control | Control-plane adjunct | Capability lifecycle, chio check, chio evidence verify | Upstream only |
hello-receipt-verify | Control-plane adjunct | Offline evidence verification, tamper detection | Upstream only |
docker | Quickstart topology | trust serve + hosted MCP edge + receipt dashboard | Upstream only |
anthropic-sdk | Ecosystem client | Claude tool use over hosted Chio session | Upstream only |
openai-compatible | Ecosystem client | OpenAI function calling over hosted Chio session | Upstream only |
langchain | Ecosystem client | Python Chio SDK with LangChain StructuredTool | Upstream only |
guards/tool-gate | Guard example | chio-guard-sdk verdict logic | Upstream only |
guards/enriched-inspector | Guard example | Enriched WASM guard with host functions | Upstream only |
agent-commerce-network | Flagship | Multi-party economic workflow: approvals, budgets, settlement, disputes | Upstream only |
internet-of-agents-incident-network | Flagship | Recursive cross-org delegation with OpenAI SDK orchestration, MCP, ACP | Upstream only |
internet-of-agents-web3-network | Flagship | Four-org Chio-mediated commerce with RFQ routing and web3 settlement | Upstream only |
Recommended order
The repo lists a supported sequence for new users. Pick the entry point that matches your stack.
hello-openapi-sidecarfor the zero-code reverse-proxy shape.hello-fastapifor the first framework-native follow-on.- One additional HTTP framework hello that matches your stack.
hello-trust-controlandhello-receipt-verifyfor the control-plane and evidence model.hello-mcp,hello-a2a, orhello-acpfor the protocol surfaces.hello-toolwhen you want to move from wrapped adapters to a native Chio service.- The flagship examples once the surfaces above are familiar.
The hello contract
Every hello-* example converges on the same shape so you can read any of them quickly:
- One safe read path (
GET /helloor a discovery call). - One governed path (
POST /echo,tool/invoke, ormessage/send). - A deny path without a capability token.
- An allow path with a trust-issued capability token.
- At least one Chio receipt or receipt id captured in the response.
- A single
smoke.shthat runs all of the above.
Directory layout is consistent too:
hello-<surface>/
README.md
policy.yaml or config/
run.sh or run-edge.sh
smoke.sh
app/ or 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 real CI pipeline, lift those helpers along 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.
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 -vThe 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: every example runs on both. The smokes assume
bash,python3,curl, andjqare onPATH. - Drogon:
hello-drogonneeds CMake and the Drogon C++ framework installed. Bothrun.shandsmoke.shskip with a clear message when CMake or Drogon is missing. - JVM:
hello-spring-bootuses the Gradle wrapper; you need a JDK on the path. - .NET:
hello-dotnetrequires the .NET SDK that theHelloChio.csprojtargets. - Python:
hello-fastapiandhello-djangoare managed withuv. Theirrun.shscripts calluv rundirectly.
Next
- Quickstart: install the CLI and run a single tool call end-to-end.
- Hello Tool: the simplest native Chio service.
- Hello MCP: authoritative MCP edge over stdio.
- Node HTTP Frameworks, Python HTTP Frameworks, JVM and .NET, Go and C++: stack-specific walkthroughs.