agora.fleet.strategies

Per-model prompting strategies (axis-1 v2, Phase 3).

A strategy is a small, model-specific transform applied to the three inputs of one complete() call — the system prompt, the tool manifest, and the message history — to compensate for a documented prompting mismatch (see docs/research/prompting-strategies.md). Strategies never touch tool execution or the assistant-turn / tool-result shaping; those pass through untouched.

The mechanism is a wrapper, never a modification of the underlying adapter: StrategyAdapter composes over any LLMProtocol implementation and applies the strategy’s three wrap_* hooks around complete. The base Strategy is identity on all three, so a strategy overrides only the hook its mismatch requires.

Selection travels by name (campaign YAML → AGORA_STRATEGY env → runner), mirroring the AGORA_ARM_* pattern. strategy is None means no wrapper is constructed at all — the null path is byte-identical to axis-1 v1 by construction, not by proof.

Module Attributes

STRATEGIES

Every selectable strategy, keyed by the name used in campaign YAML and the AGORA_STRATEGY env var.

Functions

resolve(name)

Resolve a strategy name to its instance.

Classes

Strategy

Base strategy: identity on all three wraps.

StrategyAdapter

Wrap an inner LLMProtocol, applying strategy around complete.

class agora.fleet.strategies.Strategy[source]

Bases: object

Base strategy: identity on all three wraps.

Concrete strategies subclass and override only the hook their documented mismatch requires; the other two stay identity.

name: str = ''

Registry key. Set on each concrete subclass.

wrap_system(system)[source]

Transform the system prompt before it reaches the model.

wrap_tools(tools)[source]

Transform the tool manifest before it reaches the model.

wrap_messages(messages)[source]

Transform the message history before it reaches the model.

class agora.fleet.strategies.StrategyAdapter[source]

Bases: object

Wrap an inner LLMProtocol, applying strategy around complete.

The three wrap_* hooks fire on the system / tools / messages passed to complete; format_assistant_turn and format_tool_results are passed straight through so the wire shaping is unchanged. This is a composition, not a subclass — the inner adapter is untouched.

__init__(inner, strategy)[source]
async complete(messages, system='', tools=None, model='', max_tokens=None)[source]
format_assistant_turn(response)[source]
format_tool_results(calls, results)[source]
agora.fleet.strategies.STRATEGIES: dict[str, Strategy] = {'mistral_nemo': <agora.fleet.strategies.mistral_nemo.MistralNemoStrategy object>, 'qwen2_5_coder': <agora.fleet.strategies.qwen2_5_coder.Qwen25CoderStrategy object>}

Every selectable strategy, keyed by the name used in campaign YAML and the AGORA_STRATEGY env var. load_campaign validates run.strategy against these keys, so a typo fails at load, not at run 23 of 40.

agora.fleet.strategies.resolve(name)[source]

Resolve a strategy name to its instance.

None or empty ⇒ None (no strategy; caller constructs no wrapper). An unknown non-empty name raises KeyError — callers that accept user input should validate against STRATEGIES first (load_campaign does), so reaching here with a bad name is a programming error worth failing loudly on.

Modules

mistral_nemo

mistral_nemo strategy — fold trailing tool results into a user turn.

qwen2_5_coder

qwen2_5_coder strategy — few-shot the text channel (Phase 2 design).