Skip to main content
Deploy a unified server that combines all PraisonAI provider types in a single endpoint.

CLI

pip install "praisonai[serve]"
export OPENAI_API_KEY="your-key"

# Start unified server
praisonai serve unified --port 8765
Expected Output:
🚀 Starting Unified PraisonAI Server...
   Host: 127.0.0.1
   Port: 8765
   Providers: agents-api, recipe, mcp, a2a, a2u
📡 Discovery: http://127.0.0.1:8765/__praisonai__/discovery
✅ Server started at http://127.0.0.1:8765

Python

from fastapi import FastAPI
import uvicorn
from praisonaiagents import Agent

app = FastAPI(title="PraisonAI Unified Server")

# Create agents
assistant = Agent(
    name="Assistant",
    role="Helpful AI Assistant",
    goal="Help users with their questions",
    llm="gpt-4o-mini"
)

# Discovery endpoint
@app.get("/__praisonai__/discovery")
async def discovery():
    return {
        "schema_version": "1.0.0",
        "server_name": "praisonai-unified",
        "providers": [
            {"type": "agents-api", "name": "Agents API"},
            {"type": "recipe", "name": "Recipe Runner"},
            {"type": "mcp", "name": "MCP Server"},
            {"type": "a2a", "name": "A2A Protocol"},
            {"type": "a2u", "name": "A2U Event Stream"},
        ],
        "endpoints": [
            {"name": "agents", "provider_type": "agents-api"},
            {"name": "agent", "provider_type": "agents-api"},
            {"name": "mcp/tools", "provider_type": "mcp"},
            {"name": "a2a", "provider_type": "a2a"},
            {"name": "a2u/events", "provider_type": "a2u"},
        ]
    }

# Health endpoint
@app.get("/health")
async def health():
    return {"status": "healthy", "providers": 5}

# Agent endpoint
@app.post("/agent")
async def query_agent(request: dict):
    query = request.get("query", "")
    response = assistant.chat(query)
    return {"response": response}

uvicorn.run(app, host="0.0.0.0", port=8765)

Unified Endpoints

EndpointMethodProviderDescription
/__praisonai__/discoveryGET-Discovery document
/healthGET-Health check
/agentsPOSTagents-apiMulti-agent router
/agentPOSTagents-apiSingle agent
/mcp/toolsGETmcpList MCP tools
/mcp/tools/callPOSTmcpCall MCP tool
/.well-known/agent.jsonGETa2aA2A agent card
/a2aPOSTa2aA2A messages
/a2u/infoGETa2uA2U info
/a2u/events/<stream>GETa2uA2U event stream

Discovery Document

curl http://localhost:8765/__praisonai__/discovery
Response:
{
  "schema_version": "1.0.0",
  "server_name": "praisonai-unified",
  "providers": [
    {"type": "agents-api", "name": "Agents API", "capabilities": ["invoke", "health"]},
    {"type": "recipe", "name": "Recipe Runner", "capabilities": ["list", "describe", "invoke"]},
    {"type": "mcp", "name": "MCP Server", "capabilities": ["list-tools", "call-tool"]},
    {"type": "a2a", "name": "A2A Protocol", "capabilities": ["agent-card", "message-send"]},
    {"type": "a2u", "name": "A2U Event Stream", "capabilities": ["subscribe", "stream"]}
  ],
  "endpoints": [...]
}

Client Usage

Use the unified endpoints CLI to interact with any provider:
# List all endpoints
praisonai endpoints list --url http://localhost:8765

# Filter by provider type
praisonai endpoints list --url http://localhost:8765 --type agents-api

# Get discovery document
praisonai endpoints discovery --url http://localhost:8765

# Health check
praisonai endpoints health --url http://localhost:8765

CLI Options

OptionDefaultDescription
--port8765Server port
--host127.0.0.1Server host
--api-key-API key for authentication
--fileagents.yamlAgents configuration file

Provider Types

TypeDescription
recipeRecipe runner endpoints
agents-apiSingle/multi-agent HTTP API
mcpMCP server (stdio, http, sse)
tools-mcpTools exposed as MCP server
a2aAgent-to-agent protocol
a2uAgent-to-user event stream

Troubleshooting

IssueFix
Port in uselsof -i :8765
Missing depspip install "praisonai[serve]"
No API keyexport OPENAI_API_KEY="your-key"
Provider not foundCheck discovery document