Skip to content

createAiSdkExecutors and createTanStackAiExecutors accept a machine or setup - #155

Merged
davidkpiano merged 2 commits into
nextfrom
davidkpiano/models-executors
Oct 13, 2026
Merged

davidkpiano merged 2 commits into
nextfrom
davidkpiano/models-executors

Conversation

@davidkpiano

@davidkpiano davidkpiano commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • createAiSdkExecutors(machine) / createAiSdkExecutors(agentSetup) read the models declared in setupAgent({ models }) via the existing registry (src/internal/registry.ts). { models } / { resolveModel } still work. Same for createTanStackAiExecutors. OpenAI adapter skipped (different shape: { client, resolveModel }).
  • New src/internal/model-source.ts; core stays provider-free (zero provider imports outside adapter folders).
  • Wrong-shaped argument throws at construction naming what it got, including a setup or machine with no models.
  • README, docs/quickstart.md, docs/models-and-providers.md updated. Changeset: minor.

Behaviour changes

  • createAiSdkExecutors({}) now throws at construction instead of on first call.
  • A setup/machine with models: {} throws; the literal { models: {} } still passes.

Verify

pnpm vitest --run src (667 tests), typecheck, lint, format:check, docs:check all pass.


Devin Review

Summary by CodeRabbit

  • New Features

    • AI SDK and TanStack AI executors can now use models declared in an agent setup, setup result, or machine. Existing options-based model configuration remains supported.
    • Added guidance and examples for configuring and reusing models across both adapters.
  • Bug Fixes

    • Unsupported inputs, including setups or machines without declared models, now produce descriptive errors when executors are created.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a8c834d0-dcd6-417d-be83-a0843bb7ed92

📥 Commits

Reviewing files that changed from the base of the PR and between 7577d20 and 14dca89.


📒 Files selected for processing (9)
  • .changeset/adapters-read-setup-models.md
  • docs/models-and-providers.md
  • docs/quickstart.md
  • readme.md
  • src/ai-sdk/index.test.ts
  • src/ai-sdk/index.ts
  • src/internal/model-source.ts
  • src/tanstack-ai/index.test.ts
  • src/tanstack-ai/index.ts

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

Both executor adapters now accept a setup result or configured machine as a model source, alongside the existing options form. A shared resolver normalizes supported inputs and throws for unsupported inputs or missing models. Tests and documentation cover the new inputs.

Changes

Executor model sources

Layer / File(s) Summary
Normalize model sources
src/internal/model-source.ts
A shared resolver accepts options containing models, setup results with models, and configured machines with models. It throws a descriptive TypeError for unsupported inputs.
Integrate model sources in both adapters
src/ai-sdk/index.ts, src/ai-sdk/index.test.ts, src/tanstack-ai/index.ts, src/tanstack-ai/index.test.ts
Both adapters add a machine overload and resolve supported inputs before executor construction. Tests cover accepted sources and construction errors.
Update examples and release notes
docs/models-and-providers.md, docs/quickstart.md, readme.md, .changeset/adapters-read-setup-models.md
Examples show setup-declared models and preserve the options form for host-owned model maps. The documentation and changeset describe accepted inputs and construction-time errors.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Host
  participant AiSdk as createAiSdkExecutors
  participant TanStack as createTanStackAiExecutors
  participant Resolver as resolveModelSource
  alt AI SDK adapter
    Host->>AiSdk: Pass setup result, machine, or options
    AiSdk->>Resolver: Resolve model source
    Resolver-->>AiSdk: Return executor options
    AiSdk-->>Host: Return AiSdkExecutors
  else TanStack AI adapter
    Host->>TanStack: Pass setup result, machine, or options
    TanStack->>Resolver: Resolve model source
    Resolver-->>TanStack: Return executor options
    TanStack-->>Host: Return TanStackAiExecutors
  end
Loading

Suggested reviewers: claude


Merge Risk: ⚪ Minimal · up to 14dca

The documented setup-result input remains supported; no identified issue blocks merging after normal checks.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 5 files. (4 skipped: 4… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: both executor factories now accept a machine or setup.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 5 files. (4 skipped: 4 unsupported.)


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • 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: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@davidkpiano
davidkpiano merged commit 6928e0e into next Oct 13, 2026
4 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