Quick Start
1
Install Package
Install PraisonAI Agents:For MCP support, also install:
2
Create an Agent
Create an agent to deploy as an API:
3
Launch as API
Deploy the agent as an HTTP API:
4
Test the API
Test your deployed agent API:
Launch Methods
HTTP API Server
The most common deployment method is as an HTTP API server using FastAPI:MCP Server
For Model Context Protocol integration:API Usage
When launched as an HTTP API, agents expose a single endpoint that accepts POST requests:HTTP API Endpoint
POST /path
Send messages to the agent and receive responses.
Complete Examples
Example 1: Single Agent HTTP API
Example 2: Multi-Agent HTTP API System
Example 3: MCP Server with Tools
Example 4: Multiple Endpoints on Same Port
Example 5: Debug Mode for Development
Launch Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
protocol | str | Launch protocol: “http” or “mcp" | "http” |
host | str | Host to bind to | ”0.0.0.0” |
port | int | Port number | 8000 |
path | str | API endpoint path (HTTP) or base path (MCP) | ”/“ |
debug | bool | Enable debug mode with auto-reload | False |
Client Integration
Python Client
JavaScript Client
MCP Client Integration
For MCP servers, use an MCP-compatible client:Deployment Best Practices
Performance
- Use appropriate worker processes
- Enable connection pooling
- Monitor resource usage
- Consider horizontal scaling for high load
Security
- Deploy behind a reverse proxy (nginx, Apache)
- Implement authentication at proxy level
- Use HTTPS in production
- Validate and sanitize inputs
- Set up rate limiting
Production Deployment
Docker Deployment
Systemd Service
Nginx Reverse Proxy
Important Notes
- Threading: The launch() method uses threading to run servers in the background
- Blocking: The last launch() call in your script will block the main thread
- Multiple Agents: You can run multiple agents on the same port with different paths (HTTP mode only)
- Dependencies: HTTP mode requires FastAPI and uvicorn, MCP mode requires praison-mcp
- API Documentation: HTTP APIs automatically get FastAPI documentation at
/docs
Troubleshooting
Port already in use
Port already in use
- Check if another process is using the port:
lsof -i :8000 - Kill the process or use a different port
- Ensure previous agent instances are properly stopped
Missing dependencies
Missing dependencies
- For HTTP:
pip install fastapi uvicorn - For MCP:
pip install praison-mcp mcp - Check error messages for specific missing packages
Agent not responding
Agent not responding
- Check console for error messages
- Verify API key is set correctly
- Test with debug=True for more detailed logs
- Ensure agent initialization is successful
Connection refused
Connection refused
- Verify the host and port settings
- Check firewall rules
- Ensure the agent is actually running
- Try connecting from localhost first

