Skip to main content
Deploy agents as HTTP REST APIs with one command.

CLI

pip install "praisonaiagents[api]"
export OPENAI_API_KEY="your-key"

python -m praisonai --init "helpful assistant"
python -m praisonai --serve --port 8000
Expected Output:
📄 Loading workflow from: agents.yaml
🚀 Starting PraisonAI API server...
   Host: 127.0.0.1
   Port: 8000
🚀 Multi-Agent HTTP API available at http://127.0.0.1:8000/agents
✅ FastAPI server started at http://127.0.0.1:8000
📚 API documentation available at http://127.0.0.1:8000/docs
Verify:
curl http://localhost:8000/health

Python - Single Agent

from praisonaiagents import Agent

agent = Agent(
    name="Assistant",
    instructions="You are a helpful assistant.",
    llm="gpt-4o-mini"
)
agent.launch(path="/ask", port=8000)
Expected Output:
🚀 Agent 'Assistant' available at http://0.0.0.0:8000
✅ FastAPI server started at http://0.0.0.0:8000
📚 API documentation available at http://0.0.0.0:8000/docs
🔌 Available endpoints: /ask
Verify:
curl -X POST http://localhost:8000/ask \
  -H "Content-Type: application/json" \
  -d '{"query": "Hello"}'

Python - Multi-Agent

from praisonaiagents import Agent, Agents

researcher = Agent(name="Researcher", instructions="Research topics", llm="gpt-4o-mini")
writer = Agent(name="Writer", instructions="Write content", llm="gpt-4o-mini")

agents = Agents(agents=[researcher, writer])
agents.launch(path="/content", port=8000)
Expected Output:
🚀 Multi-Agent HTTP API available at http://0.0.0.0:8000/content
📊 Available agents for this endpoint (2): Researcher, Writer
🔗 Per-agent endpoints: /content/researcher, /content/writer
✅ FastAPI server started at http://0.0.0.0:8000
📚 API documentation available at http://0.0.0.0:8000/docs

agents.yaml

framework: praisonai
topic: research and write content
roles:
  researcher:
    role: Researcher
    goal: Research topics thoroughly
    backstory: Expert researcher
    tasks:
      research_task:
        description: Research the topic
        expected_output: Research findings
  writer:
    role: Writer
    goal: Write engaging content
    backstory: Expert writer
    tasks:
      write_task:
        description: Write based on research
        expected_output: Written content
python -m praisonai --serve --port 8000

CLI Flags

FlagDefaultDescription
--serve-Start API server
--port8005Server port
--host127.0.0.1Server host

launch() Parameters

ParameterTypeDefaultDescription
pathstr/API endpoint path
portint8000Server port
hoststr0.0.0.0Server host
debugboolFalseDebug mode
protocolstrhttphttp or mcp

Endpoints

EndpointMethodDescription
/{path}POSTSend query to agent(s)
/{path}/listGETList available agents
/{path}/{agent_id}POSTCall specific agent
/healthGETHealth check
/docsGETSwagger UI

Troubleshooting

IssueFix
Port in uselsof -i :8000 then kill process
No agents.yamlpython -m praisonai --init "topic"
Missing API keyexport OPENAI_API_KEY="your-key"
Missing depspip install "praisonaiagents[api]"