Skip to content

Auto runtime selection with plugin harness registry #1939

Description

@MervinPraison

Problem

When runtime: auto is set on a model, there is no principled way to pick among plugin harnesses that support a given provider/model pair. Users must hard-code runtime ids or rely on agent-level cli_backend.

Current state

  • CLI backend registry in praisonai/cli_backends/registry.py lists ids but does not score by supports(provider, model) or priority.
  • Model router in praisonaiagents/llm/ selects LLM endpoints without runtime harness matching.
  • Entry points: praisonai.cli_backends group; no parallel praisonai.runtimes auto-selection contract.

Proposed design

  • Extend AgentRuntimeProtocol with supports(provider: str, model: str) -> bool and optional selection_priority() -> int (lower = preferred), mirroring harness selection patterns used elsewhere in the wrapper registry.
  • auto resolution in model-scoped policy: filter registered runtimes by supports, sort by priority, fall back to praisonai default.
  • Plugin packages (PraisonAI-Plugins) register runtimes via entry points with declared provider/model prefixes.
  • Log chosen runtime id at debug level for observability.

Acceptance criteria

  • auto selects highest-priority supporting runtime in unit tests with multiple registered harnesses.
  • Tie-breaking and empty-match fallback to praisonai documented and tested.
  • No import-time scan of heavy plugin deps; lazy load factories on selection only.

Layer

Primary: core (selection algorithm in praisonaiagents/runtime/resolve.py)

Secondary: plugins (harness registration), wrapper (entry point wiring)

3-way parity (Python / YAML / CLI)

Surface Supported
Python yes
YAML yes — runtime: auto on model entries
CLI yes — inherits from agent run model config

Priority

P2

Related modules

praisonaiagents/runtime/registry.py, praisonai/cli_backends/registry.py, praisonaiagents/llm/, praisonaiagents/plugins/

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaudeAuto-trigger Claude analysis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions