Skip to content

feat: add per-agent runtime model-binding primitive#416

Merged
chubes4 merged 1 commit into
mainfrom
feat/agent-runtime-model-primitive
Jul 6, 2026
Merged

feat: add per-agent runtime model-binding primitive#416
chubes4 merged 1 commit into
mainfrom
feat/agent-runtime-model-primitive

Conversation

@chubes4

@chubes4 chubes4 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a first-class WP_Agent_Runtime_Profile value object for resolved per-agent { provider_id, model_id, identity, provenance } bindings.
  • Adds WP_Agent_Runtime_Profile_Provider so hosts can supply generic runtime profile providers without Agents API depending on any product-specific schema.
  • Adds WP_Agent_Runtime_Profile_Resolver plus wp_resolve_agent_runtime_profile() and wires them into the plugin bootstrap.
  • Adds a standalone smoke test covering context overrides, mode/default config resolution, host provider precedence, stable to_array() shape, and product-neutral coupling.

Resolution order

Per field, the resolver applies:

  1. Explicit context override: provider_id / model_id, or model.provider_id / model.model_id.
  2. WP_Agent_Runtime_Overrides from context or the agent.
  3. Host-provided runtime profile providers from context plus the agents_api_runtime_profile_providers filter.
  4. Config arrays in order: context agent_config, materialized identity config, then agent default_config.

Provider and model resolve independently, with per-field provenance recording { source, path }. Empty strings are preserved as explicit bindings so the existing provider adapter can still decide whether to use its own defaults.

Smoke output

agents-api-runtime-profile-smoke
  PASS agent registered for runtime profile smoke
  PASS explicit provider override wins
  PASS explicit nested model override wins
  PASS explicit provider provenance records context override
  PASS mode provider resolves from default config
  PASS mode model resolves from default config
  PASS mode provider provenance path is stable
  PASS mode model provenance path is stable
  PASS default provider resolves without mode match
  PASS default model resolves without mode match
  PASS host profile provider is honored before config
  PASS host profile model is honored before config
  PASS runtime profile to_array shape is stable

All 13 Agents API runtime profile assertions passed.

Non-goals

  • No consumer-specific coupling or product-specific schema in Agents API.
  • Auth binding remains with the caller/adapter layer.
  • Conversation-loop convenience wiring is a follow-up.

Closes #415

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude via opencode
  • Used for: Implementation

@chubes4 chubes4 merged commit 0160be2 into main Jul 6, 2026
2 checks passed
@chubes4 chubes4 deleted the feat/agent-runtime-model-primitive branch July 6, 2026 17:26
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.

Add per-agent runtime model-binding primitive (resolve {provider, model, provenance} for an agent)

1 participant