pub struct ContextCoordinator { /* private fields */ }Expand description
The Context Engineering Engine for adk-skill.
Orchestrates the full pipeline: scoring → tool validation → context construction.
Guarantees that the emitted SkillContext always has its active_tools aligned
with what the system_instruction tells the LLM it can do.
§Pipeline
- Selection: Scores skills against the query using
select_skills. - Validation: Checks that requested
allowed-toolsexist in theToolRegistry. - Context Engineering: Constructs a structured
system_instructionfrom the body. - Emission: Returns a safe
SkillContextorNoneif no valid match.
Implementations§
Source§impl ContextCoordinator
impl ContextCoordinator
Sourcepub fn new(
index: Arc<SkillIndex>,
registry: Arc<dyn ToolRegistry>,
config: CoordinatorConfig,
) -> Self
pub fn new( index: Arc<SkillIndex>, registry: Arc<dyn ToolRegistry>, config: CoordinatorConfig, ) -> Self
Create a new coordinator from a skill index, tool registry, and config.
Sourcepub fn build_context(&self, query: &str) -> Option<SkillContext>
pub fn build_context(&self, query: &str) -> Option<SkillContext>
Build a SkillContext for the given query.
Runs the full pipeline: score → validate tools → engineer context.
Returns None if no skill meets the policy threshold or tool validation fails.
Sourcepub fn build_context_by_name(&self, name: &str) -> Option<SkillContext>
pub fn build_context_by_name(&self, name: &str) -> Option<SkillContext>
Build a SkillContext for a skill looked up by exact name.
This bypasses scoring entirely and is useful when the caller already knows which skill to load (e.g., from a config field).
Sourcepub fn resolve(&self, strategies: &[ResolutionStrategy]) -> Option<SkillContext>
pub fn resolve(&self, strategies: &[ResolutionStrategy]) -> Option<SkillContext>
Resolve a SkillContext using a prioritized list of strategies.
This is the “Standard-Compliant” entry point for context resolution.
It attempts each strategy in order and returns the first successful SkillContext.
§Example
coordinator.resolve(&[
ResolutionStrategy::ByName("emergency".into()),
ResolutionStrategy::ByQuery("I smell gas".into()),
ResolutionStrategy::ByTag("fallback".into()),
]);