pub struct EndpointRegistry { /* private fields */ }Expand description
Registry of all configured endpoints with routing logic.
Implementations§
Source§impl EndpointRegistry
impl EndpointRegistry
Sourcepub fn from_config(
endpoints: &HashMap<String, EndpointConfig>,
fallback_llm: Option<&LlmConfig>,
defaults: EndpointDefaults,
) -> Self
pub fn from_config( endpoints: &HashMap<String, EndpointConfig>, fallback_llm: Option<&LlmConfig>, defaults: EndpointDefaults, ) -> Self
Builds a registry from the endpoint definitions in scenario config.
Falls back to a default LLM endpoint derived from fallback_llm
(the runner’s effective config — CLI arguments merged over env vars
and scenario fields) when no [config.endpoints] are defined, so
--llm-url / --llm-model / --llm-api-key are honored even for
scenarios without an explicit endpoint table. Without a fallback,
environment variables are used.
Sourcepub fn get(&self, name: &str) -> Option<&ResolvedEndpoint>
pub fn get(&self, name: &str) -> Option<&ResolvedEndpoint>
Resolves an endpoint by explicit name.
Returns None if no endpoint with the given name exists.
Sourcepub fn resolve_for_task(&self, task: TaskType) -> &ResolvedEndpoint
pub fn resolve_for_task(&self, task: TaskType) -> &ResolvedEndpoint
Resolves the best endpoint for a given task type.
Checks for a default_for mapping first, then falls back to any LLM
endpoint, then panics (config error).
Sourcepub fn resolve(&self, name: Option<&str>, task: TaskType) -> &ResolvedEndpoint
pub fn resolve(&self, name: Option<&str>, task: TaskType) -> &ResolvedEndpoint
Resolves an endpoint: explicit name takes priority, then task-type routing, then first LLM endpoint.
Sourcepub fn resolve_chain(
&self,
name: Option<&str>,
task: TaskType,
) -> Vec<&ResolvedEndpoint>
pub fn resolve_chain( &self, name: Option<&str>, task: TaskType, ) -> Vec<&ResolvedEndpoint>
Resolves the ordered call chain for a task: the primary endpoint
followed by its fallbacks (LLM endpoints only, deduplicated,
cycle-guarded, max 8 hops). Every LLM call goes through this chain —
the primary endpoint gets its own max_attempts retry budget, then
each fallback in turn, until one answers.
Example: a cheap primary (default) with a more powerful fallback
(pro) can be declared as
fallbacks = ["pro"] on the default endpoint.