Skip to content

refactor(agents): remove registry, Model accepts LanguageModel only#29

Merged
zrosenbauer merged 5 commits intomainfrom
refactor/remove-registry-from-agents
Mar 18, 2026
Merged

refactor(agents): remove registry, Model accepts LanguageModel only#29
zrosenbauer merged 5 commits intomainfrom
refactor/remove-registry-from-agents

Conversation

@zrosenbauer
Copy link
Member

Summary

  • Remove registry field from AgentConfig — no longer needed
  • Change Model type from string | LanguageModel to just LanguageModel
  • Remove resolveModel() utility function and all related tests
  • Remove deprecated ModelRef type alias export
  • Update JSDoc examples to use AI SDK provider instances directly (e.g. openai('gpt-4.1'))

Migration

- import { agent } from '@funkai/agents'
- import { createProviderRegistry } from '@funkai/models'
+ import { agent } from '@funkai/agents'
+ import { openai } from '@ai-sdk/openai'

  const myAgent = agent({
    name: 'my-agent',
-   model: 'openai/gpt-4.1',
-   registry,
+   model: openai('gpt-4.1'),
    system: 'You are helpful.',
  })

Test plan

  • All 548 runtime tests pass
  • No new type errors (only pre-existing type-fest issue on main)

…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-bot
Copy link

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: 50eb770

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

This PR includes changesets to release 1 package
Name Type
@funkai/agents Minor

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

@vercel
Copy link

vercel bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
funkai Ignored Ignored Preview Mar 18, 2026 10:45pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3f9bbc28-9354-4ee0-8fe7-d685cfe9eb18

📥 Commits

Reviewing files that changed from the base of the PR and between 646bf60 and 50eb770.

📒 Files selected for processing (3)
  • .changeset/remove-registry-from-agents.md
  • packages/agents/src/core/agents/base/agent.test.ts
  • packages/agents/src/core/agents/base/agent.ts
💤 Files with no reviewable changes (1)
  • packages/agents/src/core/agents/base/agent.test.ts

📝 Walkthrough

Walkthrough

Removes registry-based string model resolution: AgentConfig.registry deleted, resolveModel removed, and Model narrowed to LanguageModel. Agents now accept LanguageModel instances (e.g., openai("gpt-4.1")) directly.

Changes

Cohort / File(s) Summary
Type definitions
packages/agents/src/core/types.ts, packages/agents/src/core/agents/base/types.ts, packages/agents/src/index.ts
Removed registry?: ProviderRegistry from AgentConfig; changed Model from `string
Utilities
packages/agents/src/core/agents/base/utils.ts, packages/agents/src/core/agents/base/utils.test.ts
Deleted resolveModel() and its imports/exports; removed tests that validated string-ID → registry resolution.
Agent implementation & tests
packages/agents/src/core/agents/base/agent.ts, packages/agents/src/core/agents/base/agent.test.ts
Removed calls to resolveModel/registry; agent uses provided LanguageModel instances directly; removed tests for string-ID resolution and missing-registry errors.
Examples & manifests
examples/*/package.json, examples/*/src/index.ts
Added @ai-sdk/openai to several examples and replaced string model IDs with openai("...") calls across example projects.
Changeset
.changeset/remove-registry-from-agents.md
Added changeset noting minor version bump for @funkai/agents and removal of registry-based model resolution.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: removing registry support and restricting Model to LanguageModel instances only.
Description check ✅ Passed The description is directly related to the changeset, providing clear summary, migration example, and test plan that align with the implemented changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

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

zrosenbauer and others added 2 commits March 18, 2026 18:29
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>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between f802c23 and a061ab8.

📒 Files selected for processing (8)
  • .changeset/remove-registry-from-agents.md
  • packages/agents/src/core/agents/base/agent.test.ts
  • packages/agents/src/core/agents/base/agent.ts
  • packages/agents/src/core/agents/base/types.ts
  • packages/agents/src/core/agents/base/utils.test.ts
  • packages/agents/src/core/agents/base/utils.ts
  • packages/agents/src/core/types.ts
  • packages/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

zrosenbauer and others added 2 commits March 18, 2026 18:43
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@zrosenbauer
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@zrosenbauer zrosenbauer merged commit c9733c9 into main Mar 18, 2026
5 checks passed
@zrosenbauer zrosenbauer deleted the refactor/remove-registry-from-agents branch March 18, 2026 22:55
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