Skip to main content
GET
http://127.0.0.1:8005
/
api
/
v1
/
runs
/
{job_id}
/
result
curl http://127.0.0.1:8005/api/v1/runs/run_abc123/result
{
  "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"
}
Retrieve the result of a completed async job. Only available when job status is succeeded.
job_id
string
required
The unique job identifier (e.g., run_abc123).

Response

job_id
string
required
Unique job identifier.
status
string
required
Job status (should be succeeded for results to be available).
result
string
required
The output/result from the agent execution.
duration_seconds
number
required
Total execution time in seconds.
created_at
string
required
ISO 8601 timestamp of job creation.
completed_at
string
required
ISO 8601 timestamp of job completion.
curl http://127.0.0.1:8005/api/v1/runs/run_abc123/result
{
  "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"
}

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

StatusDescription
400Job not complete or failed
404Job not found
500Internal server error

See Also