Runnable code samples

Complete scripts you can copy on each sample page. The same files are published with these docs. Use the filter below, or press ⌘K / Ctrl+K anywhere on the site to search guides and samples. The sidenav lists every journey and every SDK method. Names for each helper are on SDK methods.

Stream agent chat

List agents or workflows, start a chat, and print reply text plus tool calls as AG-UI events arrive.

recipe · ask · chat · stream

Async Ask worker

Complete start → wait → get_session → export. Best starting point for queue workers.

recipe · ask · async

Async webhook worker

Dual-token trigger + resolve 202 without session_id + export write-up.

recipe · webhook · async

Webhook + schedule + HITL

Create webhook/schedule, trigger both, resolve approvals, wait on SSE.

recipe · webhook · schedule · hitl

Webhook acknowledgement

Create with response_status 200 and custom ack headers for Linear-style providers.

recipe · webhook · acknowledgement

Webhook condition (filter_cel)

Only start an agent for a direct GitHub review request; preview the condition first, no run for everything else.

recipe · webhook · filter · github

Ask mid-turn steer

Add context mid-investigation without starting a second parallel run.

recipe · ask · steer

Chat subscriptions

Point Slack/Teams channels at your app; mute or tear down from code.

recipe · chat · subscription

Policy guardrails and break-glass

Attach a deny, open a time-limited outage bypass, then put guardrails back.

recipe · policy · break-glass

Chat session attachments

Send a file with a chat message, rename/star the session, then download and delete the attachment.

recipe · chat · attachments · session

Test and retire a model

Probe a model configuration with testModel before any agent depends on it, then delete it.

recipe · models · provider

Integration secrets → agent → Ask

Upsert GitHub/Grafana with Vault secrets, attach an agent, optionally pin Ask mode.

recipe · agent · vault · ask · integration

Export audit events

Page past the cursor cap and write NDJSON (native or OCSF) for compliance or SIEM.

recipe · audit · export

Ask → export report

Full CLI when session-report.md may be missing; uses export_session.

recipe · ask · export

SRE → pull alerts

Refresh the inbox from Grafana, wait for the pull, list active alerts.

sre · pull

Context Graph inventory

Health check, list record types and connectors, optional tool search.

recipe · context-graph · inventory

SRE → investigate alert

List alerts, start an investigation, wait for the RCA.

sre

SRE → triage alerts

Ignore or reclassify an alert, list groups, resolve finished threads.

sre · triage

DevOps → sync Ops Inbox

Pull tickets from Linear, Jira, or ServiceNow and list requests.

devops · inbox

DevOps → approve request

Approve an inbox request and wait for the run to finish.

devops · approve

DevOps → discover workflows

Analyze recent tickets and wait until discovery classes are ready.

devops · discovery

Automation surface

Overview of Ask vs SRE vs webhook start paths and which fetch API to use.

overview · ask · sre

Create a workflow

Compose agent + stages in code and publish with publishWorkflow.

workflow

Aiden chat from a Go backend

Start an agent chat, stream the reply over SSE, resolve tool approvals. Built for Grafana plugins and other server-side hosts.

recipe · go · chat · agent

Webhook → session → artifact

Blocking journey: trigger, wait for session, download session-report.md. Python, TypeScript, and Go.

webhook · artifact · go

Async webhook CI

Split trigger and poll across workers (short snippets + dual-token notes).

webhook · async

Webhook → session only

Trigger and capture session_id; download later elsewhere.

webhook

Ask → execution

Start Ask and wait until the execution settles (no download).

ask

Ask → artifact

Pinned Ask workflow that downloads session-report.md in one helper call.

ask · artifact

Ask → debug ZIP

Download the execution debug ZIP (Activity / watch export) by trace_id.

recipe · ask · debug · triage

Ask → session artifacts

startAsk, wait on subscribe, list and download every note. Keep a Changelog and operator follow-through recipes.

recipe · ask · artifact · changelog

For narrative walkthroughs (glossary, tokens, polling) see the Aiden guide. Each sample links its full script. Those files are published with these docs.