Skip to content
WORKSI AI Control

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.

A traced workflow
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")

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.

approvals.py
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() or aiw.anthropic(), recorded by the gateway
human_action
aiw.require_approval()
retrieval
aiw.span(…, kind="retrieval")
support-ticket-resolution · spans recorded for one run
  • workflow_runsupport-ticket-resolution

    one run, one trace

    • agent_steptriage

      triage-agent

      • llm_callgpt-5-mini

        chat.completions · tokens, cost, latency

    • agent_stepresearch

      resolver-agent

      • llm_callembeddings

        text-embedding-3-small · tokens, cost

      • tool_callsearch_kb

        kb-vector-store

      • tool_calllookup_order

        orders-db · args hash

    • agent_steprefund

      refund-agent

      • llm_callgpt-5-nano

        chat.completions · refund eligibility

      • tool_callissue_refund

        payments-api

    • agent_stepdraft_reply

      resolver-agent

      • llm_callgpt-5

        chat.completions · reply draft

    • agent_stepnotify

      resolver-agent

      • tool_callsend_email

        the reply to the customer

Supported runtimes.

Each SDK wraps the official OpenAI client for its language. The Anthropic SDK is optional.

Supported runtimes
SDKPackageRequires
PythonaiworkforcePython 3.10+, openai 1.40+, httpx 0.27+; anthropic 0.40+ for aiw.anthropic(). Fully typed.
TypeScript@aiworkforce/sdkNode.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.

app.py
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)