Skip to main content
POST
http://127.0.0.1:8765
/
agui
Deploy API: AGUI Server
curl --request POST \
  --url http://127.0.0.1:8765/agui \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "threadId": "<string>",
  "runId": "<string>",
  "state.messages": [
    {}
  ]
}
'

AGUI API

AG-UI protocol endpoints for agents deployed via AGUI(agent).get_router(). Compatible with CopilotKit.

Base URL + Playground

# Start AGUI server
from praisonaiagents import Agent
from praisonaiagents.agui import AGUI
import uvicorn

agent = Agent(instructions="You are a helpful assistant")
app = AGUI(agent).get_router()
uvicorn.run(app, host="0.0.0.0", port=8000)
Base URL: http://localhost:8000

Endpoints

POST /agui

Run agent with Server-Sent Events streaming.
threadId
string
required
Thread identifier
runId
string
required
Run identifier
state.messages
array
required
Conversation messages array
curl -X POST http://localhost:8000/agui \
  -H "Content-Type: application/json" \
  -d '{
    "threadId": "thread-123",
    "runId": "run-456",
    "state": {
      "messages": [
        {"id": "msg-1", "role": "user", "content": "Hello!"}
      ]
    }
  }'
Response (SSE Stream):
event: run_started
data: {"type": "run_started", "threadId": "thread-123", "runId": "run-456"}

event: text_message_start
data: {"type": "text_message_start", "messageId": "msg-2"}

event: text_message_content
data: {"type": "text_message_content", "messageId": "msg-2", "delta": "Hello"}

event: text_message_content
data: {"type": "text_message_content", "messageId": "msg-2", "delta": "! How can I help?"}

event: text_message_end
data: {"type": "text_message_end", "messageId": "msg-2"}

event: run_finished
data: {"type": "run_finished", "threadId": "thread-123", "runId": "run-456"}

GET /status

Check agent availability.
none
none
No parameters required.
curl http://localhost:8000/status
Response:
{
  "status": "available"
}

Event Types

EventDescription
run_startedAgent run has started
run_finishedAgent run completed
run_errorError occurred during run
text_message_startNew text message started
text_message_contentText content delta
text_message_endText message completed
tool_call_startTool call started
tool_call_argsTool call arguments
tool_call_endTool call completed

Message Format

Input Message:
{
  "id": "msg-1",
  "role": "user",
  "content": "Hello!"
}
FieldTypeDescription
idstringMessage ID
rolestring”user” or “assistant”
contentstringMessage content

Error Events

event: run_error
data: {"type": "run_error", "threadId": "thread-123", "runId": "run-456", "error": "Error message"}

CopilotKit Integration

import { CopilotKit } from "@copilotkit/react-core";

function App() {
  return (
    <CopilotKit runtimeUrl="http://localhost:8000/agui">
      <YourApp />
    </CopilotKit>
  );
}