Technology · Framework

Axum

Axum is the HTTP layer under most of my Rust services: the memory gateway, the voice engine's control surface, the execution substrate's endpoints.

FAFOHive · FAFO Core · Helix · Agent SwarmTower middleware layersHTTP and WebSocket endpoints
Requests from four systems on one HTTP layer
FAFOHiveMCP transport and REST
FAFO Core gatewaygenerated tool routes
Helix bridgeframed media over WebSocket
Agent Swarm launchercompletion proxy
Axum and Towerrequest traffic illustrative
  • ~70REST endpoints in FAFOHive's API, beside its MCP transport
  • 19,000lines in that API module
  • 1,900lines in Helix's WebSocket endpoint for media frames
  • 2 mintimeout for the code-path explainer, one of the per-tool limits

Replacing a transport that died on restart

FAFOHive is one Rust process that every managed agent seat in my estate connects to, and Axum is its HTTP layer. It serves the MCP transport and a REST API.

The MCP transport started on the rmcp SDK's streaming server-sent-events service, and that service broke whenever a container restarted. Container restarts are routine in my estate, so I replaced it with a per-request, TLS-terminated POST handler in Axum.

Streaming service · replaced

One long-lived stream. The restart ends it, and the client's session goes with it.

Per-request POST · kept

Each call stands alone. The next request after the restart simply lands.

The black line is a container restart.

Long-running tools get their own timeouts, sized to what each tool does, so one slow tool cannot hold a connection open indefinitely.

A gateway whose routes are generated

FAFO Core and Function Forge needed a gateway that turns any generated function into an agent-callable tool without someone editing a router by hand. The gateway is an Axum server implementing MCP as JSON-RPC 2.0 over HTTP: POST and GET on the MCP route, the well-known MCP configuration, OAuth protected-resource metadata and session ids.

Tool routing is generated at build time from YAML, so a function minted by Function Forge becomes a tool after a rebuild and the router stays out of the edit path.

One server, cut into route groups
Operator routesREST path, its own layer
Agent-runtime routesJWT, a separate layer
Generated tool routescompiled from YAML
The bar is the group's middleware; the orange handler is the newest, and it inherits the bar above it.

The API integration platform I built beside Core uses a stateless POST MCP transport on the same framework. The generator is described in Tools that build tools, under governance.

Endpoints for media, state and model access

Helix joins a Windows media service to a Linux voice engine, and the Linux end of that bridge is an Axum endpoint; the bridge is told in A self-hosted colleague in a Teams call. Agent Swarm's persona launcher exposes its HTTP surfaces through Axum too.

What each endpoint carries · illustrative
Helix WebSocket
Helix control, mTLS
Completion proxy
A steady stream of framed audio and video, sparse state calls, and model requests in bursts from agent containers.

I use Axum and Tower as published and have not patched the framework.

My work with Axum is in transport choice, routing and middleware structure.