Skip to main content
Deploy your agents using Docker containers.
from praisonaiagents import Agent

agent = Agent(
    name="API Worker",
    instructions="Answer HTTP requests in a containerised deployment.",
)

agent.start("Health check: confirm the service is ready.")
The user builds a Docker image, runs the container, and reaches the agent through the exposed port.

Quick Start

1

Simple Usage

Define an agent that answers requests inside the container.
from praisonaiagents import Agent

agent = Agent(name="Worker", instructions="Answer HTTP requests.")
agent.start("Health check.")
2

With Configuration

Add a Dockerfile that installs the SDK and exposes the serving port.
FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install "praisonaiagents>=0.1.0"
EXPOSE 8000
CMD ["python", "main.py"]

How It Works


Dockerfile

FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8000

CMD ["python", "main.py"]

requirements.txt

praisonaiagents>=0.1.0

main.py

from praisonaiagents import Agent

agent = Agent(
    name="Production Agent",
    instructions="You are a helpful assistant."
)

if __name__ == "__main__":
    agent.launch(host="0.0.0.0", port=8000, path="/agent")

Build and Run

# Build
docker build -t my-agent .

# Run
docker run -p 8000:8000 \
  -e OPENAI_API_KEY=$OPENAI_API_KEY \
  my-agent

Docker Compose

version: '3.8'

services:
  agent:
    build: .
    ports:
      - "8000:8000"
    environment:
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - DATABASE_URL=postgresql://postgres:postgres@db:5432/praisonai
    depends_on:
      - db

  db:
    image: postgres:15
    environment:
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=praisonai
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:

Run with Compose

docker-compose up -d

Best Practices

Never bake API keys into the image. Set OPENAI_API_KEY at run time with -e OPENAI_API_KEY=$OPENAI_API_KEY so the same image runs across environments.
Use python:3.11-slim and a pinned praisonaiagents>=0.1.0 in requirements.txt for reproducible builds that survive upstream releases.
agent.launch(host="0.0.0.0", port=8000, path="/agent") makes the agent reachable from outside the container. Map it with -p 8000:8000.
When the agent needs a database, define both services in docker-compose.yml and connect via DATABASE_URL so persistence survives container restarts.

Deployment Overview

All deployment options

Deploy Module

Deploy API reference