Trace workflows, not just calls.
The Python and TypeScript SDKs build on the OpenAI and Anthropic clients. Wrap a run, its steps and tools, and Worksi sees the whole workflow, with approvals, outcomes and operator controls.
AIW is the prefix for Worksi keys, headers and packages.
SDK packages are distributed by Worksi. Request access. Any OpenAI or Anthropic SDK works with the gateway without them.
from aiworkforce import AIW # reads AIW_API_KEY and AIW_BASE_URLaiw = AIW(service="support-bot")# the OpenAI client, through the gatewayclient = aiw.openai() with aiw.run("customer-chat", agent="support-bot") as run: with aiw.step("classify"): client.chat.completions.create( model="gpt-5-mini", messages=history, ) # tool_call span with aiw.args_hash with aiw.tool( "lookup_order", args={"order_id": order_id}, data_source="orders-db", ) as t: t.set_result(orders_db[order_id]) # raises if the agent was paused aiw.check_status() run.outcome("ticket_resolved")import { AIW } from "@aiworkforce/sdk" // reads AIW_API_KEY and AIW_BASE_URLconst aiw = new AIW({ service: "support-bot",})const openai = aiw.openai() await aiw.run( { workflow: "customer-chat" }, async (run) => { await aiw.step("classify", () => openai.chat.completions.create({ model: "gpt-5-mini", messages, }), ) // tool_call span with aiw.args_hash await aiw.tool( "lookup_order", { orderId }, () => ordersDb.get(orderId), { dataSource: "orders-db" }, ) await aiw.checkStatus() run.outcome("ticket_resolved") },)What an agent needs in production.
Runs, steps and tools become spans, and the controls your operators use reach the code that runs the agent.
- Runs, steps, tools
- Nested spans for each run, agent step and tool call, with argument hashes for loop detection.
- Outcomes
- Record what a run achieved (resolved, qualified, converted) and ROI counts it.
- Approvals
- Wait for a person’s decision before a risky step, recorded as an approval span.
- Pause and stop
- Operator decisions reach your code as typed errors: a paused agent, a stopped run.
- Tool policies
- Tool allowlists and approval rules are checked before a tool runs, cached and fail‑open.
- Typed errors
- Gateway refusals become exceptions you can catch: budget, model, rate limit, end‑user quota.
- Direct mode
- Keep calling OpenAI directly and still record every model call as a span.
- Safe export
- Background export with bounded queues and retries. Telemetry never raises into your code.
Ask a person before the risky part.
require_approval() creates the approval, waits for the decision and records it. Once granted for a tool, it covers that tool for the rest of the run.
SDK packages are distributed by Worksi. Request access. Any OpenAI or Anthropic SDK works with the gateway without them.
from aiworkforce import ApprovalRejectedError try: aiw.require_approval( type="tool_call", title="Refund $250 for order A-1", risk="high", tool="issue_refund", payload={"order_id": "A-1", "amount_usd": 250}, timeout=300, )except ApprovalRejectedError: # a person said no: tell the customer, do not refund raise with aiw.tool( "issue_refund", args={"order_id": "A-1", "amount_usd": 250},) as t: # already approved for this run t.set_result({"refund_id": "R-1001"})The shape of a traced run.
The SDK emits the run, step and tool spans. The gateway adds a model call under the current step for every request made through the SDK’s OpenAI or Anthropic client.
- workflow_run
aiw.run()- agent_step
aiw.step()- tool_call
aiw.tool()- llm_call
aiw.openai()oraiw.anthropic(), recorded by the gateway- human_action
aiw.require_approval()- retrieval
aiw.span(…, kind="retrieval")
- workflow_runsupport-ticket-resolutionone run, one trace
one run, one trace
- agent_steptriagetriage-agent
triage-agent
- llm_callgpt-5-minichat.completions · tokens, cost, latency
chat.completions · tokens, cost, latency
- agent_stepresearchresolver-agent
resolver-agent
- llm_callembeddingstext-embedding-3-small · tokens, cost
text-embedding-3-small · tokens, cost
- tool_callsearch_kbkb-vector-store
kb-vector-store
- tool_calllookup_orderorders-db · args hash
orders-db · args hash
- agent_steprefundrefund-agent
refund-agent
- llm_callgpt-5-nanochat.completions · refund eligibility
chat.completions · refund eligibility
- tool_callissue_refundpayments-api
payments-api
- agent_stepdraft_replyresolver-agent
resolver-agent
- llm_callgpt-5chat.completions · reply draft
chat.completions · reply draft
- agent_stepnotifyresolver-agent
resolver-agent
- tool_callsend_emailthe reply to the customer
the reply to the customer
Supported runtimes.
Each SDK wraps the official OpenAI client for its language. The Anthropic SDK is optional.
| SDK | Package | Requires |
|---|---|---|
| Python | aiworkforce | Python 3.10+, openai 1.40+, httpx 0.27+; anthropic 0.40+ for aiw.anthropic(). Fully typed. |
| TypeScript | @aiworkforce/sdk | Node.js 18.18+, openai v4.77 to v7; @anthropic-ai/sdk 0.x (from 0.50) for aiw.anthropic(). ESM and CommonJS. |
Getting the SDKs.
We distribute the SDK packages directly, not through a public package registry.
- Access
- Request access and we send them for your account.
- Without them
- Any OpenAI or Anthropic SDK works with the gateway, and MCP and OpenTelemetry need no Worksi package at all.
- Docs
- Python SDK and TypeScript SDK references.
Wrap your first run.
A run, a step and an outcome around code you already have. The gateway records the model call inside.
- 3‑day trial with Pro features, no card.
Keep readingAI agentsMCPObservability
SDK packages are distributed by Worksi. Request access. Any OpenAI or Anthropic SDK works with the gateway without them.
from aiworkforce import AIW # reads AIW_API_KEY and AIW_BASE_URLaiw = AIW(service="support-bot")client = aiw.openai() with aiw.run("customer-chat", agent="support-bot") as run: with aiw.step("classify"): client.chat.completions.create( model="gpt-5-mini", messages=history, ) run.outcome("ticket_resolved", success=True)