agora.fleet.profiles
Model + card run profiles — the primary inference-config source.
A ModelProfile is a self-contained spec for a run’s model
configuration: model id, num_ctx, max_tokens, keep_alive, timeout, plus
Ollama/VRAM sub-sections. Every inference parameter that previously
needed an env var or was hardcoded is expressible here, so a normal
AGORA_PROFILE=<name> python scripts/run_discord_bot_test.py run
needs no other env vars.
Per-field env overrides remain as a secondary escape hatch — see
apply_env_overrides(). The precedence is:
env override > profile value > schema default
Loaders look up profiles.yaml in this order: explicit path arg,
AGORA_PROFILES_FILE env var, ./profiles.yaml at CWD, then a
packaged default that reproduces today’s framework default
(ollama/qwen2.5:7b-instruct with the historical knobs).
The factory built by build_llm_factory() returns an
LLMProtocol adapter and is what
agora.plan.harness.build_orchestrator() uses when a profile is
supplied. Legacy (no-profile) callers keep working unchanged.
Finding: the profile is the MODEL-IDENTITY half of the axis-1 orthogonality —
a campaign’s params layer as explicit OVERRIDES on top of it (profile = who
the model is; campaign = the experiment’s conditions). F19 (“wire, don’t
delete”) is the rule that such a parameter surface must actually reach the model
AND be logged as the effective set: an inert config knob that silently does
nothing is worse than a missing one, because it fakes provenance. The override
wiring + effective-param logging live in the phased runner
(scripts/run_phased.py:apply_campaign_params / format_effective_params).
Functions
|
Return a copy of |
|
Return a factory that resolves |
|
Load a |
|
The profile's Ollama endpoint override, or the injected |
Classes
Complete inference-config spec for one run. |
|
Ollama-daemon-specific knobs that live with the profile. |
|
A versioned bundle of named profiles plus a default selection. |
|
VRAM-pre-flight knobs that live with the profile. |
- class agora.fleet.profiles.ModelProfile[source]
Bases:
BaseModelComplete inference-config spec for one run.
Any field not set in a YAML profile falls back to the defaults encoded here. Typos in field names raise a pydantic validation error (
extra='forbid') so silent no-ops are impossible.- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- ollama: OllamaProfile
- vram: VRAMProfile
- class agora.fleet.profiles.OllamaProfile[source]
Bases:
BaseModelOllama-daemon-specific knobs that live with the profile.
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class agora.fleet.profiles.ProfileSet[source]
Bases:
BaseModelA versioned bundle of named profiles plus a default selection.
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- profiles: dict[str, ModelProfile]
- class agora.fleet.profiles.VRAMProfile[source]
Bases:
BaseModelVRAM-pre-flight knobs that live with the profile.
- model_config = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- agora.fleet.profiles.apply_env_overrides(profile, env=None)[source]
Return a copy of
profilewith per-field env overrides applied.Pure function — no side effects, no global state. Useful for tests that want to probe override behavior with a synthetic env mapping rather than mutating
os.environ.Recognised env vars (each overrides exactly one field):
AGORA_LLM_MODEL→modelAGORA_LLM_NUM_CTX→num_ctx(""/"none"/"null"/"0"collapse toNoneso callers can defer to Ollama’s own default)AGORA_LLM_MAX_TOKENS→max_tokensAGORA_LLM_TEMPERATURE→temperatureAGORA_LLM_SEED→seed(""/"none"/"null"/"0"collapse toNoneso callers can defer to Ollama’s own default seed — mirrorsnum_ctx)AGORA_LLM_TIMEOUT_SECONDS→timeout_secondsAGORA_OLLAMA_BASE_URL→ollama.base_urlAGORA_OLLAMA_NUM_PARALLEL→ollama.num_parallelAGORA_OLLAMA_KEEP_ALIVE→keep_aliveAGORA_VRAM_SAFETY_MARGIN_MIB→vram.safety_margin_mib
- agora.fleet.profiles.build_llm_factory(profile, base_url)[source]
Return a factory that resolves
model_refagainstprofile.base_urlis the resolved Ollama endpoint (profile override or the injected Settings default) — passed explicitly because profiles no longer carry a localhost default. Useresolve_base_url()to compute it.An empty
model_ref(the v2.3 plan-builder emits agents withmodel=""because the model can’t reliably guess a valid id, so the harness owns the runtime choice) falls back toprofile.model. A non-emptymodel_ref(per-role override viaAgentConfig.model) routes through the same per-provider knobs — same base_url, num_ctx, keep_alive, max_concurrent, timeout — so a mixed-model run inherits the profile’s tuning rather than reverting to adapter defaults.For
ollama/*(the only supported backend): passes base_url, num_ctx, max_concurrent (=``ollama.num_parallel``), keep_alive, default_max_tokens, and the sampling controls.
- agora.fleet.profiles.load_profiles(path=None)[source]
Load a
ProfileSetfrom disk, or fall back to the packaged default.- Precedence:
pathargument when supplied (composition roots passSettings.profiles_file, which is sourced fromAGORA_PROFILES_FILE; this library never reads the env itself)./profiles.yamlin the current working directoryPackaged default (so tests and fresh clones work with no file).
YAML parse errors and pydantic validation failures both surface as
AgoraErrorwith the offending path attached.