Learn how to deploy PraisonAI agents as RESTful APIs for production environments
PraisonAI agents can be easily deployed as RESTful APIs, allowing you to integrate them into various applications and services. This guide covers how to deploy both single and multiple agents as APIs.
Install Dependencies
Make sure you have the required packages installed:
Set API Key
Deploy a Simple Agent API
Create a file named simple-api.py
with the following code:
Run the API Server
Your API will be available at http://localhost:3030/ask
Once your agent is deployed, you can make POST requests to interact with it:
The response will be in JSON format:
You can deploy multiple agents on the same server, each with its own endpoint:
With this setup, you can access:
http://localhost:3030/weather
http://localhost:3030/stock
http://localhost:3030/travel
For production environments, consider the following deployment options:
Create a Dockerfile
Create requirements.txt
Build and Run Docker Container
Create an EC2 Instance
Launch an EC2 instance with Ubuntu or Amazon Linux.
Install Dependencies
Configure Security Group
Make sure to open port 3030 in your security group settings.
Run with Systemd
Create a systemd service file for automatic startup and management.
Build Docker Image
Push to Container Registry
Deploy to Cloud Run
When launching your agent as an API, you can customize various parameters:
For production deployments, consider implementing:
For production environments, consider:
Deploy your agents as standard RESTful APIs for easy integration.
Deploy multiple agents with different endpoints on the same server.
Configure ports, paths, CORS settings, and more.
Easily deploy to Docker, AWS, Google Cloud, or other cloud platforms.
Learn how to deploy PraisonAI agents as RESTful APIs for production environments
PraisonAI agents can be easily deployed as RESTful APIs, allowing you to integrate them into various applications and services. This guide covers how to deploy both single and multiple agents as APIs.
Install Dependencies
Make sure you have the required packages installed:
Set API Key
Deploy a Simple Agent API
Create a file named simple-api.py
with the following code:
Run the API Server
Your API will be available at http://localhost:3030/ask
Once your agent is deployed, you can make POST requests to interact with it:
The response will be in JSON format:
You can deploy multiple agents on the same server, each with its own endpoint:
With this setup, you can access:
http://localhost:3030/weather
http://localhost:3030/stock
http://localhost:3030/travel
For production environments, consider the following deployment options:
Create a Dockerfile
Create requirements.txt
Build and Run Docker Container
Create an EC2 Instance
Launch an EC2 instance with Ubuntu or Amazon Linux.
Install Dependencies
Configure Security Group
Make sure to open port 3030 in your security group settings.
Run with Systemd
Create a systemd service file for automatic startup and management.
Build Docker Image
Push to Container Registry
Deploy to Cloud Run
When launching your agent as an API, you can customize various parameters:
For production deployments, consider implementing:
For production environments, consider:
Deploy your agents as standard RESTful APIs for easy integration.
Deploy multiple agents with different endpoints on the same server.
Configure ports, paths, CORS settings, and more.
Easily deploy to Docker, AWS, Google Cloud, or other cloud platforms.