AIMux is a security-focused service mesh for AI agent networks. It provides centralized governance over agent-to-agent communication through identity-based access control, semantic routing, and audit logging.
The Challenge: How do you monitor and control what AI agents can access? Traditional API gateways lack agent intent understanding.
The Solution: AIMux enforces policy at the infrastructure level rather than relying on agents for self-governance.
Get AIMux running in under 2 minutes:
git clone https://github.com/techspeque/aimux.git
cd aimux
make runTest it out:
# Basic query
curl "http://localhost:8080?q=what+is+50+times+3"
# View dashboard
curl "http://localhost:8080/dashboard/"Run a full Agent Service Mesh simulation demonstrating semantic routing, ACL enforcement, and authentication:
make demobrew install techspeque/aimux/aimuxdocker run -p 8080:8080 ghcr.io/techspeque/aimux:latestPre-built binaries for Linux and macOS:
curl -LO https://github.com/techspeque/aimux/releases/latest/download/aimux-linux-amd64.tar.gz tar -xzf aimux-linux-amd64.tar.gz ./aimux -config aimux.yamlRequires Go 1.22+:
git clone https://github.com/techspeque/aimux.git
cd aimux
make buildDownload the .deb package from the latest release:
curl -LO https://github.com/techspeque/aimux/releases/download/v0.3.1/aimux_0.3.1_amd64.deb
sudo dpkg -i aimux_*.deb
sudo systemctl start aimuxOr add the APT repository for automatic updates:
curl -fsSL https://techspeque.github.io/aimux/public.key \
| sudo gpg --dearmor -o /usr/share/keyrings/aimux-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/aimux-archive-keyring.gpg] https://techspeque.github.io/aimux stable main" \
| sudo tee /etc/apt/sources.list.d/aimux.list
sudo apt update && sudo apt install aimuxAIMux uses a YAML configuration file to define server settings, semantic engine parameters, agents, and routes.
server:
port: 8080
runtime:
mode: "zero-trust" # legacy | zero-trust | hybrid
principal_header: "X-AIMux-Principal"
principal_signature_header: "X-AIMux-Principal-Signature"
principal_signature_secret: "change-me" # HMAC-SHA256 secret
reputation:
error_threshold: 5 # Errors before circuit opens
circuit_reset_timeout: "1m" # Time before half-open retry
logging:
level: info
timestamp: true
semantic_engine:
model_path: "./models/all-MiniLM-L6-v2.onnx"
min_score: 0.40
ambiguity_threshold: 0.05
agents:
- finance-bot
- admin-bot
- data-processor
routes:
- name: "finance"
upstream: "http://finance:8001"
intents:
- "analyze budget"
- "forecast revenue"
allowed:
- finance-bot
- admin-bot
- name: "legal"
upstream: "http://legal:8002"
require_verification: true # Require upstream ZKP/TEE attestation
intents:
- "review nda"
- "check compliance"
allowed:
- legal-bot
- admin-bot
fallback:
upstream: "http://ollama:11434"server.port - HTTP server port (default: 8080)runtime.mode - Identity mode: legacy, zero-trust, or hybridruntime.principal_header - Signed principal header name (default: X-AIMux-Principal)runtime.principal_signature_header - Signature header name (default: X-AIMux-Principal-Signature)runtime.principal_signature_secret - HMAC secret for signed principal verificationreputation.error_threshold - Number of errors before the circuit breaker opensreputation.circuit_reset_timeout - Duration before attempting half-open recoverylogging.level - Log level: debug, info, warn, errorsemantic_engine.min_score - Minimum similarity threshold (0-1)semantic_engine.ambiguity_threshold - Max score difference for ambiguity detectionagents - List of registered agent identitiesroutes[].require_verification - Require upstream X-AIMux-ZKP-Attestation or X-AIMux-TEE-Quote headerroutes - Semantic routes with intents and ACLsfallback.upstream - Default route when no semantic match foundIdentity extraction depends on the runtime mode:
client_id, agent, sourceX-Source-Agent, X-Client-IDagent fieldX-AIMux-Principal + X-AIMux-Principal-Signature (HMAC-SHA256)Tries zero-trust extraction first, falls back to legacy if no cryptographic identity is present.
Example:
# Legacy mode — via header
curl -H "X-Source-Agent: finance-bot" \
-d '{"query": "analyze revenue"}' \
http://localhost:8080
# Zero-trust mode — signed principal
PRINCIPAL="finance-bot"
SIG=$(printf "%s" "$PRINCIPAL" | openssl dgst -sha256 -hmac "change-me" -binary | xxd -p -c 256)
curl -H "X-AIMux-Principal: $PRINCIPAL" \
-H "X-AIMux-Principal-Signature: $SIG" \
-H "X-AIMux-Query-Hint: analyze revenue" \
http://localhost:8080Specific agents only via allowed field:
routes:
- name: "admin"
upstream: "http://admin:8004"
allowed:
- admin-bot # Only admin-bot can accessAll registered agents using wildcard:
routes:
- name: "public-api"
upstream: "http://api:8000"
allowed:
- "*" # Any registered agentNo ACL field means all access including anonymous:
routes:
- name: "health"
upstream: "http://health:8080"
# No 'allowed' field = completely openAgent names must use snake_case or kebab-case:
✓ Valid
✗ Invalid
401 Unauthorized - Unregistered client identity403 Forbidden - Client not permitted for route, anonymous access to restricted route, or circuit breaker open502 Bad Gateway - Upstream failed to provide required cryptographic verification (ZKP/TEE)AIMux v0.3.1 introduces three runtime identity modes. Choose the level of trust verification that matches your deployment.
Header-based identity. Trusts the agent name in headers/query params without cryptographic verification.
runtime:
mode: "legacy"Best for: development, internal networks
Every request must be cryptographically verified via HMAC-SHA256 or mTLS. No implicit trust.
runtime:
mode: "zero-trust"
principal_signature_secret: "secret"Best for: production, multi-tenant
Zero-trust when credentials are present, legacy fallback otherwise. Enables gradual migration.
runtime:
mode: "hybrid"
principal_signature_secret: "secret"Best for: migration, mixed fleets
In zero-trust mode, agents sign their principal name with a shared secret. AIMux recomputes the HMAC and rejects mismatches. The sidecar handles this automatically.
# Sign the principal and send a request
PRINCIPAL="finance-bot"
SIG=$(printf "%s" "$PRINCIPAL" | openssl dgst -sha256 -hmac "change-me" -binary | xxd -p -c 256)
curl -X POST http://localhost:8080 \
-H "Content-Type: application/json" \
-H "X-AIMux-Principal: $PRINCIPAL" \
-H "X-AIMux-Principal-Signature: $SIG" \
-H "X-AIMux-Query-Hint: analyze revenue" \
-d '{"messages":[{"role":"user","content":"analyze revenue"}]}'When mTLS is enabled, AIMux extracts the agent identity from the client certificate's Common Name (CN) or SPIFFE ID (SAN URI). This provides the strongest identity guarantee — no shared secrets required.
# Agent connects with client cert
curl --cert agent.crt --key agent.key \
--cacert ca.crt \
-d '{"query": "analyze revenue"}' \
https://aimux.internal:8443Use require_verification: true on strict routes to require the upstream to provide a cryptographic attestation header (X-AIMux-ZKP-Attestation or X-AIMux-TEE-Quote). Returns 502 if the upstream fails to provide it.
routes:
- name: "legal"
upstream: "http://legal:8002"
require_verification: true # Require upstream ZKP or TEE attestation
allowed:
- legal-bot
- admin-botFor zero-trust deployments, run aimux-sidecar next to each agent. The sidecar forwards traffic to AIMux while injecting signed identity headers.
localhost:8081 (sidecar listen port)X-AIMux-Principal header with the agent identityX-AIMux-Principal-SignatureX-AIMux-Query-Hint when possible# sidecar.yaml
listen_port: 8081
gateway_url: http://127.0.0.1:8080
agent_id: finance-bot
signature_secret: change-me
# Optional mTLS client certificate for sidecar->gateway transport
# cert_file: /etc/aimux/certs/agent.crt
# key_file: /etc/aimux/certs/agent.key# Build the sidecar binary
go build -o bin/aimux-sidecar ./cmd/sidecar
# Run alongside your agent
./bin/aimux-sidecar -config sidecar.yaml
# Then point your agent to localhost:8081 instead of the gatewayX-AIMux-Principal - Agent identity from agent_id configX-AIMux-Principal-Signature - HMAC-SHA256 of the principal nameX-AIMux-Query-Hint - Intent sniffed from the request payload (when available)cert_file / key_file - Optional mTLS client certificate for gateway transportAIMux tracks error rates per-upstream and per-agent, automatically opening circuit breakers to prevent cascading failures.
reputation:
error_threshold: 5 # Consecutive failures before circuit opens
circuit_reset_timeout: "1m" # Time before half-open retryNormal operation. Requests flow through. Errors are counted.
Error threshold exceeded. All requests are immediately rejected with 403 (circuit breaker open).
After circuit_reset_timeout, one probe request is allowed. Success closes the circuit; failure re-opens it.
finance:8001 is down, requests to admin:8004 are unaffected.aimux_circuit_breaker_state metrics for alerting and dashboards.AIMux exposes several management and observability endpoints:
/healthzHealth check endpoint
/metricsPrometheus metrics endpoint
/routesList all configured routes
/agentsList all registered agents
/configView current configuration
/dashboard/Built-in web UI for monitoring
AIMux accepts standard OpenAI chat completion format:
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-Source-Agent: finance-bot" \
-d '{
"model": "gpt-4",
"messages": [
{"role": "user", "content": "analyze Q3 revenue"}
]
}'make buildmake testEnable detailed logging in your config:
logging:
level: debug
timestamp: trueAIMux is released under the MIT License. Free for personal and commercial use.