Skip to content

feat(agentbase): add shared model-forwarding helpers#3025

Open
anuj7511 wants to merge 1 commit into
AgentWrapper:mainfrom
anuj7511:fix/agentbase-model-helpers
Open

feat(agentbase): add shared model-forwarding helpers#3025
anuj7511 wants to merge 1 commit into
AgentWrapper:mainfrom
anuj7511:fix/agentbase-model-helpers

Conversation

@anuj7511

Copy link
Copy Markdown
Contributor

Summary

Adds two reusable helpers to agentbase so adapters whose CLI accepts a launch-time --model override can forward the resolved ports.AgentConfig.Model through one tested implementation, instead of each adapter re-implementing the same trim-and-append plus a hand-written config-field literal:

  • AppendModelFlag(cmd, cfg) — appends --model <trimmed> when the configured model is non-blank; no-op otherwise.
  • ModelConfigField(description) — the standard user-facing model config field.

Context

AO stores a per-role model in agentConfig.model; session_manager.effectiveAgentConfig resolves it and forwards it to every adapter as cfg.Config.Model, but each adapter must opt in to passing it to its CLI. A family of ~15 adapters currently drops it. This is the shared base those adapter fixes build on.

The opt-in stays per-adapter by design: agentbase never forces the field on embedders, so adapters whose CLI spells the override differently (a config-file key, a -m-only alias) are unaffected. Adapters just call the helpers where they apply.

Tests

New agentbase_test.go covers AppendModelFlag (trimmed append / blank no-op) and ModelConfigField.

cd backend && go test ./internal/adapters/agent/agentbase

go build ./..., go vet, and gofmt are clean.

Follow-ups

The per-adapter fixes rebase onto this base as independent, single-adapter PRs (Cursor #2926, Devin #2927, then the remaining sisters).

Add AppendModelFlag and ModelConfigField to agentbase so adapters whose
CLI accepts a launch-time --model override can forward the resolved
ports.AgentConfig.Model through one tested implementation instead of
each re-implementing the same trim-and-append plus config-field literal.

AppendModelFlag appends --model <trimmed> when the configured model is
non-blank and is a no-op otherwise; ModelConfigField returns the
standard user-facing model config field. The opt-in stays per-adapter:
agentbase never forces the field on embedders, so adapters whose CLI
spells the override differently (a config-file key, a -m-only alias) are
unaffected.
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