Async Jobs API
HTTP API endpoints for submitting and managing long-running agent jobs
Submit long-running agent tasks and retrieve results asynchronously via HTTP API.
Quick Start
import httpx
API_URL = "http://127.0.0.1:8005"
# Submit job
response = httpx.post(f"{API_URL}/api/v1/runs", json={"prompt": "Analyze data"})
job = response.json()
job_id = job["job_id"]
# Check status
status = httpx.get(f"{API_URL}/api/v1/runs/{job_id}").json()
# Get result when complete
result = httpx.get(f"{API_URL}/api/v1/runs/{job_id}/result").json()
print(result["result"])Start Server
praisonai serve jobs --port 8005Or, using uvicorn directly (factory mode):
python -m uvicorn praisonai.jobs.server:create_app --port 8005 --factoryWorkflow
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Submit │────▶│ Poll/Stream│────▶│ Result │
│ Job │ │ Status │ │ or Cancel │
└─────────────┘ └─────────────┘ └─────────────┘
POST GET GET/POST
/api/v1/runs /api/v1/runs/{id} /api/v1/runs/{id}/result
/api/v1/runs/{id}/stream
/api/v1/runs/{id}/cancelEndpoints
Submit Run
POST /api/v1/runs – Submit a new job
List RunsGET /api/v1/runs – List all jobs
Get StatusGET /api/v1/runs/{job_id} – Get job status
Get ResultGET /api/v1/runs/{job_id}/result – Get job result
Stream ProgressGET /api/v1/runs/{job_id}/stream – SSE stream updates
Cancel RunPOST /api/v1/runs/{job_id}/cancel – Cancel a job
Delete RunDELETE /api/v1/runs/{job_id} – Delete a job
Health CheckGET /health – Server health status
Key Features
- Idempotency: Use
Idempotency-Keyheader to prevent duplicate job submissions - Webhooks: Receive callbacks when jobs complete via
webhook_url - Session Grouping: Group related jobs with
session_id - SSE Streaming: Real-time progress updates via Server-Sent Events
- Polling: Use
retry_afterfield for optimal polling intervals
Status Values
| Status | Description |
|---|---|
queued | Job waiting to start |
running | Job in progress |
succeeded | Job completed successfully |
failed | Job failed with error |
cancelled | Job was cancelled |
Authentication
The async jobs API does not require authentication by default. Configure authentication in your server deployment as needed.
CLI Usage
# Submit a job
praisonai run submit "Your prompt here"
# Check status
praisonai run status <job_id>
# Get result
praisonai run result <job_id>
# Stream progress
praisonai run stream <job_id>
# List jobs
praisonai run list
# Cancel job
praisonai run cancel <job_id>