Durable agent workflows¶
AgentWorkflows uses Temporal to persist workflow history, schedule activities, retry failures, and wait for signals. The Python SDK sends every model and tool activity through the governed gateway. Provider credentials stay on the gateway; each worker uses one team's bound gateway key.
Try research → draft → approval → publish¶
Follow the Quickstart for a complete fake or real-cloud run with human approval and verified receipts. It includes Bash and Windows commands, SDK installation, scaffolding, and cleanup. The template gallery adds PR review, support triage, weekly reports, incident summaries and document Q&A, with instructions for running your edits.
approve --reject finishes without publishing. Approval expires after seven days.
The API records the reviewer as the authenticated key name or verified JWT subject.
A Temporal update accepts one decision for the waiting draft. Early or
conflicting decisions return 409 approval_not_waiting. Retrying the same identity's
decision is idempotent, including after a lost response. Run IDs identify exact executions.
The fake research draft deliberately falls back from OpenAI to Anthropic. Both tools are
local fixtures. make compose-smoke additionally kills and replaces the worker while
approval waits, then verifies that each completed model call ran once. See local evaluation.
Web console¶
After make compose-up, open http://127.0.0.1:8080/console:
- Sign in with
local-development-only(demo admin). Keep the local fake providers on Get started; the trial runs entirely on local fakes. - Choose Run workflow, select Research, enter a topic (or select Use the example), and select Start run. Optional inputs such as the model and budgets sit under More options. The run's detail page refreshes while the workflow is active.
- Open Approvals, read the draft, then Approve or Reject. Approval allows the configured publish tool to run; rejection finishes without publishing, so the console asks you to confirm it first.
- Open the run from Workflow runs. Model steps preview their answer; expand Prompt and response (model steps) or Arguments and result (tool steps) to read the captured content with redaction/truncation notes. Receipt and Step logs show provider/model, usage, cost, routing attempts, and fingerprints, separate from captured text.
- Open Costs for current-window team, provider, and workflow costs. Providers & budgets shows admins key presence and limits, with a copyable fragment and links for configuring real providers through the existing reviewed policy and gateway Secret deployment.
Use project, workflow, and status filters to find runs. Load more advances through older index pages, including pages with no matches. The approvals inbox walks every page of every available project. Lists show retained Temporal executions; direct inspection of an expired execution reports that the run is unavailable. Terminal Redis run records expire after 30 days by default, counted independently of reads.
Sign-in exchanges a team API key or signed JWT for a server-side Redis session. Reloading
restores the workspace; Sign out invalidates the session on every replica.
Switch account replaces the active session after verifying another credential.
The browser holds only an HttpOnly session cookie; the API key or JWT stays on the server.
When OIDC is configured, Sign in with your company account comes first; if the provider
declines or the account has no team mapping, the console explains why on the sign-in page.
Use demo-builder, demo-approver, demo-viewer, or demo-other-team to explore roles.
The gateway image includes the built console and serves it directly in production.
Compose enables it. For a standalone gateway Helm release, set
adminConsole.enabled=true; the umbrella chart uses inference-gateway.adminConsole.enabled=true.
Keep the existing team auth, Redis, workflow worker, TLS ingress, and Temporal settings.
The same gateway host serves /console/ and /v1/, so the console and API share one origin.
Run make compose-smoke for browser checks as well as gateway/worker recovery checks.
It requires Node.js 24/npm and installs Chromium on first use. To install browser libraries
on a Linux host, run cd src/inference-gateway/console && npm ci && npx playwright install --with-deps chromium.
CI installs those libraries before validation. Keyboard users can use Skip to content,
standard Tab/Enter navigation, and native disclosure controls. Tables scroll within their
panels on small screens.
Step logs show gateway event and routing records. Worker stdout lives in the worker logs, and the full workflow history lives in Temporal. Verify receipt hashes against the retained audit export and head anchors. Provider keys and the limits on Providers & budgets come from reviewed deployment configuration; the page shows whether each key is present.
Workflow forms and step content¶
Set inputSchema on a workflow in the SandboxPolicySet. GET /v1/workflow-policies
returns it to the console, which renders text fields, longer text areas, numbers,
checkboxes, enum selects, and string arrays with one item per line. Required fields come
first and the rest sit under More options; a string property named model becomes a
list of the workflow's allowed models. Workflows without a schema use the JSON input box.
Schemas use a flat draft 2020-12 subset: an object with
string, number, integer, boolean, or array-of-string properties, optional enum,
required, description, default, and examples. additionalProperties: false
rejects unknown fields.
The templates retain their nonempty text and budget checks with minLength, pattern,
minimum, maximum, and exclusiveMinimum constraints.
Defaults prefill the console; examples are hints. The gateway validates submitted input
exactly as sent, keeping its values and types as submitted. Invalid input returns HTTP 422 before
starting Temporal, with detail.reason: workflow_input_invalid and
detail.fields: [{field: "input.topic", message: "Field is required."}].
The Python @input_schema({...}) decorator and TypeScript withInputSchema(schema, workflow)
attach schema metadata to workflow code. Copy that schema into the reviewed workflow
policy; the gateway's policy is authoritative for workers. agentworkflows init includes
the declaration in workflow.py and writes input-schema.json for that purpose.
captureContent can be none, redacted, or full at the team level or on a workflow.
An explicit workflow setting overrides the team default, including none. Absent both,
capture is off. Compose's demo team defaults to redacted. Both SDKs' governed model and
tool activities capture automatically through the gateway, after admission and output
checks. redacted additionally applies the gateway's configured secret/PII and blocked-term
redactors to the stored text; full stores the admitted request and guarded result as-is.
Both modes apply DLP. Each input/output field stores up to CONTENT_MAX_BYTES
(default 16,384 UTF-8 bytes), after redaction.
Admins can change team and workflow capture modes in Team settings, with changes applied
live. Both SDKs expose set_content_capture / setContentCapture with a settings
revision. Changes affect future steps and preserve existing content TTLs; see
capture settings and spend alerts.
Run timeline steps expose content: {input, output, truncated: {input, output}, redaction}.
Input and output are text (structured values are JSON text); an unfinished/failed call can
have a null output. A retried step shows its latest captured attempt. Content is separate
from receipts and expires after CONTENT_RETENTION_SECONDS (default seven days).
Uncaptured or expired content is null with content_reason: capture_off or expired. The same team,
project, and role checks that protect run details protect content; all four read roles
can inspect it. See the retention runbook
for TTL migration and Temporal history handling.
Teams, projects, and roles¶
A team is the existing sandbox ID. Projects group and restrict run access. Operators
bootstrap team policies and an admin with SANDBOX_POLICY_PATH and API_KEY_RECORDS_PATH
or verified identity-provider claims. Admins then issue and revoke member keys live in
Members & keys, while the gateway keeps running.
Managed teams require authentication, SANDBOX_BUDGET_ENABLED=true,
SANDBOX_BUDGET_BACKEND=redis, and AUDIT_LOG_ENABLED=true; Compose sets these already.
| Role | Read runs/reports | Start, cancel, retry, call models | Approve/reject |
|---|---|---|---|
| admin | Yes | Yes | Yes |
| builder | Yes | Yes | No |
| approver | Yes | No | Yes |
| viewer | Yes | No | No |
The public Compose keys are local-development-only (admin), demo-builder,
demo-approver, demo-viewer, and demo-worker. Use randomly generated keys outside
the trial. Keep a bootstrap admin record and add a policy for each team:
# Entry under records in key-records.yaml; store only the random key's SHA-256 digest.
- name: alice
sha256: REPLACE_WITH_SHA256_OF_RANDOM_KEY
sandbox: research-team
role: admin
project: briefing # omit to grant this role across the team's projects
# Entry under spec.policies in the existing SandboxPolicySet.
- sandboxId: research-team
projects: [briefing, engineering]
providerCredentials:
openai: RESEARCH_OPENAI_KEY
anthropic: RESEARCH_ANTHROPIC_KEY
budgets:
estimatedTokenLimit: 200000
costLimitUsd: 25
# Copy reviewed tools/workflows from deploy/compose/sandbox-policy.yaml,
# then replace model IDs and allowedEgress with approved destinations.
providerCredentials names the gateway environment variables or Secret references that hold
the keys. Each route, including fallback and streaming, selects the bound team's provider key;
managed teams require a provider mapping for every route and fail closed otherwise.
agentworkflows team shows available projects and provider names while secrets stay on the
gateway. Project-bound credentials read and control their own project's runs. Identity comes
from a verified sandbox binding. Existing signed JWTs can supply role
and optional project claims with a nonempty sub; configure JWT_TENANT_CLAIM and control claim issuance.
The team run API uses sandbox-bound keys. Enabling projects requires roles on the
team's existing credentials. Team policies remain declarative; membership keys are managed
in the console, CLI, or team key API, and team admins can
register their own workflow types inside the policy's models, tools and limits.
Members and API keys¶
Admins can list, create, update, and revoke keys for their own team. Project-bound admins
manage keys in their own project. The console lists name, role, project, last use,
expiry, and revocation status. Creation displays the new aw_ key once, with a copy button;
save it securely before leaving the page. The store retains only its SHA-256 digest and
metadata, including creator and timestamps. Last use is written at most once per minute.
Every create, update, and revoke produces a hash-chained audit receipt.
Choose Edit next to an existing key to change its name, role, project or expiry.
Expiry in the editor is UTC; blank clears it, and a past date immediately disables
access. The edit control appears on active keys other than your currently signed-in key.
Errors keep your draft for review. SDK equivalents are
gateway.update_key(key_id, name="Build bot", role="builder", project="engineering", expires_at=None)
and gateway.updateKey(keyId, { name: 'Build bot', role: 'builder', project: 'engineering', expires_at: null }).
These edit access metadata and keep the existing secret unchanged and private.
agentworkflows keys list
agentworkflows keys create --name alice --role builder --project briefing
agentworkflows keys update KEY_ID --role viewer --expires-at 2027-01-01T00:00:00Z
agentworkflows keys revoke KEY_ID
GET/POST /v1/team/keys list/create; PATCH/DELETE /v1/team/keys/{key_id} update/revoke.
POST accepts name, role (default viewer), optional project, and optional expires_at.
PATCH accepts those same fields; null clears project or expiry. Expiry accepts epoch seconds
or an ISO-8601 timestamp with a timezone. DELETE retains a revoked record. Revocation,
expiry, and role changes apply on the next request on every replica, including key-backed
browser sessions. To prevent self-lockout, the key authenticating a request stays protected
from revocation or demotion by that request.
File-based bootstrap credentials remain managed through the existing configuration.
The managed store uses the existing budget Redis client and key prefix, with schema version 2; enable Redis persistence and back up this state along with the existing runs and budgets. Managed keys are always on. Existing flat hashes, key-record files, and JWT/JWKS automation continue to work alongside them. The flat allowlist and file are checked before the managed store, then JWT verification; a duplicate file record still enforces its binding and expiry even when its digest is also flat-listed.
Company sign-in (OIDC)¶
Set ADMIN_CONSOLE_ENABLED=true and SANDBOX_BUDGET_BACKEND=redis. Register an
authorization-code OIDC application with the exact gateway callback URL and configure:
OIDC_ISSUER=https://company.okta.com/oauth2/default
OIDC_CLIENT_ID=your-client-id
OIDC_CLIENT_SECRET=your-client-secret
OIDC_REDIRECT_URL=https://agents.example.com/v1/auth/callback
OIDC_SCOPES=openid profile email
OIDC_TEAM_CLAIM=team
OIDC_ROLE_CLAIM=role
OIDC_PROJECT_CLAIM=project
OIDC_DEFAULT_ROLE=viewer
Source the client secret from your deployment's secret store. Omit it for a registered
public client. The gateway discovers authorization, token, and JWKS endpoints from the
issuer; it supports client_secret_basic and client_secret_post for confidential clients.
OIDC turns on when its settings are present. OIDC_TEAM_CLAIM defaults to
JWT_TENANT_CLAIM; the role/project defaults are role/project. Claims are top-level
strings (group mapping below uses an array). The team must name an existing sandbox policy, and any project must belong to it.
A token without a role uses OIDC_DEFAULT_ROLE; an invalid supplied role is rejected.
Restrict membership claims to the identity provider's administrators.
In Helm, use auth.oidc for these settings and auth.oidc.existingSecret.name/key for
the client secret. adminConsole.cookieSecure defaults to true. The umbrella chart nests
these values under inference-gateway. Allow HTTPS egress to the provider's discovery,
token and JWKS endpoints in your existing network policy.
| Provider | Configuration |
|---|---|
| Okta | Use your authorization server's issuer, register the redirect URL, and emit team, role, and optional project in the ID token, including them for the requested scopes. |
| Microsoft Entra | Use the tenant-specific issuer https://login.microsoftonline.com/TENANT_UUID/v2.0, register a Web redirect, and map OIDC_TEAM_CLAIM=tid to a policy whose sandbox ID is that tenant UUID. Users without a role claim get viewer. For other roles, emit a single string custom claim (the role claim is a scalar string, unlike the roles array). |
Use issuer https://accounts.google.com and an OAuth web client with the exact redirect URL. Place an OIDC broker that emits controlled team, role and project claims in front of Google, or use team API-key sessions. Sandbox IDs come from those broker claims rather than the dotted hd domain. |
The flow uses PKCE S256, single-use state bound to the browser, and a nonce. ID tokens must pass signature, issuer, audience, expiry, issued-at, subject, nonce, and authorized-party checks. Tokens and the client secret stay on the server. Keep all replicas on the same Redis and auth configuration.
Sessions and approval receipts record a display name: the managed key's name, or the ID
token's name (else email) claim. The console shows it in the account card and on each
Approval step.
GET /v1/auth/config publicly describes available sign-in methods without secrets.
GET /v1/auth/login starts OIDC; GET /v1/auth/callback completes it.
POST /v1/auth/session with {"key":"..."} creates the same session from an API key
or existing JWT. GET /v1/auth/session restores it and returns the CSRF token;
POST /v1/auth/logout invalidates it. Browser sign-in is enabled by the console or OIDC
configuration and requires Redis. Sessions slide for 12 hours with an absolute seven-day
limit; pasted JWT and group-mapped OIDC sessions also stop at token expiry. OIDC claim changes take effect on
the next sign-in. Logout ends the gateway session; the provider manages its own login session.
Cookies are HttpOnly (session), Secure, and SameSite=Lax. The separate CSRF cookie must
match both the session's token and X-CSRF-Token on non-GET cookie-authenticated requests.
The console sends credentials and that header automatically. CSRF applies to cookie
authentication; Bearer and X-API-Key automation authenticate with their headers. Serve the
console and gateway on the same HTTPS origin.
For HTTP localhost only, set SESSION_COOKIE_SECURE=false; Compose already does so and
local-development-only continues to work. To try OIDC with the demo, connect an existing
provider using the settings above.
SSO group-to-role mapping¶
With the v0.9.0 gateway, map existing company groups to roles in place of a scalar role claim. Keep the OIDC setup above, then configure:
OIDC_GROUPS_CLAIM=groups
OIDC_GROUP_ROLE_MAPPINGS={"default":{"engineering-builders":"builder","engineering-reviewers":"approver","platform-admins":"admin"}}
The JSON object is keyed by the verified team claim (here default). Each team
maps exact group names or IDs to admin, builder, approver or viewer.
OIDC_GROUPS_CLAIM names one exact top-level ID-token claim, including names that
contain dots or URLs; the gateway reads it as a literal claim name. The claim must be an array of nonempty
strings. Group matching is exact: case-sensitive, untrimmed and literal, with each group
mapping to one role. Multiple groups mapping to the same role are allowed.
Any nonempty mapping object enables group mode for all OIDC sign-ins. The team
must have a mapping and the caller's groups must resolve to exactly one distinct
role. Sign-in is rejected when groups are absent, all unmatched, or mapped to conflicting
roles, even if the token also claims role: admin. In this mode the groups alone decide the
role. An empty object keeps the role-claim mode.
Team and optional project claims must still identify configured policies/projects;
group mapping assigns a role within the verified team and project.
Configure your provider to include the group array in the ID token for this client and request the provider's group scope if needed. Use the actual values it emits (for example, group IDs in place of display names). The gateway reads groups from the ID token only, so include the full array there. Identity-provider administrators must control these claims and group assignments.
Group membership is a sign-in snapshot. Sessions end at ID-token expiry (or the existing idle/absolute deadline, whichever comes first). Group removal at the provider takes effect on the next sign-in. Changing the affected team's mapping, claim settings, issuer or client invalidates its existing OIDC sessions on their next request. Enabling mappings also requires old browser JWT/OIDC sessions to sign in again. API-key sessions and direct bearer JWT authorization retain their existing rules. Roll out the same configuration to every gateway replica before testing access; Redis sessions store a hash of the group policy.
In Members & keys → Company sign-in, team admins can inspect the provider,
claim names, mappings and denial rules. GET /v1/team/sso returns the same typed
view; it requires a team admin credential without a project restriction and returns
only that team's mappings, with the client secret kept on the server. Configure mappings
through the deployment; the API view is read-only, and the public /v1/auth/config
response lists sign-in methods only. Both SDKs provide the
same inspection method.
For the umbrella chart, merge this into your existing OIDC values:
inference-gateway:
auth:
oidc:
groupsClaim: groups
groupRoleMappings:
default:
engineering-builders: builder
engineering-reviewers: approver
platform-admins: admin
Apply with the existing helm upgrade command in the install guide.
Use auth.oidc directly for the standalone gateway chart. Keep an operator's
team-admin API key available while configuring sign-in.
Acceptance: sign in as a builder-group member and verify the team/project and
builder controls; sign out and repeat for an approver. Confirm that unmapped users and users
in both differently mapped groups are rejected. Change a mapping and verify
the existing session requires sign-in, then verify the new role. Confirm
team_sso() / teamSSO() show only the current team's mapping.
Use one trusted worker per team with a bound builder key carrying workflows:execute.
Set TEMPORAL_TASK_QUEUE=research-team-workflows; the API selects that queue from the
verified team. The worker scope is reserved for worker keys. In Helm, set worker.team
and worker.existingSecret. Workers and Temporal operators are trusted: give direct
Temporal access and worker keys only to operators and workers.
Authenticated workflow API¶
The CLI uses these endpoints with Authorization: Bearer <team-key>:
| Method and path | Purpose |
|---|---|
GET /v1/team |
Discover role, projects, providers, and spend limit |
GET /v1/workflow-policies |
Discover approved workflow types, limits, capture mode, and input schemas |
POST /v1/workflow-runs |
Start with workflow, JSON input, optional project and UUID request_id |
GET /v1/workflow-runs?project=briefing&offset=0&limit=20&status=awaiting_approval |
Page through project runs; optional status and workflow filters |
GET /v1/workflow-runs/{run_id} |
Status, draft, budget, step timeline with receipt IDs; ?timeline=false returns status only |
POST /v1/workflow-runs/{run_id}/cancel |
Request cancellation of this exact execution; a finished run returns 409 workflow_not_cancellable |
POST /v1/workflow-runs/{run_id}/retry |
Start a fresh execution after failure/cancellation |
POST /v1/workflow-runs/{run_id}/approve |
Submit {"approved":true} or false |
GET /v1/usage |
Token/request window usage and monthly team/project spend by provider and workflow |
GET /v1/usage/export |
Current UTC month CSV, with total and provider/workflow rows, scoped to the credential |
curl -s http://127.0.0.1:8080/v1/workflow-runs \
-H 'Authorization: Bearer demo-builder' -H 'Content-Type: application/json' \
-d '{"workflow":"ResearchWorkflow","input":{"topic":"Evaluate team agents"},"project":"default"}'
agentworkflows runs cancel RUN_ID
agentworkflows runs retry FAILED_RUN_ID
agentworkflows usage
Retry accepts failed, canceled, terminated, or timed-out runs. It starts a new execution
and run budget; team spend is retained. Repeating retry on a failed run returns the same
replacement. Review side effects before retrying, since tools run again in the new execution.
Cancellation stops the run from its current step onward. runs list returns next_offset; pass it as --offset for the next page.
runs start defaults to ResearchWorkflow; use runs start YourWorkflow --input '<JSON>'
--project engineering for another registered workflow. Input is its single argument.
Supply a stable UUID request_id when retrying an ambiguous start. The CLI prints a retry
ID with start errors. Reusing that ID with different input returns a conflict.
PUT /v1/workflow-runs/{run_id} remains the worker's immutable budget initialization.
The Python GatewayClient exposes team, start_run, runs, run, cancel_run,
retry_run, and approve_run with the same semantics.
Custom workflows expose a status query returning stage for progress and, when they
support approvals, a review(approved, reviewer) update returning whether the waiting
decision was accepted. ApprovalWorkflow implements both for the research and code-review templates.
Triggers and notifications¶
Each console trigger has Run history. It opens retained
runs with their status, approval review, costs and receipts, filtered by workflow and
trigger name. The API/CLI/SDK filters and retention boundaries are documented in the
SDK reference.
This uses inference-gateway.workflowRecords.runRecordRetentionSeconds in Helm (30
days by default), with Redis or PostgreSQL, on the existing store and settings.
For monthly reporting, Costs → Export CSV uses GET /v1/usage/export and the
existing Redis accounting. Project-bound credentials export their own project.
Open Triggers in the console to see cron expressions, upcoming times, signed webhook endpoints and pause state. Admins and builders can pause/resume triggers in their projects; viewers and approvers can inspect them. Existing runs continue when a trigger is paused.
agentworkflows triggers list
agentworkflows triggers pause DailyReportWorkflow daily
agentworkflows triggers resume DailyReportWorkflow daily
Merge trigger definitions into each workflow in the existing SandboxPolicySet. Keep
its provider/model/tool/egress policy and budgets. For example:
workflows:
DailyReportWorkflow:
allowedProviders: [openai]
allowedModels: [demo-openai]
allowedEgress: [http://cloud-fake:8000]
triggers:
daily:
kind: cron
project: default
cron: "0 9 * * *"
input: {topic: Agent operations}
GitHubIssueTriageWorkflow:
allowedProviders: [openai]
allowedModels: [demo-openai]
allowedEgress: [http://cloud-fake:8000]
triggers:
github:
kind: webhook
project: engineering
webhookSecretEnv: TEAM_WEBHOOK_SECRET
notifications:
consoleUrl: https://agents.example.com/console/
slackWebhookEnv: TEAM_SLACK_WEBHOOK
webhookEnv: TEAM_OUTGOING_WEBHOOK
budgetThreshold: 0.8
smtp:
host: smtp.example.com
port: 587
startTls: true
usernameEnv: TEAM_SMTP_USERNAME
passwordEnv: TEAM_SMTP_PASSWORD
sender: workflows@example.com
recipients: [team@example.com]
Store secrets in the gateway environment/Secret deployment. Use a separate randomly
generated webhook secret of at least 32 characters for each team. Webhook destination
variables hold full HTTP(S) URLs; values and recipient addresses stay out of receipts.
Configure destinations your team is authorized to notify, and omit unused channels.
SMTP authentication uses TLS; the local fake uses unauthenticated plaintext SMTP for evaluation.
Set consoleUrl to the externally reachable console address, including any path prefix.
Notification links open the console, where recipients sign in normally.
Recreate the gateway after configuration changes. It reconciles
Temporal Schedules.
Expressions use UTC, overlap policy is SKIP, and the catch-up window is
five minutes. The SDK worker registers the scheduled-launch workflow; it keeps
the schedule action open until the target run ends, reading the run's status after 30 seconds
and then backing off to every five minutes, and continues as new when Temporal suggests it, so
a run that waits days for review never outgrows its schedule's history. It records only the
run's ID and status, never its content. Each launch goes through the same governed start API. Redis persists interactive pauses across restarts; paused: true in
configuration keeps a trigger paused, and only a configuration change by the admin resumes it.
Removing a cron trigger removes its managed schedule on the next reconciliation. Schedule
errors appear in the console; check Temporal and the gateway log for invalid expressions.
For an inbound webhook, POST the exact JSON bytes to the endpoint shown in Triggers.
Send X-AW-Timestamp (Unix seconds, within five minutes), X-AW-Delivery (a unique ID using
letters, digits, underscores or hyphens, up to 128 characters) and X-AW-Signature:
import hashlib, hmac, json, os, time, urllib.request, uuid
path = "/v1/hooks/demo/GitHubIssueTriageWorkflow/github"
body = json.dumps({"action": "opened", "issue": {
"number": 42, "title": "Sign-in regression", "body": "Please investigate."
}}).encode()
stamp, delivery = str(int(time.time())), str(uuid.uuid4())
signed = f"{stamp}.{delivery}.{path}.".encode() + body
signature = hmac.new(os.environ["TEAM_WEBHOOK_SECRET"].encode(), signed, hashlib.sha256).hexdigest()
request = urllib.request.Request("http://127.0.0.1:8080" + path, data=body, headers={
"Content-Type": "application/json", "X-AW-Timestamp": stamp,
"X-AW-Delivery": delivery, "X-AW-Signature": "sha256=" + signature,
})
print(urllib.request.urlopen(request).read().decode())
Compose uses the public fake value compose-webhook-secret-not-for-production for this
example. The original JSON becomes the workflow input and stays out of receipts.
For GitHub, configure the shown endpoint as the repository webhook URL, use JSON content,
select Issues events, and set its secret to the team's webhook secret. Native GitHub
X-Hub-Signature-256 plus X-GitHub-Delivery are also accepted. For GitHub signatures,
the gateway persists the signed body fingerprint across the team, so an accepted payload
is accepted once regardless of delivery ID or destination.
Identical GitHub payload bytes are treated as retries. The triage example needs only the
webhook secret.
Completed delivery IDs return 409 webhook_replayed for eight days; afterwards a resent
delivery returns its original run. Concurrent delivery and ambiguous
Temporal failures use the same deterministic run ID. After a 503, retry with the same
delivery ID/body and a fresh timestamp/signature. Each delivery ID accepts only its original input.
Keep Redis trigger state, run start intents and Temporal history together in backups;
the replay guarantee relies on that state. A paused trigger returns 409 trigger_paused.
Notifications cover console-managed runs: waiting approval, failure (including execution
timeout), and reaching the configured fraction of either the run token or USD limit.
The existing run monitor checks roughly every 30 seconds; SDK approval events are persisted
so every review is captured. Accounting includes conservative outstanding reservations.
Budget crossings are also persisted at reservation and settlement.
Have custom workflows inherit ApprovalWorkflow (or expose the existing status query).
Already-running histories remain replay-compatible via a Temporal patch marker.
Each channel has persistent per-run/event delivery state and a replica-safe lease. Attempts
retry up to five times with exponential backoff, alongside approval. Every attempt
and outcome appears in the run timeline; retrying or failed means inspect the destination
and gateway configuration. Successful deliveries are deduplicated across restarts. Delivery
is at least once. Outgoing webhooks carry a stable Idempotency-Key and JSON id for
receiver-side deduplication; SMTP uses a stable Message-ID. Notifications contain IDs, event
type and a console link; drafts, prompts and failure details stay in the console. Reviewers
approve in the console or API.
The Compose trial includes both workflows and notification-fake, a Slack/webhook sink
and SMTP catcher. View its inbox at http://127.0.0.1:8025/ (override the published port
with AGENTWORKFLOWS_INBOX_PORT). make compose-smoke backfills a daily schedule through
Temporal, posts a signed issue payload, checks pause/replay protection, exercises approval
and failure delivery to all three channels, and verifies the receipt chain. It runs entirely
on local fakes. Both examples return reviewed content to the run.
Operate the service¶
agentworkflows usage aggregates providers and tools for the bound team or project.
spend shows the UTC calendar month's limit and reserved-plus-spent USD, independently
of SANDBOX_BUDGET_WINDOW_SECONDS. Team admins can edit budgets, approval rules and
existing model alias selections in the console; see team settings.
Workflow cost rows accumulate from this version onward, in the same month as provider
costs. They count governed model and tool calls inside workflows.
Project-bound credentials see their own project's rows.
Token/request budgets retain their existing window semantics. Spend reservations are
atomic in the existing Redis, covering eligible fallbacks before a call. Managed-team
calls retry through the caller or Temporal so each attempt has a budget and receipt.
Unused fallback capacity is refunded; measured usage replaces the successful
attempt's reservation. Failed/unknown attempts remain conservatively charged. Configure
prices for every route, including local models; tools charge per attempt. Costs are
estimates based on configured prices.
Persist Redis with AOF and no eviction. Run metadata, timeline indices, and cost windows
survive gateway/worker restarts; back up Redis alongside Temporal PostgreSQL. Historical
cost keys remain available for operator export under ...:<team>:cost:month:<month-start>;
older fixed-window keys remain under ...:<team>:cost:<window-start>.
The API reports the current month. Retain run metadata/timeline keys with Temporal history
and audit evidence. Expired Temporal executions return 404; retained receipts remain in
the audit export. Run input is stored in Redis for retry, and inputs/drafts/results are in
Temporal; restrict access and retention for both stores.
GET /v1/workflow-runs returns next_cursor
alongside the legacy next_offset. Send that cursor with unchanged project,
workflow and status filters to continue toward older runs. Empty filtered pages
can have a continuation: limit bounds records scanned before filtering, keeping
Temporal calls bounded. Cursor order uses creation time and run ID, so pages stay stable
during concurrent starts and pruning. agentworkflows runs export --output runs.jsonl
and both SDKs follow these pages and export full retained run details. Retention and
status changes continue while exporting; if a run's details expire mid-export, the export
stops with an error, so rerun it for a complete file. See paging and export for limits.
The AgentWorkflows Team Operations Grafana dashboard sits beside existing dashboards
in deploy/observability/dashboards: throughput, failures, run states, approvals waiting,
and shared spend. State/spend gauges refresh every 30 seconds; queries use max across
replicas to avoid double counting. Alerts cover stalled throughput, failed runs, approvals
waiting 30 minutes, spend above 80%, and stale collection. The existing Kubernetes
observability deployment loads them.
The timeline is a convenience index of gateway receipts. The separately retained audit export and external head anchors are the authoritative record; verify against them. Hashes establish linkage within retained chains.
Write your workflow¶
Use Temporal's decorators and the SDK's call methods. Perform model, network, and tool I/O through the SDK call methods so replay stays deterministic.
from temporalio import workflow
from agentworkflows.workflows import Budget, WorkflowGateway
@workflow.defn
class Briefing:
@workflow.run
async def run(self, topic: str) -> str:
gateway = WorkflowGateway(Budget(token_limit=4000, cost_limit_usd=2.0))
sources = await gateway.tool("research", {"query": topic})
return await gateway.text(
f"Summarize with citations: {sources}",
model="demo-openai",
max_tokens=512,
)
Run it from a separate worker.py entry point (keep network I/O outside workflow modules):
from agentworkflows.worker import run_worker
from workflow import Briefing
if __name__ == "__main__":
run_worker([Briefing])
Set AGENTWORKFLOWS_TEAM=research-team, its worker gateway key, and the gateway/Temporal
addresses. Register Briefing (see Register your own workflow;
for example agentworkflows workflows register Briefing --model demo-openai --tool research),
then start with agentworkflows runs start Briefing --input '"your topic"' --project briefing.
Use ApprovalWorkflow and await self.approval(draft) for the standard reviewed-draft
flow. The template guide shows the complete code and how to replace a worker.
Native Temporal workers and GatewayActivities.call remain available for advanced agent
registrations. Cancel through agentworkflows runs cancel RUN_ID; cancellation stops the
run from its current step onward.
Defaults are five activity attempts with exponential backoff (1 second initially, capped
at 30 seconds), three minutes per attempt, and fifteen minutes including retries and queue
wait. Pass Temporal's RetryPolicy and timedelta values to WorkflowGateway when the
workload needs different timeouts. HTTP requests time out after 120 seconds. Policy, DLP,
and run-budget refusals are final; transient gateway failures honor Retry-After.
Approve tools and budgets¶
Add tools to the existing SandboxPolicySet, mounted through SANDBOX_POLICY_PATH (Helm:
sandboxPolicy.policy.policies). Only listed tools can run. Clients send a tool name and
JSON arguments; the administrator sets the destination URL:
apiVersion: platform.ai/v1alpha1
kind: SandboxPolicySet
spec:
policies:
- sandboxId: research-team
allowedModels: [approved-cloud-model]
tools:
research:
url: https://search.example.com/research
costUsd: 0.01
credentialEnv: SEARCH_TOOL_TOKEN
publish:
url: https://cms.example.com/briefings
costUsd: 0.02
credentialEnv: CMS_TOOL_TOKEN
Tool endpoints accept POST JSON and return JSON. credentialEnv names a gateway-side
environment variable forwarded as bearer authentication; Helm can inject its Secret via
providerCredentials. Tools receive a stable Idempotency-Key derived from team, Temporal
run ID, and activity ID. A tool with side effects must persist and honor this key.
URLs are fixed and redirects are refused. Input size, secret detection, output DLP, sandbox
budgets, and receipts use the existing gateway controls. A tool's dataClassification
defaults to internal; explicitly approve a higher classification only for eligible tools.
GET /v1/tools lists the caller's approved names.
For Kubernetes, permit tool destinations through the gateway's existing approved egress
policy or internal egress proxy, just as for cloud model endpoints.
Bring your agent¶
With the Compose stack running, run all four examples in its existing worker:
docker compose -f deploy/compose/compose.yaml run --rm --no-deps workflow-worker \
python -m agentworkflows.examples.frameworks "How should we evaluate team agents?"
The result includes the run ID and answers from plain OpenAI and Anthropic clients,
OpenAI Agents SDK, and LangGraph. The first agent calls team.search through MCP.
Open Temporal at http://localhost:8233 and inspect that run; use its ID with
GET /v1/workflow-runs/{run_id} for usage. make compose-smoke checks these calls,
policy refusals, DLP, and their receipts. The examples run on the local fakes.
For your own worker, install python -m pip install './sdk/python[frameworks]'.
Register your async agent function with the existing activity:
import os
from agentworkflows.activities import GatewayActivities
async def briefing(context, arguments):
sources = await context.tool("team.search", {"query": arguments["topic"]})
response = await context.openai().chat.completions.create(
model="demo-openai", max_tokens=128,
messages=[{"role": "user", "content": f"Summarize: {sources}"}],
)
return response.choices[0].message.content
activities = GatewayActivities(
"http://localhost:8080", os.environ["AGENTWORKFLOWS_API_KEY"], agents={"briefing": briefing},
)
# Register activities.call on your Temporal worker, as above.
# Inside your workflow:
# answer = await WorkflowGateway().agent("briefing", {"topic": topic})
context.openai() and context.anthropic() configure the official async clients with
the gateway URL, team authentication, and run/step headers, leaving retries to Temporal.
Use context.agents_model(model) with the Agents SDK's Agent and Runner.run;
set RunConfig(tracing_disabled=True) to keep prompts out of external tracing.
In LangGraph, use context.openai() in your graph nodes and graph.ainvoke(...).
The complete examples
show all four, including a governed Agents SDK function tool.
Each model/tool request gets its own step suffix and receipt. The activity result is durable once the agent function returns; recovery from a crash mid-loop reruns the whole agent loop as new calls. Break long loops into separate workflow steps for finer-grained recovery. Workflow steps use non-streaming Chat Completions or Anthropic Messages. The optional frameworks are pinned in the worker/test locks.
TypeScript workers register agents with runWorker(path, { agents }) and build clients with
new OpenAI(context.openaiOptions()) or new Anthropic(context.anthropicOptions()); see
framework agents.
Framework callbacks run as trusted worker code. Route every side-effecting tool through
context.tool so the gateway governs and records it.
Use container steps for code execution.
Keep external LangSmith tracing off for sensitive activity data.
MCP tools¶
Register a server once under the team's existing SandboxPolicySet entry:
sandboxId: research-team
mcpServers:
team:
url: https://tools.example.com/mcp
credentialEnv: TEAM_MCP_TOKEN
tools:
search: 0.01
publish: 0.02
The map explicitly approves remote tool names and their cost in USD per attempt. Clients
call await gateway.tool("team.search", {"query": topic}) in workflow code or
await context.tool(...) in an agent callback. GET /v1/tools discovers team tools;
add run/step headers to see only that workflow's allowed tools. Credentials and server URLs
come from policy. Add the server's origin to the workflow's allowedEgress.
The gateway negotiates MCP 2025-03-26 Streamable HTTP, initializes a session, invokes
tools/call, and closes the session. Both JSON and SSE responses are bounded by the gateway
body limit. The registered allowlist is authoritative, and tools run when workflow code
calls them. See the MCP transport specification.
Nested JSON arguments use the existing input size, blocked-term, and secret policies before
any server contact. Set PROMPT_SECRET_MODE=block (the Compose default) to prevent disclosure;
redact rewrites matching arguments. Output follows the existing output DLP policy. Denied,
successful, and failed calls receive run-linked tool receipts, with argument fingerprints
in place of raw arguments. MCP errors and isError results are recorded as failures.
Failed/ambiguous attempts retain their cost. For side effects, the server must
persist and honor Idempotency-Key.
Register your own workflow¶
A team admin can register a workflow type live, while the gateway keeps running. Open Templates → Your workflows in the console, or use the CLI, API or either SDK. Registration narrows what your operator already approved for the team:
| Setting | Rule |
|---|---|
| Name | The Temporal workflow type your worker registers: a letter, then letters, digits or underscores (64 maximum). Names defined in operator policy and the nine built-in template names are reserved. A team can register 50 workflows. |
| Models | Canonical model IDs the team may already use. Providers default to the providers serving those models. |
| Tools | Tool names already approved for the team. |
| Network egress | Derived automatically from the chosen models' routes and tools' URLs. |
| Limits | Tokens and dollars per run, up to the team's own limits. Teams without their own limits get ceilings of 5,000,000 tokens and $100; operator YAML can grant more. |
| Approval | The same controls as reviewed workflows: required or not, approver role, 1-10 distinct reviewers, 60 seconds to 7 days. |
| Input schema | Optional flat JSON Schema (the subset used by the templates). It validates every run input and renders the console run form. |
agentworkflows workflows list
agentworkflows workflows register TicketTriageWorkflow --model gpt-4.1-mini --tool team.search --cost-limit 2 --reviewers 1 --input-schema @ticket-schema.json
agentworkflows workflows register ReleaseWorkflow --model gpt-4.1-mini --approver-role admin --approval-timeout 2d
agentworkflows runs start TicketTriageWorkflow --input '{"ticket": "Password reset blocks sign-in."}'
agentworkflows workflows remove TicketTriageWorkflow
From Python, pass the @workflow.defn class; its name and @input_schema are used:
with GatewayClient(url, api_key=admin_key) as gateway:
gateway.register_workflow(TicketTriage, models=["gpt-4.1-mini"], allowed_tools=["team.search"], cost_limit_usd=2)
TypeScript uses registerWorkflow(nameOrFunction, models, options?, revision?), teamWorkflows() and
removeWorkflow(nameOrFunction, revision?); a workflow function declared with withInputSchema also
supplies its schema. The API is GET /v1/team/workflows (registrations, reserved
names, the models/tools you may choose, and your limits), PUT /v1/team/workflows/{name} and
DELETE /v1/team/workflows/{name}. Writes need the current If-Match revision, which is shared with
team settings and alert rules; a stale revision returns 409 and leaves everything unchanged. Repeating
an identical registration is idempotent. Invalid choices return 422 with the offending fields.
Registered workflows appear in GET /v1/workflow-policies and use the same admission, budget, approval
and receipt paths as YAML workflows, so their approval, limit and capture settings can also be tuned
under Team settings. Every registration and removal is a chained audit receipt. Removing a workflow
denies new calls from its existing runs and new starts; run history remains until retention expires it.
If the operator later defines the same name in policy, the reviewed policy wins.
Registration sets policy; your worker supplies the code. Run your worker on the team's task queue as shown in the
template guide, then register the same name. Triggers and container agents
come from operator policy. Operators who want every workflow type reviewed in YAML set
selfServiceWorkflows: false on the team's policy entry; the console then explains that
registration is managed by the operator, the API returns 403, and only operator-defined workflows apply.
Workflow policy¶
Define policy under the same team entry, keyed by the registered Temporal workflow type:
workflows:
Briefing:
allowedProviders: [openai, anthropic]
allowedModels: [approved-openai, approved-anthropic]
allowedTools: [team.search]
allowedEgress: [https://api.openai.com, https://api.anthropic.com, https://tools.example.com]
tokenLimit: 4000
costLimitUsd: 1
Use canonical gateway model IDs, provider names from the model catalog, and exact URL origins
(scheme, hostname, and optional port). An empty allowlist turns that capability off. The existing
team model/tool rules still apply. Every fallback must satisfy the
workflow's provider, model, and egress lists. Container direct egress goes to DNS
and the gateway only; allowedEgress governs the gateway's upstream model/tool connections.
GET /v1/workflow-policies shows the authenticated team's policies and approved container
agents. The SDK sends Temporal's workflow type when initializing the run. Once a team defines
workflow policies, only listed workflow types can run. Teams without a workflows
map keep Milestone 2 behavior. Limits requested by the SDK are capped by configured limits;
the run's effective budget and workflow binding stay fixed across retries. Current allowlists
are checked on every call; removing a bound policy revokes access. After changing budget caps,
start a reviewed new run to apply the new limits.
Workers and team keys select the workflow and run IDs, which act as correlation headers. Restrict who can submit code to those workers. Container step credentials stay bound to their team and run.
Run accounting¶
Each run defaults to 10,000 tokens and $5 estimated cost. Limits are initialized atomically
and stay fixed across retries. They are scoped to the authenticated team and Temporal run
UUID; GET /v1/workflow-runs/{run_id} returns only that team's accounting. Every attempted
provider route reserves estimated input plus maximum output at its higher token price.
Reported usage settles that reservation; attempts without reported usage and failed/ambiguous
attempts keep the conservative charge. Fallbacks and activity retries reserve separately. Tool attempts
charge their configured costUsd, including failed attempts. The downstream call runs once its
reservation succeeds. Configure both input and output prices on every eligible model.
Costs are estimates. An actual overrun is charged and blocks later calls. The SDK's run limit supplements the existing team budgets; models, tools and credentials come from team policy.
Deployment and recovery¶
Compose installs Temporal with its own PostgreSQL volume, UI, a worker, and persistent Redis for gateway budget counters. Ports bind only to loopback: gateway 8080, Temporal 7233, UI 8233. The fixture stack uses public development passwords for evaluation.
For Kubernetes, deploy/charts/workflows depends on the pinned
official Temporal chart. It includes a dedicated
PostgreSQL StatefulSet and the example worker. Local and customer Argo CD applications
install it in workflows; the gateway accepts that namespace. Before syncing, create the
temporal-postgres-auth Secret (password) and workflow-gateway-key Secret (api-key)
in that namespace through your secret manager. The worker key must bind to the intended
team. Configure the gateway's cloud routes and team tool policy first.
To evaluate the chart directly against an existing gateway:
kubectl create namespace workflows
kubectl -n workflows create secret generic temporal-postgres-auth --from-literal=password="$TEMPORAL_DB_PASSWORD"
kubectl -n workflows create secret generic workflow-gateway-key --from-literal=api-key="$AGENTWORKFLOWS_API_KEY"
helm dependency update deploy/charts/workflows
helm upgrade --install workflows deploy/charts/workflows -n workflows --wait --timeout 10m
Build sdk/python/Dockerfile with the repository root as context for your worker image;
set worker.image to an image reachable by the cluster. Replace the example workflow with
your registered workflows. The bundled Postgres and Redis are single-instance reference
stores. For team production use, provision backups with tested restores, storage classes,
and availability. Redis needs AOF persistence and no eviction; run counters are persistent.
Retain them for the run's entire lifetime, including resets; remove the team's
agentworkflows:sandbox-budget:workflow:<team>:<run-id> key once the run is past replay and
reset. Back up both PostgreSQL history and Redis accounting.
Temporal replays recorded activity results after a worker crash, reusing each recorded model answer. Temporal reruns an activity whose completion is still unrecorded, including one where the provider answered just before Temporal acknowledged completion. Those attempts remain charged, and idempotent tools prevent duplicate publications. Version workflow code using Temporal's deployment/patching rules before changing the command sequence of running workflows.
Temporal history contains workflow inputs and activity results. Gateway DLP protects the provider/tool boundary and receipts. Restrict history access and retention; use Temporal payload encryption for sensitive history. Keep API keys in worker/gateway environments. Production Temporal and its UI require authentication, authorization, and TLS. The gateway verifies approval identities; restrict direct Temporal clients to operators and workers. Use separate Temporal namespaces/deployments for stronger trust boundaries, and restrict signals and updates.
| Symptom | Next action |
|---|---|
| Run stays queued | Check worker logs, task queue, namespace, and TEMPORAL_ADDRESS |
workflow_store_required |
Set SANDBOX_BUDGET_BACKEND=redis, configure its URL, and enable persistence |
workflow_price_missing |
Add input/output prices to that model and every fallback |
workflow_*_budget_exceeded |
Inspect the run's usage; start a new reviewed run with an appropriate budget |
tool_not_allowed |
Inspect GET /v1/tools and the bound team's sandbox policy |
workflow_not_allowed / workflow_model_denied |
Inspect GET /v1/workflow-policies; use the registered workflow type and an allowed canonical model/provider |
workflow_egress_denied |
Add the reviewed tool server origin to that workflow's allowedEgress |
mcp_protocol_unsupported |
Use Streamable HTTP with MCP 2025-03-26 tool support |
workspace_busy / agent_failed |
Wait for the previous step to finish, or inspect the workspace before explicitly starting another run |
| Approval cannot be submitted | Wait for awaiting_approval; use an approver/admin key and the exact run ID |
Approval policies¶
The v0.9.0 gateway and both workflow SDKs support 1–10 distinct reviewers and 60–604800 seconds of approval time. Defaults are one reviewer and seven days. Use Team settings to edit Required reviewers and Approval expiry, or add these fields to an existing workflow policy (preserve its models, tools, egress and budgets):
requiredApprovals: 2
approvalTimeoutSeconds: 3600
approvalRequired: true
approvalThresholdUsd: 0
approverRole: approver
In the umbrella chart these fields live under
inference-gateway.sandboxPolicy.policy.policies[].workflows.<Workflow>; see the
existing ResearchWorkflow in deploy/charts/agentworkflows/values.yaml. Runtime
settings overrides take precedence over YAML defaults. Approval policies run on the
existing services, secrets, environment variables and datastores.
All approval fields are saved when the gateway starts a run, including cron/webhook starts. Settings changes apply to new runs; repeating a start's request ID keeps its original rules. Retrying a failed/canceled run starts a new run with current rules. The deadline starts when the worker receives the approval policy at its review step. The enclosing eight-day run execution timeout can end a run earlier.
Each verified subject (sub, otherwise key_id) can decide once. A positive vote
counts toward the quorum; any eligible reviewer's rejection ends the gate immediately.
An admin's review counts as one vote. A repeated delivery of the
same identity/decision is idempotent; a recorded vote is final. Separate
keys count as separate identities, so use individual SSO accounts for human review
and restrict who can create keys.
POST /v1/workflow-runs/{run_id}/approve accepts {"approved": true|false}.
Its approved result describes that reviewer's vote; the quorum outcome appears in the run's progress.
Inspect the run's progress.required_approvals, approved_by, expires_at (UTC), and
approver_role. The console shows counts/deadlines and keeps partial reviews visible.
Deadlines and duplicate decisions are enforced by synchronous Temporal update handlers,
so the quorum holds across gateway replicas. Expiry fails the run with
ApprovalExpired, and the deadline is final.
With approval disabled, or spend below the saved threshold, the gateway records an audited
automatic decision. These settings govern ApprovalWorkflow.approval(). Workers and direct
Temporal access remain trusted operator surfaces.
Upgrade the gateway first, then Python/TypeScript workers, before enabling nondefault
quorum/expiry. New SDKs request {"policy_version": 1} from the worker-only
/approval-waiting endpoint and wait for its policy before accepting reviews. Advanced
policies require the upgraded workers. Temporal patch
markers preserve replay of already-started legacy gates with their original single
reviewer and seven-day timeout. Configure a fresh run to try the new policy; see the
two-reviewer Quickstart.
Approval escalation¶
A review that waits too long can escalate. Escalation is off until a team admin configures it
for a workflow; it then applies to runs started afterwards. When a run's draft is still waiting
after_seconds after the run reached its approval gate, the gateway:
- lets more reviewers vote: every approver (
approver_role: approver, for workflows whoseapproverRoleisadmin) and the identities inreviewers(OIDC subjects or managed key IDs that hold the approver role). Admins and the workflow's own approver role keep their access. - writes one
approval_escalatedreceipt to the run timeline, signed by the policy principalapproval-escalation. A vote that escalation made possible carrieseligibility: escalationin itsapprovalreceipt. - sends an
approval_escalatednotice that names who may now review, through the team's alert-rule channels or the escalation's ownchannels.channels: []escalates silently. The notice is delivered like other notifications, with retries and receipts, even when the team's alert rules do not list the event.
agentworkflows workflows escalation set ReleaseNotesWorkflow --after 4h --all-approvers \
--reviewer maya@example.com --channel slack
agentworkflows workflows escalation list
agentworkflows workflows escalation remove ReleaseNotesWorkflow
agentworkflows runs pending # waiting runs you may review now, including escalated ones
after_seconds is 60 to 604740 and must be shorter than the workflow's approval timeout;
escalation list marks an escalation effective: false if a later timeout change ends reviews
first. Quorum, expiry, and the one-vote-per-identity rule are unchanged: an escalated reviewer's
vote counts toward requiredApprovals like any other, and the review still expires at
expires_at.
The run's start saves the escalation with its other approval fields, and the gateway records the moment the run reached its gate. Eligibility follows from those two durable values at the deadline itself, so a busy monitor or an offline worker cannot delay it, and gateway replicas agree. Escalation needs no worker change: workflow histories are unchanged, and runs already waiting on existing workers escalate if they were started with an escalation configured. The monitor (about every 30 seconds) or the first escalated vote, whichever comes first, writes the receipt and queues the notice exactly once.
Run inspection and listings show approval_escalation with the configuration and
waiting_since, escalates_at, escalated and recorded_at (the receipt time). For a waiting
run they also show the caller's approval_access: eligible, via (role or escalation), and
eligible_at when escalation will admit the caller later. A vote before that time returns 403
with the time it opens.
In the console, Approvals opens on Ready for you: the waiting drafts you may decide now, including escalated ones. All waiting lists every draft; one that escalation will open to you says when. Waiting runs show when their review escalates, and an Escalated mark once it has; run timelines and the audit log name escalation receipts and votes made through escalation. Team admins set, edit and remove escalation per workflow in Team settings → Approval escalation, which flags an escalation the approval expiry would overtake.
API: GET /v1/team/approval-escalations; PUT and DELETE
/v1/team/workflows/{name}/approval-escalation with the current If-Match revision (unrestricted
team admin). PUT takes after_seconds, optional approver_role (approver), reviewers (up to
20) and channels. Changes are audited as approval_escalation_changed and
approval_escalation_removed; removing a team-registered workflow removes its escalation.
GET /v1/workflow-policies shows each workflow's approvalEscalation. Python:
approval_escalations(), set_approval_escalation(workflow, after_seconds=..., ...),
remove_approval_escalation(workflow) and review_queue(). TypeScript: approvalEscalations(),
setApprovalEscalation(workflow, afterSeconds, options?, revision?),
removeApprovalEscalation(workflow, revision?) and reviewQueue().
Invite teammates without company sign-in¶
In Members & keys → Invite a teammate, choose a name, role, and project. Create and copy the invitation link, then share it privately. The recipient opens it and chooses Accept invitation to sign in. Links expire after 24 hours and can be redeemed once; if an acceptance response is lost, create a new invitation. The console grants 90 days of access; admins can edit or revoke the resulting credential in Members & keys.
A link is a bearer invitation: anyone holding it can receive the chosen access, so share it privately. The admin assigns the display name. Use OIDC for company-verified identity and group-based access. Delivery is an explicit copy/share step.
The API lists pending, accepted, revoked, and expired invitations without tokens or key values. Invitation credentials are encrypted with a key derived from the random link secret using a separate derivation from its lookup digest. Redis stores ciphertext and metadata; the key store retains only credential hashes. Metadata expires after 30 days. Revoking an invitation also revokes its credential and sessions; team erasure removes both invitation metadata and encrypted delivery state.
Contracts: GET/POST /v1/team/invitations, DELETE /v1/team/invitations/{id}, and
POST /v1/auth/invitations/accept with {"token":"…"}. Creation uses the same
name/role/project/credential expiry fields as key creation. Acceptance returns a
CreatedKey once. Python exposes invitations(),
create_invitation(), revoke_invitation(), accept_invitation(); TypeScript uses
invitations(), createInvitation(), revokeInvitation(), acceptInvitation().
Alert rules and failed runs¶
Team admins open Team settings → Alert rules to choose waiting approvals, failures, run budget thresholds, and slow model/tool steps. Select Slack, email, or webhook from the operator-approved destinations. Choose the percentage of a run's token/dollar budget and the slow-step threshold in milliseconds. Clear events or destinations to pause delivery. Destinations come from operator setup, which keeps them inside the deployment's network policy; when none is configured, the console points to that setup.
The existing gateway sweep checks retained runs every 30 seconds. Events persist, and each run/event/channel has a stable delivery ID. Delivery retries up to five times with backoff. Rule edits keep each event's delivery record, so delivered events stay delivered; enabling a rule can deliver retained events. Inspect attempted, retrying, delivered, or failed notification receipts in the run timeline. Have webhook receivers deduplicate by the supplied idempotency key. Destinations and their credentials remain in the existing team notification policy.
A failed run includes error.code and safe recovery guidance. The console points to
step receipts and worker logs and explains what to check before a retry. Gateway responses
carry safe error codes and guidance in place of raw exception messages. Each existing
model/tool timeline step still shows its measured latency, cost, HTTP status, and receipt.
API: GET/PUT /v1/team/alert-rules; PUT requires the current If-Match revision and
events, channels, budget_threshold (0–1, exclusive of zero), and slow_step_ms.
A concurrent team settings edit returns a conflict, which preserves both edits for review.
Python: alert_rules(), set_alert_rules(rules, revision=...).
TypeScript: alertRules(), setAlertRules(rules, revision).
Run insights¶
Open Insights in the console to see how each workflow behaves over the last 24 hours, 7 days or 30 days, and open any run to see Where the time and money went.
A run's summary comes from its retained receipts:
| Value | Meaning |
|---|---|
| Elapsed | Run start to its last receipt; for a running run, to now. |
| Working | Time spent in model and tool calls, with their counts. |
| Review wait | From the last model or tool step before a reviewer's decision to that decision. For a draft still waiting, the time so far. |
| By step | Calls, time, tokens and cost for each step, with each step's share. |
The workflow table adds, for recent runs of each workflow: outcomes (completed, rejected by a reviewer, failed, canceled, awaiting review, running), the completion rate among finished runs, the median and 95th-percentile run time, the median review wait, the average cost of a finished run, the slowest step by median time and the step costing the most. A rejected draft is a reviewer's decision and is counted separately from failures. Statuses come from Temporal, so a run is as current as its last status refresh.
The API reads the 200 most recent runs in the window and sets truncated when there were more.
Insights cover retained runs, so a 30-day window uses 30-day retention. Review wait is computed
between two receipts, and costs use configured prices. Credentials bound to one project see that
project. Viewers can read insights.
API: GET /v1/workflow-insights?days=7&project=&workflow= (days 1-30). A single run's
detail (GET /v1/workflow-runs/{run_id}) includes summary.
Python: workflow_insights(days=7, project=None, workflow=None); CLI: agentworkflows insights --days 30.
TypeScript: workflowInsights({ days, project, workflow }).