host()
Make your agent accessible over the network. One function call. HTTP, WebSocket, and P2P relay.
Why host()? Turn local agents into network services. HTTP API, WebSocket, P2P relay - all with one function call.
60-Second Quick Start
Create an agent and call host(agent) - that's it:
What You Get
Worker Isolation
Each request gets a fresh deep copy of your agent:
HTTP API
POST /input - Submit a Task
Multi-turn Conversations
Pass the session from the response to continue:
GET /sessions/{session_id} - Fetch Results
GET /sessions - List Sessions
GET /health - Health Check
GET /info - Agent Info
WebSocket API
Real-time communication with streaming support:
INPUT → Agent
Send prompts to the agent
OUTPUT ← Agent
Receive final results
STREAM ← Agent
Streaming chunks
ERROR ← Agent
Error messages
Trust & Access Control
Control who can access your agent:
Trust Levels
Access Lists
Natural Language Policy
Configuration
All Parameters
Development vs Production
Development
Production
host.yaml Configuration
Store configuration in a YAML file instead of code parameters. Generated by co init or co create.
Basic Setup
Configuration Priority
Settings are loaded in order (highest priority first):
host(agent, port=9000).co/host.yamlAgent Metadata
Used by /info endpoint and ANNOUNCE messages for agent discovery:
Trust Levels
| Level | Behavior | Use Case |
|---|---|---|
| open | Accept all requests | Development |
| careful | Recommend signature, accept unsigned | Staging/Default |
| strict | Require valid signature | Production |
Advanced Trust Configuration
Access Control Lists
Server Settings
File Upload Limits
Control file upload sizes for /input endpoint and /ws WebSocket:
Image Processing
Video Analysis
Document Processing
Complete Example
Best Practices
host.yaml to version controlhost.yaml - use .env insteadwhitelist.txt or blacklist.txt to gitAPI Reference
| Parameter | Type | Default | Description |
|---|---|---|---|
| agent | Agent | required | The agent to host |
| trust | str | Agent | "careful" | Trust level, policy, or agent |
| blacklist | list | None | Addresses to always reject |
| whitelist | list | None | Addresses to always accept |
| port | int | 8000 | HTTP server port |
| workers | int | 1 | Number of worker processes |
| result_ttl | int | 86400 | Result storage TTL (24h default) |
| relay_url | str | production | P2P relay server URL |
| reload | bool | False | Auto-reload on code changes |
Deployment
With Uvicorn/Gunicorn
Docker
Docker Compose
systemd Service
Ready to Host Your Agents?
Just call host(agent) and your agent goes live!
