Skip to main content
The Python SDK currently monitors runs via polling, not server-push streaming.

Default behavior (wait=True)

run = client.runs.create(
    recipe_id="01JEXAMPLE00000000000000000",
    timeout=300,
    poll_interval=0.5,
    max_poll_interval=5.0,
)
With wait=True (default), the SDK polls until terminal status.

Manual polling (wait=False)

import time

run = client.runs.create(recipe_id="01JEXAMPLE00000000000000000", wait=False)

while True:
    run = client.runs.get(run["id"])
    print(run["status"])

    if run["status"] in ("done", "failed", "cancelled", "blocked"):
        break

    time.sleep(2)

wait() later

run = client.runs.create(recipe_id="01JEXAMPLE00000000000000000", wait=False)
# do other work...
run = client.runs.wait(run["id"], timeout=600)

Timeout behavior

If timeout is exceeded, SDK raises StewAITimeoutError. A timeout does not cancel the run server-side.

Rate-limit behavior

During polling, if the API returns 429 with Retry-After, the SDK waits that duration and continues polling.

Parallel runs pattern

run_ids = []
for topic in ["AI", "Robotics", "Biotech"]:
    run = client.runs.create(
        recipe_id="01JEXAMPLE00000000000000000",
        inputs={"topic": topic},
        wait=False,
    )
    run_ids.append(run["id"])

results = [client.runs.wait(run_id, timeout=600) for run_id in run_ids]

See also