Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.praison.ai/llms.txt

Use this file to discover all available pages before exploring further.

Deploy single or multi-agent systems as HTTP REST API servers.

Quick Start

1

Install Dependencies

pip install "praisonaiagents[os]"
2

Set API Key

export OPENAI_API_KEY="your-key"
3

Initialize Agents

praisonai --init "helpful assistant"
4

Start Server

praisonai serve agents --port 8000 --host 0.0.0.0
Expected Output:
πŸ“„ Loading workflow from: agents.yaml
πŸš€ Starting PraisonAI API server...
   Host: 0.0.0.0
   Port: 8000
πŸš€ Multi-Agent HTTP API available at http://0.0.0.0:8000/agents
βœ… FastAPI server started at http://0.0.0.0:8000
πŸ“š API documentation available at http://0.0.0.0:8000/docs
5

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, host="0.0.0.0")
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

Python - Multi-Agent

from praisonaiagents import Agent, AgentTeam

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

agents = AgentTeam(agents=[researcher, writer])
agents.launch(path="/content", port=8000, host="0.0.0.0")
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
Multiple Agent / Agents instances may call .launch(port=N) concurrently from different threads β€” registration is atomic. If two launch calls use the same path on the same port, the second gets an auto-suffixed path (/path_abc123) and a warning is logged. Server readiness is signalled deterministically (no fixed sleep); .launch() returns only after the port is accepting connections. The wait defaults to 5 seconds and is configurable via the PRAISONAI_SERVER_READY_TIMEOUT environment variable. If the server doesn’t become ready in time, .launch() still returns and a warning is logged β€” check server logs for startup errors.

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
praisonai serve agents --port 8000 --host 0.0.0.0

CLI Commands

# Start agents server
praisonai serve agents --port 8000

# With custom host for remote access
praisonai serve agents --port 8000 --host 0.0.0.0

# With agents file
praisonai serve agents --file agents.yaml --port 8000

# Give the server more time on slow machines
export PRAISONAI_SERVER_READY_TIMEOUT=15
praisonai serve agents --port 8000
OptionDefaultDescription
--port8000Server port
--host127.0.0.1Server host (use 0.0.0.0 for remote)
--fileagents.yamlAgents YAML file
--reloadfalseEnable hot reload
--api-key-API key for authentication

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

Example Request/Response

Request:
curl -X POST http://localhost:8000/ask \
  -H "Content-Type: application/json" \
  -d '{"query": "What is AI?"}'
Response:
{
  "response": "Artificial intelligence (AI) refers to..."
}

Remote Access

Use host="0.0.0.0" to allow remote connections:
# CLI
praisonai serve agents --port 8000 --host 0.0.0.0

# Python
agent.launch(path="/ask", port=8000, host="0.0.0.0")
Connect from remote:
curl -X POST http://SERVER_IP:8000/ask \
  -H "Content-Type: application/json" \
  -d '{"query": "Hello"}'

Environment Variables

VariableDefaultDescription
PRAISONAI_SERVER_READY_TIMEOUT5.0Seconds to wait for the FastAPI server to become ready after .launch() / praisonai serve agents. A warning is logged if exceeded; startup continues.

Troubleshooting

IssueFix
Port in uselsof -i :8000 then kill process
No agents.yamlpraisonai --init "topic"
Missing API keyexport OPENAI_API_KEY="your-key"
Missing depspip install "praisonaiagents[os]"
Connection refusedUse host="0.0.0.0" for remote
Firewall blockingOpen port in firewall
Agent server slow to start / β€œdid not become ready” warningSet PRAISONAI_SERVER_READY_TIMEOUT=10 (seconds) before launching, or check server logs for the underlying startup error.