ReferenceSDKs
SDK Overview
Every Chio SDK by language: distribution names, import names, versions, runtime floors, and the one sidecar route they share.
Source
This page reflects the SDK manifests in the Chio source. The layout and the two-cores-per-language rule come from sdks/README.md. Every package name, distribution name, version, and runtime floor below renders from the sdks dataset, which reads the package.json, pyproject.toml, go.mod, settings.gradle.kts, Package.swift, CMakeLists.txt, Cargo.toml, and .csproj files under sdks/ at the pinned commit. The worked wiring comes from the applications under examples/, and the Node floor from sdks/typescript/chio-ts/package.json (engines.node). None of these files carry MUST, SHOULD, or MAY: a manifest states what it states, and the normative protocol text lives in the Protocol Reference.
Synopsis
One install line and one entry-point import per language.
| Language | Install | Entry point |
|---|---|---|
| Python, sidecar client | pip install chio-sdk-python | from chio_sdk import ChioClient |
| Python, hosted MCP client | pip install chio-sdk | from chio import ChioClient |
| TypeScript | npm install @chio-protocol/sdk | import { ChioClient } from "@chio-protocol/sdk" |
| Go | replace github.com/backbay-labs/chio/sdks/go/chio-go-http => ../../sdks/go/chio-go-http | chio "github.com/backbay-labs/chio/sdks/go/chio-go-http" |
| JVM | world.chio:chio-sdk-jvm:0.1.0 | world.chio.sdk.ChioClient |
| .NET | <ProjectReference Include="../../sdks/dotnet/ChioMiddleware/src/ChioMiddleware.csproj" /> | using Backbay.Chio; |
| Rust | chio-binding-helpers = { path = "../../crates/sdk/chio-binding-helpers" } | use chio_binding_helpers::verify_receipt; |
Distributions and imports
The distribution name and the import name differ in most ecosystems. These are the exact strings, with the version each manifest declares and the runtime floor it requires.
| Language | Package or distribution | Module or import | Version | Runtime |
|---|---|---|---|---|
| Python, sidecar client | chio-sdk-python | chio_sdk | 0.1.0 | python >=3.11 |
| Python, hosted MCP client | chio-sdk | chio | 0.1.0 | python >=3.11 |
| TypeScript | @chio-protocol/sdk | @chio-protocol/sdk | 0.1.0 | Node.js 22 or newer |
| Go, wire adapter | sdks/go/chio-go-http | github.com/backbay-labs/chio/sdks/go/chio-go-http | tracked by the clone | go 1.21 |
| Go, in-process client | sdks/go/chio-go | github.com/backbay-labs/chio/sdks/go/chio-go | tracked by the clone | go 1.23.0 |
| JVM client | world.chio:chio-sdk-jvm | world.chio.sdk.ChioClient | 0.1.0 | Java 17 |
| JVM servlet filter | world.chio:chio-spring-boot | world.chio.ChioFilter | 0.1.0 | Java 17 |
| .NET | Backbay.Chio.Middleware | using Backbay.Chio; | 0.1.0 | net8.0 |
| Rust invariants | chio-binding-helpers | chio_binding_helpers | 0.1.0 | Rust 1.94 |
The Go, JVM, .NET, and Rust rows name a path rather than a registry, so a consuming build resolves them from a clone of the tree. Each declaration below is lifted from the worked example that uses it. Go points the module path at a sibling directory, Gradle substitutes the coordinate from a composite build, and MSBuild references the project file.
module hello-chi
go 1.21
require (
github.com/backbay-labs/chio/sdks/go/chio-go-http v0.0.0
github.com/go-chi/chi/v5 v5.2.3
)
require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/oapi-codegen/runtime v1.2.0 // indirect
)
replace github.com/backbay-labs/chio/sdks/go/chio-go-http => ../../sdks/go/chio-go-httpincludeBuild("../../sdks/jvm") <ItemGroup>
<ProjectReference Include="../../sdks/dotnet/ChioMiddleware/src/ChioMiddleware.csproj" />
</ItemGroup>The two Python distributions cross
pip install chio-sdk-python gives you the module chio_sdk, the async client for a colocated sidecar. pip install chio-sdk gives you the module chio, the client for a hosted MCP edge. The names cross, so read the import line before the install line. There is no pip install chio: that name belongs to an unrelated project.One route in every language
The example matrix carries 9 HTTP framework applications, one per framework. Each serves the same three routes behind the same sidecar: GET /healthz excluded from evaluation, GET /hello allowed, and POST /echo refused until the caller presents a capability. The wiring is one call in every language.
from chio_asgi import ChioASGIMiddleware, ChioASGIConfig
# Starlette / FastAPI
app.add_middleware(
ChioASGIMiddleware,
config=ChioASGIConfig(sidecar_url="http://127.0.0.1:9090"),
) if (enableChio) {
app.use(
chio({
sidecarUrl,
skip: ["/healthz"],
}),
);
}func protectedHandler(sidecarURL string) http.Handler {
return chio.Protect(
newRouter(),
chio.WithSidecarURL(sidecarURL),
)
} @Bean
fun chioFilterRegistration(): FilterRegistrationBean<ChioFilter> {
val filter = ChioFilter(
ChioFilterConfig(
sidecarUrl = System.getenv("CHIO_SIDECAR_URL") ?: "http://127.0.0.1:9090",
),
)
return FilterRegistrationBean<ChioFilter>().apply {
setFilter(filter)
addUrlPatterns("/hello", "/echo")
order = Ordered.HIGHEST_PRECEDENCE
}
}using Backbay.Chio;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddChioProtection();
var app = builder.Build();
app.UseChioProtection();
app.MapGet("/pets", () => new { pets = Array.Empty<object>() });
app.Run();What a refusal returns
A refusal is a record. The two middlewares that front an application, the Python ASGI one and the Node interception layer every JavaScript adapter shares, both answer a denied request with a JSON body and a receipt id on a response header.
| Middleware | Deny body | Receipt header |
|---|---|---|
chio-asgi | { error, message, status }, where error is the guard name and message the verdict reason | X-Chio-Receipt |
@chio-protocol/node-http | { error, message, receipt_id, suggestion }, where error is one of six CHIO_ERROR_CODES values | X-Chio-Receipt-Id |
The ASGI status is the receipt verdict's own HTTP status when it carries one and 403 otherwise. The Node layer sends chio_access_denied on a deny and chio_invalid_receipt with status 502 when the sidecar answers with a receipt that fails verification. Both paths fail closed. Run any of the applications with examples/run-hello-smokes.sh, which starts a trust control plane, the application, and a sidecar, then walks the three routes.
Choose an SDK
Every SDK implements the same invariants. The differences are in the higher layers: framework adapters, orchestrator operators, agent framework integrations, and native server middleware.
| Language | Package | Fits | Reference |
|---|---|---|---|
| Python | chio-sdk-python, chio-sdk | FastAPI, Django, Airflow, Temporal, Prefect, Dagster, Ray, LangChain, LangGraph, LlamaIndex, CrewAI, and AutoGen, each a separate companion distribution. | Python SDK |
| TypeScript | @chio-protocol/sdk | Node.js servers, edge workers, and agents. The 17 published npm packages cover Express, Fastify, Elysia, Next.js, the Vercel AI SDK, Cloudflare Workers, Deno, and the browser. | TypeScript SDK |
| Go | chio-go-http, chio-go | Cloud infrastructure. chio-go-http wraps any http.Handler; chio-go is the context-aware client and session. Both build without cgo. | Go SDK |
| JVM | chio-sdk-jvm, chio-spring-boot | Spring Boot services and Flink jobs. The client targets Java 17 and pulls in no Spring types; the filter is a separate coordinate. | JVM SDK |
| .NET | Backbay.Chio.Middleware | ASP.NET Core on net8.0. Fail-closed middleware plus a standalone sidecar client. | .NET SDK |
| Rust | chio-binding-helpers | The reference invariants crate. The kernel types, the CLI, and every other SDK conform against its vectors. Offline verification, no HTTP client. | Rust SDK |
Under all six sits the Bindings API, the low-level contract every binding implements: canonical JSON, hashing, signing, receipt and capability and manifest verification, delegation chains, Merkle proofs, and the stable error taxonomy. Read it if you are porting to a new language or writing an offline verifier.
Shared functionality
The four SDKs that carry a client and a session are compared below. Rust provides invariants only. The JVM and .NET SDKs are sidecar clients: they evaluate, verify, and filter HTTP requests, and they open no MCP session.
| Layer | TypeScript | Python | Go | Rust |
|---|---|---|---|---|
| Invariants | Yes | Yes | Yes | Yes |
| Transport | Yes | Yes | Yes | No |
| Client and session | Yes | Yes | Yes | No |
| Receipt query | Yes | Yes | No | No |
| DPoP proof signing | Yes | No | No | No |
| Cognition market | Yes | Yes | No | No |
- Invariants. Pure functions for canonical JSON, SHA-256, Ed25519, and verification of receipts, capabilities, and signed manifests. They make no network call.
- Transport. Streamable HTTP MCP transport with an explicit session lifecycle.
- Client and session. Opening a session against a chio edge and calling tools over it.
- Receipt query. A typed client over
GET /v1/receipts/querywith pagination. From Go or Rust, call the endpoint directly. - DPoP proof signing.
signDpopProofbuilds and signs a proof bound to a capability, a tool, and an action-argument hash. The Python sidecar client accepts a caller-supplieddpop_proofon mediated evaluation but constructs none. - Cognition market. Buyer, seller, and hosted clients for the Finding market, plus the buyer-local bid ceiling.
Platform SDKs
Two integrations govern infrastructure rather than application code. Neither calls the sidecar over POST /chio/evaluate.
- chio-tower. A Rust
tower::Layerthat wraps any Tower or Axum HTTP service and runs the kernel in process. It exportsChioLayer,ChioService,ChioEvaluator,EvaluationResult,ChioTowerError,extract_identity,IdentityExtractor,DEFAULT_MAX_BODY_BYTES, and theKernelServicestack (build_layered,KernelTraceLayer,TenantConcurrencyLimitLayer,TenantId). It fails closed. - Kubernetes controller and webhooks. The controller watches Jobs labeled
chio.world/governed: "true", reads the requested scopes offchio.world/scopes, mints a capability grant at creation, writeschio.world/capability-id,chio.world/capability-token, andchio.world/capability-expires-atonto the pod template, holds the Job with thechio.world/capability-finalizerfinalizer, and harvests thechio.world/receiptannotations the sidecar posted. The validating webhook admits a pod only when the token onchio.world/capability-tokenverifies against the operator's configured trust set, and it denies any pod that carrieschio.world/required-scopesorchio.world/exempt, because a workload must not set its own policy. The mutating webhook runs the same verification and emits no patch. A namespacedChioPolicycustom resource in thechio.worldgroup carries the operator's policy.
Everything under sdks/
Most directories under sdks/ hold one language. Three do not: guard/ holds the WASM guard guest SDKs, which are built out of tree and loaded as components rather than linked as host clients; k8s/ holds the Kubernetes controller, its custom resource, and the admission webhooks; and lambda/ holds the AWS Lambda pair. Every package, module, and project the manifests declare appears below.
| Directory | Language | Packages and projects |
|---|---|---|
sdks/cpp/ | C++ | ChioCpp, ChioCppKernel, ChioDrogon |
sdks/dotnet/ | .NET | Backbay.Chio.Middleware |
sdks/go/ | Go | github.com/backbay-labs/chio/sdks/go/chio-go, github.com/backbay-labs/chio/sdks/go/chio-go-http |
sdks/guard/ | C++, Go, Python, TypeScript | @chio-protocol/guard-ts, ChioGuardCpp, chio-guard-py, github.com/backbay-labs/chio/sdks/guard/chio-guard-go |
sdks/jvm/ | JVM | world.chio:chio-sdk-jvm, world.chio:chio-spring-boot, world.chio:chio-streaming-flink |
sdks/k8s/ | Go | github.com/backbay-labs/chio-k8s-controller, github.com/backbay-labs/chio-k8s-webhooks |
sdks/lambda/ | Python, Rust | chio-lambda-extension, chio-lambda-python |
sdks/python/ | Python | chio-adapter-base, chio-airflow, chio-asgi, chio-autogen, chio-bedrock, chio-code-agent, chio-crewai, chio-dagster, chio-django, chio-fastapi, chio-hermes, chio-iac, chio-langchain, chio-langgraph, chio-llamaindex, chio-observability, chio-prefect, chio-ray, chio-sdk, chio-sdk-python, chio-streaming, chio-temporal |
sdks/rust/ | Rust | chio-guard-sdk-compat |
sdks/swift/ | Swift | Chio |
sdks/typescript/ | TypeScript | @chio-protocol/ai-sdk, @chio-protocol/ai-sdk-middleware, @chio-protocol/browser, @chio-protocol/codegen-tools, @chio-protocol/conformance, @chio-protocol/deno, @chio-protocol/edge, @chio-protocol/elysia, @chio-protocol/express, @chio-protocol/fastify, @chio-protocol/mobile, @chio-protocol/next, @chio-protocol/node-http, @chio-protocol/passkey, @chio-protocol/sdk, @chio-protocol/typescript-sdks, @chio-protocol/wasm-core, @chio-protocol/workers, create-chio-app |
C++ and Swift have no reference page of their own. The C++ projects are worked in examples/hello-drogon.
Cross-language conformance
TypeScript, Python, Go, and Rust run the same conformance vectors: canonical JSON, hashing, signature verification, receipt parsing, capability parsing, and manifest parsing. Rust is the reference, and the other three produce byte-identical output against its vectors. The JVM SDK asserts the same byte-equality under a parity JUnit tag on canonical JSON, the DLQ router, and synthetic deny receipts.
Cross-language verification fails when canonical JSON is nonconformant, so every SDK implements the RFC 8785 requirements for key sorting, whitespace, and number formatting. The Bindings API carries that contract in full.
# Run conformance per SDK
$ cd sdks/typescript/chio-ts && npm test
$ cd sdks/python/chio-py && pytest
$ cd sdks/go/chio-go && go test ./...
$ cargo test -p chio-binding-helpers
$ cd sdks/jvm && ./gradlew build --no-daemonRelated
- Python SDK, TypeScript SDK, Go SDK, JVM SDK, .NET SDK, Rust SDK: the per-language references.
- Bindings API: the invariants contract every SDK conforms to.
- CLI Reference: standalone governance of an MCP server without embedding an SDK.
- Receipt Format and Receipt Query API: the data shapes each SDK wraps.
- Python, Node, Go and C++, and JVM and .NET worked applications.