Skip to content

Demo examples: live play-test fixes for the graph-engineering workshop - #166

Merged
davidkpiano merged 5 commits into
nextfrom
davidkpiano/graph-workshop-demo-examples-9d5ef1
Oct 22, 2026
Merged

davidkpiano merged 5 commits into
nextfrom
davidkpiano/graph-workshop-demo-examples-9d5ef1

Conversation

@davidkpiano

@davidkpiano davidkpiano commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Every demo entry (70 examples, 10 curated scenarios) was played against live models (gpt-5.4-mini, Jev) through the demo's own runner, as a workshop attendee would, before the graph-engineering workshop on 2026-10-22.

Demo host

  • Runs failed in vite dev on next. Every run, including the default "Refund guard", threw SerovalUnsupportedTypeError. Nitro adds the development condition, so Vite handed Node seroval's dev build while @tanstack/router-core loaded the default build: two Stream classes. A plugin in demo/vite.config.ts drops development from server externalConditions.
  • Stalled chats. A failed or cancelled run with no wait to return to now offers "Run again"; before, every message was "ignored". A failed resume restores its buttons.
  • Typed text and choices. Payload choices are text candidates, and events they cover no longer take the whole text as a payload ("look up their order first" was sent as orderId: "look up their order first").
  • Unsure readings. Below the confidence bar, text goes to the state's text event when there is one, never to a button. "mhm, definitely" now answers in twenty-questions.
  • Guard refusals read "was refused by this state's rules" instead of "isn't an accepted event".
  • Idle bubbles. A chat reply leads even when other prose changed (context-compaction hid it), and text the prompt already shows isn't repeated.

Library

  • toAiSdkTools passes provider-defined tools (openai.tools.webSearch()) through unchanged. Before, it rebuilt them without their id, so the provider never ran them. Changeset included.

Examples and scenarios

Most fixes: duplicated output, starters that never reach the rule, and purposes that headlined scaffolding instead of the bound. Real bugs:

  • machine-as-tool enforced its $500 hard limit only through a Jev judgment; code now checks it too.
  • sql-agent answered "0 book orders" (truth: 2); the category is now an enum.
  • swarm-handoff lost the conversation on a handoff.
  • chameleon showed each player's reasoning before the vote.
  • self-improving-refunds could never reach a refund in the demo (identity check).
  • plan-and-execute fails as soon as an over-budget plan arrives, with no worker calls.
  • customer-support asks for a missing confirmation code (bounded) instead of failing.
  • deep-research runs real web search and keeps only citations the search returned.
  • joke output is { joke, earlierJokes } (no duplicate jokes).
  • Scenarios: pipeline's verify now gates complete; reflection drafts without a staged weak first pass; retry has an [all-models-down] starter that reaches failed.

Demo goldens (example-behavior) regenerated and reviewed.

Verification

  • pnpm run check, pnpm vitest run (1594), demo pnpm vitest run (280), pnpm run docs:check
  • Demo checked in the browser: refund scenario approve path, cancel → Run again, refunds desk typed text → LOOKUP_ORDER ORD-1002

Devin Review

toAiSdkTools rebuilt openai.tools.webSearch() and other provider tools as
plain tools, dropping their id, so the provider never ran them.
…eads choices

- Every run failed in vite dev with SerovalUnsupportedTypeError: Nitro adds
  the development condition, so Vite and Node loaded two seroval copies.
  Drop it from server externalConditions.
- A failed or cancelled run with no wait to return to offers Run again; a
  failed resume restores its buttons.
- Typed text maps onto a state's payload choices, and covered events no
  longer swallow the whole text as a payload.
- An unsure reading falls back to the state's text event, never to a button.
- A guard refusal says the state's rules refused the event.
- Idle bubbles: a chat reply leads even when other prose changed; text the
  prompt already shows is not repeated.
Refund labels review vs limit; routing names the confidence bar; pipeline's
verify gates complete; tools only looks up stored keys and says when the cap
forced an answer; reflection drafts without a staged weak first pass; retry
has an all-models-down starter that reaches failed; email drafters drop
placeholder sign-offs.
Fixes found by driving each example through the demo's runner with real
models: duplicated output, starters that never reach the example's rule,
purposes that headlined scaffolding instead of the bound, and real bugs
(machine-as-tool's limit was only a Jev judgment, sql-agent filtered on a
misspelled category, swarm-handoff lost the conversation on handoff,
chameleon leaked its reasoning before the vote). deep-research now runs real
web search and keeps only citations the search returned. Demo goldens
regenerated.
@changeset-bot

changeset-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0d15b83

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@statelyai/agent Patch
@statelyai/agent-demo Patch
@statelyai/example-next-host Patch
@statelyai/example-tanstack-ai-stream Patch
@statelyai/example-cloudflare-agent-host Patch
@statelyai/example-cloudflare-workers-ai-host Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 192 files, which is 92 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aad9ceeb-b024-4756-aabe-e1ac5745c2d1
📥 Commits

Reviewing files that changed from the base of the PR and between ab615ea and 0d15b83.

📒 Files selected for processing: 192
  • .changeset/ai-sdk-provider-tools.md
  • demo/src/agents/approval.ts
  • demo/src/agents/email-drafter-v1.ts
  • demo/src/agents/email-drafter-v2.ts
  • demo/src/agents/pipeline.ts
  • demo/src/agents/reflection.ts
  • demo/src/agents/refund.ts
  • demo/src/agents/routing.ts
  • demo/src/agents/tools.ts
  • demo/src/components/app-panel.tsx
  • demo/src/lib/__snapshots__/example-behavior/agent-supervisor.json
  • demo/src/lib/__snapshots__/example-behavior/ai-sdk-evaluator-optimizer.json
  • demo/src/lib/__snapshots__/example-behavior/ai-sdk-host.json
  • demo/src/lib/__snapshots__/example-behavior/booking-compensation.json
  • demo/src/lib/__snapshots__/example-behavior/chameleon.json
  • demo/src/lib/__snapshots__/example-behavior/chat-with-pdf.json
  • demo/src/lib/__snapshots__/example-behavior/chatbot-simulation-eval.json
  • demo/src/lib/__snapshots__/example-behavior/code-review-loop.json
  • demo/src/lib/__snapshots__/example-behavior/consensus-review.json
  • demo/src/lib/__snapshots__/example-behavior/context-compaction.json
  • demo/src/lib/__snapshots__/example-behavior/crash-recovery.json
  • demo/src/lib/__snapshots__/example-behavior/customer-support.json
  • demo/src/lib/__snapshots__/example-behavior/deadline-escalation.json
  • demo/src/lib/__snapshots__/example-behavior/deep-research.json
  • demo/src/lib/__snapshots__/example-behavior/feynman-tutor.json
  • demo/src/lib/__snapshots__/example-behavior/game-loop-agent.json
  • demo/src/lib/__snapshots__/example-behavior/generate-and-repair.json
  • demo/src/lib/__snapshots__/example-behavior/guardrails.json
  • demo/src/lib/__snapshots__/example-behavior/hierarchical-teams.json
  • demo/src/lib/__snapshots__/example-behavior/human-in-the-loop.json
  • demo/src/lib/__snapshots__/example-behavior/joke.json
  • demo/src/lib/__snapshots__/example-behavior/llm-compiler.json
  • demo/src/lib/__snapshots__/example-behavior/long-running-onboarding.json
  • demo/src/lib/__snapshots__/example-behavior/machine-as-tool.json
  • demo/src/lib/__snapshots__/example-behavior/map-reduce.json
  • demo/src/lib/__snapshots__/example-behavior/model-fallback.json
  • demo/src/lib/__snapshots__/example-behavior/plain-xstate.json
  • demo/src/lib/__snapshots__/example-behavior/plan-and-execute.json
  • demo/src/lib/__snapshots__/example-behavior/port-walkthrough.json
  • demo/src/lib/__snapshots__/example-behavior/portable-xstate-loop.json
  • demo/src/lib/__snapshots__/example-behavior/project-planner.json
  • demo/src/lib/__snapshots__/example-behavior/prompt-chaining.json
  • demo/src/lib/__snapshots__/example-behavior/rank-candidates.json
  • demo/src/lib/__snapshots__/example-behavior/reflection-writer.json
  • demo/src/lib/__snapshots__/example-behavior/reflexion.json
  • demo/src/lib/__snapshots__/example-behavior/retrofit.json
  • demo/src/lib/__snapshots__/example-behavior/review-tool-calls.json
  • demo/src/lib/__snapshots__/example-behavior/river-crossing.json
  • demo/src/lib/__snapshots__/example-behavior/route-replanning.json
  • demo/src/lib/__snapshots__/example-behavior/self-discover.json
  • demo/src/lib/__snapshots__/example-behavior/self-improving-refunds.json
  • demo/src/lib/__snapshots__/example-behavior/snapshot-migration.json
  • demo/src/lib/__snapshots__/example-behavior/sql-agent.json
  • demo/src/lib/__snapshots__/example-behavior/storm-writer.json
  • demo/src/lib/__snapshots__/example-behavior/swarm-handoff.json
  • demo/src/lib/__snapshots__/example-behavior/tnt-llm.json
  • demo/src/lib/__snapshots__/example-behavior/todo-nl.json
  • demo/src/lib/__snapshots__/example-behavior/triage.json
  • demo/src/lib/agent-runner.test.ts
  • demo/src/lib/agent-runner.ts
  • demo/src/lib/example-behavior.test.ts
  • demo/src/lib/host-timers.test.ts
  • demo/src/lib/inspection.test.ts
  • demo/src/lib/interpret-text.server.ts
  • demo/src/lib/interpret-text.test.ts
  • demo/src/lib/machine-chat.server.ts
  • demo/src/lib/machine-chat.test.ts
  • demo/src/lib/machine-ui.ts
  • demo/src/lib/render-value.test.ts
  • demo/src/lib/render-value.ts
  • demo/src/lib/run-stream.test.ts
  • demo/src/lib/scenarios.ts
  • demo/src/lib/shell-store.ts
  • demo/vite.config.ts
  • examples/README.md
  • examples/agent-supervisor/index.ts
  • examples/agentic-rag/index.test.ts
  • examples/agentic-rag/index.ts
  • examples/ai-sdk-evaluator-optimizer/index.test.ts
  • examples/ai-sdk-evaluator-optimizer/index.ts
  • examples/ai-sdk-evaluator-optimizer/metadata.json
  • examples/ai-sdk-host/index.test.ts
  • examples/ai-sdk-host/index.ts
  • examples/answer-reuse/index.ts
  • examples/booking-compensation/index.test.ts
  • examples/booking-compensation/index.ts
  • examples/chameleon/index.test.ts
  • examples/chameleon/index.ts
  • examples/chat-with-pdf/index.ts
  • examples/chatbot-simulation-eval/index.test.ts
  • examples/chatbot-simulation-eval/metadata.json
  • examples/code-assistant/index.ts
  • examples/code-review-loop/metadata.json
  • examples/consensus-review/index.test.ts
  • examples/consensus-review/metadata.json
  • examples/context-compaction/metadata.json
  • examples/crash-recovery/index.test.ts
  • examples/crash-recovery/index.ts
  • examples/customer-support/index.test.ts
  • examples/customer-support/index.ts
  • examples/customer-support/metadata.json
  • examples/data-enrichment/index.test.ts
  • examples/data-enrichment/index.ts
  • examples/deadline-escalation/index.ts
  • examples/deep-research/index.test.ts
  • examples/deep-research/index.ts
  • examples/deep-research/metadata.json
  • examples/email-drafter/metadata.json
  • examples/feynman-tutor/index.test.ts
  • examples/feynman-tutor/index.ts
  • examples/game-agent/metadata.json
  • examples/game-loop-agent/index.test.ts
  • examples/game-loop-agent/index.ts
  • examples/game-loop-agent/metadata.json
  • examples/generate-and-repair/index.test.ts
  • examples/generate-and-repair/index.ts
  • examples/generate-and-repair/metadata.json
  • examples/guardrails/metadata.json
  • examples/hierarchical-teams/index.test.ts
  • examples/hierarchical-teams/index.ts
  • examples/hierarchical-teams/metadata.json
  • examples/human-in-the-loop/index.ts
  • examples/info-gathering/metadata.json
  • examples/joke/index.test.ts
  • examples/joke/index.ts
  • examples/joke/metadata.json
  • examples/json-agent/workflow.json
  • examples/just-one/index.test.ts
  • examples/just-one/index.ts
  • examples/langchain-host/index.test.ts
  • examples/langchain-host/index.ts
  • examples/llm-compiler/index.test.ts
  • examples/llm-compiler/metadata.json
  • examples/long-running-onboarding/index.ts
  • examples/machine-as-tool/index.test.ts
  • examples/machine-as-tool/index.ts
  • examples/machine-as-tool/metadata.json
  • examples/map-reduce/index.test.ts
  • examples/map-reduce/index.ts
  • examples/model-fallback/index.test.ts
  • examples/model-fallback/index.ts
  • examples/multi-agent-debate/index.ts
  • examples/openai-sdk-host/index.test.ts
  • examples/plain-xstate/index.ts
  • examples/plain-xstate/metadata.json
  • examples/plan-and-execute/index.test.ts
  • examples/plan-and-execute/index.ts
  • examples/plan-and-execute/metadata.json
  • examples/port-walkthrough/index.ts
  • examples/port-walkthrough/metadata.json
  • examples/portable-xstate-loop/index.ts
  • examples/project-planner/index.test.ts
  • examples/project-planner/index.ts
  • examples/project-planner/metadata.json
  • examples/prompt-chaining/metadata.json
  • examples/rank-candidates/index.test.ts
  • examples/rank-candidates/index.ts
  • examples/reflection-writer/metadata.json
  • examples/reflexion/index.test.ts
  • examples/reflexion/index.ts
  • examples/retrofit/metadata.json
  • examples/review-tool-calls/metadata.json
  • examples/river-crossing/index.test.ts
  • examples/river-crossing/index.ts
  • examples/river-crossing/metadata.json
  • examples/route-replanning/index.ts
  • examples/route-replanning/metadata.json
  • examples/self-discover/index.test.ts
  • examples/self-discover/index.ts
  • examples/self-discover/metadata.json
  • examples/self-improving-refunds/desk.ts
  • examples/self-improving-refunds/index.test.ts
  • examples/self-improving-refunds/metadata.json
  • examples/snapshot-migration/metadata.json
  • examples/sql-agent/index.test.ts
  • examples/sql-agent/index.ts
  • examples/sql-agent/metadata.json
  • examples/storm-writer/index.test.ts
  • examples/storm-writer/index.ts
  • examples/storm-writer/metadata.json
  • examples/swarm-handoff/index.test.ts
  • examples/swarm-handoff/index.ts
  • examples/swarm-handoff/metadata.json
  • examples/tic-tac-toe/game.ts
  • examples/tnt-llm/index.test.ts
  • examples/tnt-llm/index.ts
  • examples/todo-nl/metadata.json
  • examples/triage/index.test.ts
  • examples/triage/index.ts
  • src/ai-sdk/index.test.ts
  • src/ai-sdk/mappers.ts
  • src/examples.test.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 3 potential issues.

Devin Review

Comment thread examples/just-one/index.ts Resolved
Comment on lines +45 to +55
"Trusted patch with SQL injection (votes fall short)": [
{
"sent": "start {\"patch\":\"Speed up user search by building the query directly.\\n\\n--- a/src/users.ts\\n+++ b/src/users.ts\\n@@ export async function findUsers(db: Db, name: string) {\\n- return db.query(\\\"SELECT * FROM users WHERE name = $1\\\", [name]);\\n+ return db.query(`SELECT * FROM users WHERE name = '${name}'`);\\n }\",\"source\":\"trusted\"}",
"status": "done",
"trace": [
"transition @xstate.init -> {\"reviewing\":{\"security\":\"working\",\"reliability\":\"working\",\"maintainability\":\"working\"}}",
"transition xstate.done.actor -> {\"reviewing\":{\"security\":\"done\",\"reliability\":\"working\",\"maintainability\":\"working\"}}",
"transition xstate.done.actor -> {\"reviewing\":{\"security\":\"done\",\"reliability\":\"done\",\"maintainability\":\"working\"}}",
"transition xstate.done.actor -> \"accepted\""
],
"response": "- Approved: yes\n- Human reviewed: no\n\n**Votes**\n\n| Approve | Reason | Reviewer |\n| --- | --- | --- |\n| yes | approve (approve 100% · reject 0% · abstain 0%) | security |\n| yes | approve (approve 100% · reject 0% · abstain 0%) | reliability |\n| yes | approve (approve 100% · reject 0% · abstain 0%) | maintainability |"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 SQL-injection starter snapshot takes the opposite branch

The new starter promises insufficient votes, but its mock snapshot records three approvals and automatic acceptance. The dedicated test scripts rejecting votes instead. The golden does not demonstrate the advertised path.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread examples/self-improving-refunds/desk.ts Resolved
…lide in just-one

- self-improving-refunds: the sample world verified a claim that contained
  the email, which every ticket carries. It now wants the private detail on
  file (order date, last four, zip); starter labels name it.
- just-one: "-es" also comes off after a single s, and a final "-se"
  loses its e, so bus/buses and house/houses collide.
@davidkpiano
davidkpiano merged commit 2b6a89c into next Oct 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant