pub struct Runner { /* private fields */ }runner only.Implementations§
Source§impl Runner
impl Runner
Sourcepub fn builder() -> RunnerConfigBuilder<NoAppName, NoAgent, NoSessionService>
pub fn builder() -> RunnerConfigBuilder<NoAppName, NoAgent, NoSessionService>
Create a typestate builder for constructing a Runner.
The builder enforces at compile time that the three required fields
(app_name, agent, session_service) are set before build() is
callable.
§Example
let runner = Runner::builder()
.app_name("my-app")
.agent(agent)
.session_service(session_service)
.build()?;pub fn new(config: RunnerConfig) -> Result<Runner, AdkError>
Sourcepub fn with_skill_injector(self, injector: SkillInjector) -> Runner
pub fn with_skill_injector(self, injector: SkillInjector) -> Runner
Enable skill injection using a pre-built injector.
Skill injection runs before plugin on_user_message callbacks.
Sourcepub fn with_auto_skills(
self,
root: impl AsRef<Path>,
config: SkillInjectorConfig,
) -> Result<Runner, SkillError>
👎Deprecated: Use with_auto_skills_mut instead
pub fn with_auto_skills( self, root: impl AsRef<Path>, config: SkillInjectorConfig, ) -> Result<Runner, SkillError>
Use with_auto_skills_mut instead
Enable skill injection by auto-loading .skills/ from the given root path.
Sourcepub fn with_auto_skills_mut(
&mut self,
root: impl AsRef<Path>,
config: SkillInjectorConfig,
) -> Result<(), SkillError>
pub fn with_auto_skills_mut( &mut self, root: impl AsRef<Path>, config: SkillInjectorConfig, ) -> Result<(), SkillError>
Enable skill injection by auto-loading .skills/ from the given root path.
Unlike with_auto_skills, this method borrows
the Runner mutably instead of consuming it. On error, the Runner remains
valid with no skill injector configured.
pub async fn run( &self, user_id: UserId, session_id: SessionId, user_content: Content, ) -> Result<Pin<Box<dyn Stream<Item = Result<Event, AdkError>> + Send>>, AdkError>
Sourcepub async fn run_str(
&self,
user_id: &str,
session_id: &str,
user_content: Content,
) -> Result<Pin<Box<dyn Stream<Item = Result<Event, AdkError>> + Send>>, AdkError>
pub async fn run_str( &self, user_id: &str, session_id: &str, user_content: Content, ) -> Result<Pin<Box<dyn Stream<Item = Result<Event, AdkError>> + Send>>, AdkError>
Sourcepub fn interrupt(&self, session_id: &str) -> bool
pub fn interrupt(&self, session_id: &str) -> bool
Interrupt a running agent for the given session.
Cancels the agent’s current execution within the event loop. Events
already produced and appended to the session are preserved — only
future events are stopped. The caller can then issue a new run()
call with a different instruction to redirect the agent.
Returns true if a running session was found and interrupted,
false if no active run exists for that session ID.
§Example
// Start a run in the background
let mut stream = runner.run(user_id, session_id, content).await?;
tokio::spawn(async move { while stream.next().await.is_some() {} });
// Later, interrupt it
let was_running = runner.interrupt("session-1");
assert!(was_running);
// Redirect with a new instruction
let mut stream = runner.run(user_id, session_id, new_content).await?;Sourcepub fn active_session_ids(&self) -> Vec<String>
pub fn active_session_ids(&self) -> Vec<String>
Returns the session IDs of all currently running agent executions.
Sourcepub fn find_agent_to_run(
root_agent: &Arc<dyn Agent>,
session: &dyn Session,
) -> Arc<dyn Agent> ⓘ
pub fn find_agent_to_run( root_agent: &Arc<dyn Agent>, session: &dyn Session, ) -> Arc<dyn Agent> ⓘ
Find which agent should handle the request based on session history
Sourcepub fn find_agent(
current: &Arc<dyn Agent>,
target_name: &str,
) -> Option<Arc<dyn Agent>>
pub fn find_agent( current: &Arc<dyn Agent>, target_name: &str, ) -> Option<Arc<dyn Agent>>
Recursively search agent tree for agent with given name
Sourcepub fn compute_transfer_context(
root: &Arc<dyn Agent>,
target_name: &str,
) -> (Option<String>, Vec<String>)
pub fn compute_transfer_context( root: &Arc<dyn Agent>, target_name: &str, ) -> (Option<String>, Vec<String>)
Compute the parent name and peer names for a given agent in the tree.
Returns (parent_name, peer_names).
Walks the agent tree to find the parent of target_name, then collects
the parent’s name and the sibling agent names (excluding the target itself).
Auto Trait Implementations§
impl Freeze for Runner
impl !RefUnwindSafe for Runner
impl Send for Runner
impl Sync for Runner
impl Unpin for Runner
impl UnsafeUnpin for Runner
impl !UnwindSafe for Runner
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