Skip to main content
Agent run ingestion can run as background jobs. Use these methods to track their progress.

Get Job Status

from docent import Docent

client = Docent()

status = client.get_agent_run_job_status("my-collection-id", "job-123")
print(f"Status: {status['status']}")
print(f"Type: {status['type']}")

Parameters

collection_id
str
required
ID of the collection.
job_id
str
required
ID of the job to check.

Returns

status
dict
Job status information.

Batch Status Check

Check multiple jobs at once (up to 100).
statuses = client.get_agent_run_job_statuses(
    "my-collection-id",
    ["job-1", "job-2", "job-3"],
)
for s in statuses:
    print(f"{s['job_id']}: {s['status']}")

Parameters

collection_id
str
required
ID of the collection.
job_ids
list[str]
required
List of job IDs to check. Maximum 100.

Returns

statuses
list[dict]
List of job status dictionaries (same shape as single status above).

Errors

  • ValueError — More than 100 job IDs provided

Example: Poll Until Complete

import time

def wait_for_jobs(client, collection_id, job_ids, poll_interval=2.0):
    pending = set(job_ids)
    while pending:
        statuses = client.get_agent_run_job_statuses(collection_id, list(pending))
        for s in statuses:
            if s["status"] in ("completed", "canceled", "cancelling"):
                pending.discard(s["job_id"])
                print(f"Job {s['job_id']}: {s['status']}")
        if pending:
            time.sleep(poll_interval)
    print("All jobs finished")
When using add_agent_runs with wait=True (the default), job polling is handled automatically. You only need manual polling when wait=False.