refactor(agents): remove registry, Model accepts LanguageModel only#29
refactor(agents): remove registry, Model accepts LanguageModel only#29zrosenbauer merged 5 commits intomainfrom
Conversation
…l only
Remove the `registry` field from `AgentConfig` and the `resolveModel()`
utility. The `Model` type is now `LanguageModel` only (no strings).
Users pass AI SDK provider instances directly (e.g. `openai('gpt-4.1')`).
Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 50eb770 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughRemoves registry-based string model resolution: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📝 Coding Plan
Comment |
Co-Authored-By: Claude <noreply@anthropic.com>
Update all examples to import `openai` from `@ai-sdk/openai` and pass `LanguageModel` instances directly, matching the new `Model` type that no longer accepts strings. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/remove-registry-from-agents.md:
- Line 5: The changeset text is missing the breaking-change note that the public
export ModelRef was removed from packages/agents/src/index.ts; update the
release note to explicitly state "ModelRef export removed" and give the
migration step: remove imports of ModelRef and switch to passing LanguageModel
instances directly (e.g. openai('gpt-4.1')) instead of string model IDs or
registry usage, and mention the related items AgentConfig.registry removal and
resolveModel() removal so consumers know to update code that referenced
ModelRef, AgentConfig, resolveModel(), and the narrowed Model type.
In `@packages/agents/src/core/types.ts`:
- Line 36: The Model type alias was narrowed to LanguageModel causing callers
that still pass string model IDs to fail; update the Model type alias (the
export named Model) to accept both the LanguageModel type and string model IDs
(e.g., union with string or the specific LanguageModelV3 union plus string) so
existing callers compile, then re-run the provided verification script to find
and remove remaining "model: 'provider/model'" usages and once all callsites are
migrated, revert Model to the stricter LanguageModel-only type.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: ef22945a-47ae-4df6-bff4-24e2745a485e
📒 Files selected for processing (8)
.changeset/remove-registry-from-agents.mdpackages/agents/src/core/agents/base/agent.test.tspackages/agents/src/core/agents/base/agent.tspackages/agents/src/core/agents/base/types.tspackages/agents/src/core/agents/base/utils.test.tspackages/agents/src/core/agents/base/utils.tspackages/agents/src/core/types.tspackages/agents/src/index.ts
💤 Files with no reviewable changes (2)
- packages/agents/src/core/agents/base/agent.test.ts
- packages/agents/src/core/agents/base/utils.test.ts
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
registryfield fromAgentConfig— no longer neededModeltype fromstring | LanguageModelto justLanguageModelresolveModel()utility function and all related testsModelReftype alias exportopenai('gpt-4.1'))Migration
Test plan
type-festissue on main)