curl http://127.0.0.1:8005/api/v1/runs/run_abc123/result
import httpx
job_id = "run_abc123"
# Get result (only works if job succeeded)
response = httpx.get(f"http://127.0.0.1:8005/api/v1/runs/{job_id}/result")
if response.status_code == 200:
result = response.json()
print(f"Result: {result['result']}")
print(f"Duration: {result['duration_seconds']}s")
elif response.status_code == 404:
print("Job not found")
elif response.status_code == 400:
print("Job not yet complete or failed")
praisonai run result run_abc123
# JSON output
praisonai run result run_abc123 --json
{
"job_id": "run_abc123",
"status": "succeeded",
"result": "The quarterly sales data shows a 15% increase in Q4 compared to Q3. Key highlights:\n\n1. Product A: +20% growth\n2. Product B: +10% growth\n3. New customer acquisition: +25%\n\nRecommendation: Focus marketing efforts on Product A momentum.",
"duration_seconds": 45.23,
"created_at": "2025-01-01T00:00:00Z",
"completed_at": "2025-01-01T00:00:45Z"
}
{
"detail": "Job is still running. Current status: running"
}
{
"detail": "Job failed. No result available.",
"error": "Agent execution timeout"
}
{
"detail": "Job not found: run_abc123"
}
Async Jobs
Get Run Result API
Get the result of a completed async job
GET
/
api
/
v1
/
runs
/
{job_id}
/
result
curl http://127.0.0.1:8005/api/v1/runs/run_abc123/result
import httpx
job_id = "run_abc123"
# Get result (only works if job succeeded)
response = httpx.get(f"http://127.0.0.1:8005/api/v1/runs/{job_id}/result")
if response.status_code == 200:
result = response.json()
print(f"Result: {result['result']}")
print(f"Duration: {result['duration_seconds']}s")
elif response.status_code == 404:
print("Job not found")
elif response.status_code == 400:
print("Job not yet complete or failed")
praisonai run result run_abc123
# JSON output
praisonai run result run_abc123 --json
{
"job_id": "run_abc123",
"status": "succeeded",
"result": "The quarterly sales data shows a 15% increase in Q4 compared to Q3. Key highlights:\n\n1. Product A: +20% growth\n2. Product B: +10% growth\n3. New customer acquisition: +25%\n\nRecommendation: Focus marketing efforts on Product A momentum.",
"duration_seconds": 45.23,
"created_at": "2025-01-01T00:00:00Z",
"completed_at": "2025-01-01T00:00:45Z"
}
{
"detail": "Job is still running. Current status: running"
}
{
"detail": "Job failed. No result available.",
"error": "Agent execution timeout"
}
{
"detail": "Job not found: run_abc123"
}
Retrieve the result of a completed async job. Only available when job status is
succeeded.
string
required
The unique job identifier (e.g.,
run_abc123).Response
string
required
Unique job identifier.
string
required
Job status (should be
succeeded for results to be available).string
required
The output/result from the agent execution.
number
required
Total execution time in seconds.
string
required
ISO 8601 timestamp of job creation.
string
required
ISO 8601 timestamp of job completion.
curl http://127.0.0.1:8005/api/v1/runs/run_abc123/result
import httpx
job_id = "run_abc123"
# Get result (only works if job succeeded)
response = httpx.get(f"http://127.0.0.1:8005/api/v1/runs/{job_id}/result")
if response.status_code == 200:
result = response.json()
print(f"Result: {result['result']}")
print(f"Duration: {result['duration_seconds']}s")
elif response.status_code == 404:
print("Job not found")
elif response.status_code == 400:
print("Job not yet complete or failed")
praisonai run result run_abc123
# JSON output
praisonai run result run_abc123 --json
{
"job_id": "run_abc123",
"status": "succeeded",
"result": "The quarterly sales data shows a 15% increase in Q4 compared to Q3. Key highlights:\n\n1. Product A: +20% growth\n2. Product B: +10% growth\n3. New customer acquisition: +25%\n\nRecommendation: Focus marketing efforts on Product A momentum.",
"duration_seconds": 45.23,
"created_at": "2025-01-01T00:00:00Z",
"completed_at": "2025-01-01T00:00:45Z"
}
{
"detail": "Job is still running. Current status: running"
}
{
"detail": "Job failed. No result available.",
"error": "Agent execution timeout"
}
{
"detail": "Job not found: run_abc123"
}
Complete Workflow Example
import httpx
import time
API_URL = "http://127.0.0.1:8005"
def submit_and_get_result(prompt):
# Submit job
response = httpx.post(
f"{API_URL}/api/v1/runs",
json={"prompt": prompt}
)
job_id = response.json()["job_id"]
print(f"Submitted job: {job_id}")
# Wait for completion
while True:
status = httpx.get(f"{API_URL}/api/v1/runs/{job_id}").json()
if status["status"] == "succeeded":
# Get result
result = httpx.get(f"{API_URL}/api/v1/runs/{job_id}/result").json()
return result["result"]
elif status["status"] in ("failed", "cancelled"):
raise Exception(f"Job {status['status']}: {status.get('error', 'Unknown error')}")
time.sleep(status.get("retry_after", 2))
result = submit_and_get_result("What is 2+2?")
print(f"Result: {result}")
Error Responses
| Status | Description |
|---|---|
400 | Job not complete or failed |
404 | Job not found |
500 | Internal server error |
See Also
⌘I

