Guide: Building web services
X07 supports agent-built web services through:
ext-web-kit(router + middleware + canonical errors + OpenAPI 3.1; pinned byarch/web/, pure worlds)ext-net/ OS adapters for real networking (HTTP servers, TLS, sockets)ext-auth-jwtfor JWT issuance/verification (pinned byarch/crypto/, OS worlds only)ext-obsfor metrics snapshot + OpenMetrics/OTLP export (pinned byarch/obs/, export is OS worlds only)
Canonical (template + x07 run)
Start from the web-service template (recommended):
x07 init --template web-service
Then run:
x07 run --profile sandbox
For agent-built services, keep the core pure and isolate OS I/O behind a thin adapter:
- Define your API contract under
arch/web/and generate a router/OpenAPI surface withext-web-kit(pure). - Write request handling using pure router/middleware logic (no OS calls).
- Unit-test routing + request/response encoding with
x07 test. - Bind the router to a real server adapter and smoke-test via
x07 run --profile sandbox.
Why this works for agents
- pure core is easy to refactor
- unit tests are easy to repair
- OS integration is isolated behind a small adapter
Expert (operations)
- Treat
run-os-sandboxedas the default for CI and untrusted environments; only relax torun-oswhen you control the execution host. - For production deployments, keep the OS-facing adapter small and policy-reviewed; keep request/response logic in the pure core so repairs are localized.