Skip to content

feat: vercel runner + shared stream→TUI bridge#589

Closed
gewenyu99 wants to merge 2 commits into
posthog-code/runner-02-shared-substratefrom
posthog-code/runner-03-vercel
Closed

feat: vercel runner + shared stream→TUI bridge#589
gewenyu99 wants to merge 2 commits into
posthog-code/runner-02-shared-substratefrom
posthog-code/runner-03-vercel

Conversation

@gewenyu99

@gewenyu99 gewenyu99 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Closes #523

Epic: #520 · Behavior change: none (flag off) · Depends on: #522

Summary

Implement VercelRunner on the Vercel AI SDK's agent loop. Selected at wizard-runner=vercel.

Scope

  • Deps: ai, @ai-sdk/anthropic.
  • Provider: createAnthropic({ baseURL: <gateway>, apiKey: <posthog key>, headers: <shared headers> })
    keeps the Anthropic protocol the gateway already speaks; swappable to other providers later.
  • Loop: ToolLoopAgent (or streamText + stopWhen) with the shared coding toolset as
    tool({ inputSchema, execute }); model from run context.
  • MCP: mount posthog-wizard + wizard-tools via AI SDK MCP connectors.
  • Streaming: consume fullStream (text deltas, tool-call/result, step-finish) → shared stream→TUI bridge.
  • Errors → AgentErrorType; honor [ABORT].

Acceptance criteria

  • A text-only and a tool-using program run complete end-to-end against a local gateway.
  • Streaming text + status markers reach the TUI like the anthropic path.
  • Bedrock-fallback + custom headers verified on the wire.
  • Flag stays 0% vercel; anthropic unaffected.
  • Unit tests for runner wiring (mocked model) incl. a stop/runaway guard.

Files

  • src/lib/agent/runner/vercel-runner.ts

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci error-tracking-upload-source-maps
  • /wizard-ci misc
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci error-tracking-upload-source-maps/android
  • /wizard-ci error-tracking-upload-source-maps/flutter
  • /wizard-ci error-tracking-upload-source-maps/ios
  • /wizard-ci error-tracking-upload-source-maps/next
  • /wizard-ci error-tracking-upload-source-maps/next-no-posthog
  • /wizard-ci error-tracking-upload-source-maps/node-raw
  • /wizard-ci error-tracking-upload-source-maps/node-rollup
  • /wizard-ci error-tracking-upload-source-maps/node-rollup-typescript-plugin
  • /wizard-ci error-tracking-upload-source-maps/node-webpack
  • /wizard-ci error-tracking-upload-source-maps/nuxt-3-6
  • /wizard-ci error-tracking-upload-source-maps/nuxt-4-3
  • /wizard-ci error-tracking-upload-source-maps/react-native
  • /wizard-ci error-tracking-upload-source-maps/react-vite
  • /wizard-ci error-tracking-upload-source-maps/rust
  • /wizard-ci misc/quack-quack
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

gewenyu99 commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

gewenyu99 and others added 2 commits June 8, 2026 10:50
The `vercel` variant of the wizard-runner flag: wraps the Vercel AI SDK v6
ToolLoopAgent over the gateway-pointed @ai-sdk/anthropic model. Adds the
SDK-agnostic substrate both new runners share:

- run-bridge: assistant text → signal markers ([STATUS]/[DASHBOARD_URL]/
  [NOTEBOOK_URL]/[ABORT]), task store → syncTodos, finalize() → the same
  AgentErrorType result the Anthropic SDK path returns.
- conclude: the post-loop tail (spinner-stop messages, remark/duration
  analytics, benchmark finalize), mirroring runAgent so runners don't drift.
- mcp: neutral HTTP MCP descriptors projected from the SDK mcpServers map.

selectRunner now routes vercel → VercelRunner (pi still falls back to
anthropic until #524). Flag default stays anthropic; rollout gated by #527.

Both SDKs are ESM-only, so the runner lazy-imports them inside run() (the
getSDKModule pattern) — selection stays SDK-free.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gewenyu99 gewenyu99 force-pushed the posthog-code/runner-02-shared-substrate branch from dc0d046 to 0e1b890 Compare June 8, 2026 15:09
@gewenyu99 gewenyu99 force-pushed the posthog-code/runner-03-vercel branch from b60e7f6 to c0de467 Compare June 8, 2026 15:09
@gewenyu99

Copy link
Copy Markdown
Collaborator Author

Closing — vercel backend is killed (only pi ships). See #520 reorientation and #523. The pi PR #590 will be rebased directly onto post-#688 main, off this stack.

@gewenyu99 gewenyu99 closed this Jun 19, 2026
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