Overview
Turn your elizaOS agent into a web service that can be accessed from any HTTP client. Perfect for integrating agents into web applications, mobile apps, or other services. What you’ll learn:- Create HTTP endpoints for your agent
- Handle chat requests
- Implement health checks
- Manage conversation state
- Add error handling
Quick Start
Complete Server Code
server.ts
API Endpoints
GET / - Agent Information
Returns information about the agent. Request:GET /health - Health Check
Check if the server is running and healthy. Request:POST /chat - Send Message
Send a message to the agent and receive a response. Request:message(required): The user’s messageuserId(optional): User identifier for trackingconversationId(optional): Conversation identifier for context
Advanced Features
Streaming Responses
Stream responses in real-time using Server-Sent Events:Conversation History
Add endpoint to retrieve conversation history:Rate Limiting
Add rate limiting to prevent abuse:Authentication
Add API key authentication:CORS Support
Enable CORS for browser access:Deployment
Docker
CreateDockerfile:
Environment Variables
Create.env file:
Testing
Test Script
test.sh
Next Steps
Serverless
Deploy to AWS Lambda, Vercel, or Cloudflare
Browser Integration
Connect your API to a web frontend
Multi-Agent
Create APIs for multiple agents
Deploy Guide
Production deployment best practices