pub struct ContextCoordinator { /* private fields */ }skills only.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,
) -> ContextCoordinator
pub fn new( index: Arc<SkillIndex>, registry: Arc<dyn ToolRegistry>, config: CoordinatorConfig, ) -> ContextCoordinator
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()),
]);Auto Trait Implementations§
impl Freeze for ContextCoordinator
impl !RefUnwindSafe for ContextCoordinator
impl Send for ContextCoordinator
impl Sync for ContextCoordinator
impl Unpin for ContextCoordinator
impl UnsafeUnpin for ContextCoordinator
impl !UnwindSafe for ContextCoordinator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request