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.
Async Ask worker
Complete start → wait → get_session → export. Best starting point for queue workers.
Async webhook worker
Dual-token trigger + resolve 202 without session_id + export write-up.
Webhook + schedule + HITL
Create webhook/schedule, trigger both, resolve approvals, wait on SSE.
Webhook acknowledgement
Create with response_status 200 and custom ack headers for Linear-style providers.
Webhook condition (filter_cel)
Only start an agent for a direct GitHub review request; preview the condition first, no run for everything else.
Ask mid-turn steer
Add context mid-investigation without starting a second parallel run.
Chat subscriptions
Point Slack/Teams channels at your app; mute or tear down from code.
Policy guardrails and break-glass
Attach a deny, open a time-limited outage bypass, then put guardrails back.
Chat session attachments
Send a file with a chat message, rename/star the session, then download and delete the attachment.
Test and retire a model
Probe a model configuration with testModel before any agent depends on it, then delete it.
Integration secrets → agent → Ask
Upsert GitHub/Grafana with Vault secrets, attach an agent, optionally pin Ask mode.
Export audit events
Page past the cursor cap and write NDJSON (native or OCSF) for compliance or SIEM.
Ask → export report
Full CLI when session-report.md may be missing; uses export_session.
SRE → pull alerts
Refresh the inbox from Grafana, wait for the pull, list active alerts.
Context Graph inventory
Health check, list record types and connectors, optional tool search.
SRE → investigate alert
List alerts, start an investigation, wait for the RCA.
SRE → triage alerts
Ignore or reclassify an alert, list groups, resolve finished threads.
DevOps → sync Ops Inbox
Pull tickets from Linear, Jira, or ServiceNow and list requests.
DevOps → approve request
Approve an inbox request and wait for the run to finish.
DevOps → discover workflows
Analyze recent tickets and wait until discovery classes are ready.
Automation surface
Overview of Ask vs SRE vs webhook start paths and which fetch API to use.
Create a workflow
Compose agent + stages in code and publish with publishWorkflow.
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.
Webhook → session → artifact
Blocking journey: trigger, wait for session, download session-report.md. Python, TypeScript, and Go.
Async webhook CI
Split trigger and poll across workers (short snippets + dual-token notes).
Webhook → session only
Trigger and capture session_id; download later elsewhere.
Ask → execution
Start Ask and wait until the execution settles (no download).
Ask → artifact
Pinned Ask workflow that downloads session-report.md in one helper call.
Ask → debug ZIP
Download the execution debug ZIP (Activity / watch export) by trace_id.
Ask → session artifacts
startAsk, wait on subscribe, list and download every note. Keep a Changelog and operator follow-through recipes.
No samples match that filter.
For narrative walkthroughs (glossary, tokens, polling) see the Aiden guide. Each sample links its full script. Those files are published with these docs.