InfraWeaveDocs

Quickstart

Define an agent, start a durable run, and watch it live in the console.

1. Install the SDK

pip install infraweave
export INFRAWEAVE_API_KEY=iw_live_…   # from Console → Secrets → API keys

2. Define an agent and a workflow

Agents are plain async functions; the decorator binds the model alias (not a hard-coded model id — routing stays a data change, never a deploy):

from infraweave import Workflow, agent

@agent("coder", model="tier-1-reasoning")
async def coder(ctx, task):
    return await ctx.llm.complete(task.prompt)

wf = Workflow("checkout-flow")
run = await wf.start(input={"task": "ship it"})
print(run.url)  # live trace in the console

3. Start a run over HTTP

Anything that can POST JSON can trigger a workflow:

curl -X POST "$INFRAWEAVE_API/v1/runs" \
  -H "Authorization: Bearer $INFRAWEAVE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: idem_9f2c41" \
  -d '{
    "workflow_id": "checkout-flow",
    "input": {"order_id": "ord_28843", "customer_tier": "enterprise"}
  }'
{
  "run_id": "run_8f31a2",
  "state": "running",
  "workflow_id": "checkout-flow",
  "workflow_version": "v2.4"
}

4. Watch it live

Open the run in the Console (the URL comes back on the run), or stream the event feed directly — it's standard server-sent events:

curl -N "$INFRAWEAVE_API/v1/runs/run_8f31a2/events" \
  -H "Authorization: Bearer $INFRAWEAVE_API_KEY"
event: node_started
data: {"run_id":"run_8f31a2","node":"planner","seq":3}

event: node_completed
data: {"run_id":"run_8f31a2","node":"planner","latency_ms":812,"tokens":3100,"seq":4}

Every node in the graph carries its own status, latency, tokens, and cost — click one in the console to open the trace inspector.

Next steps

On this page