pub struct Launcher { /* private fields */ }cli only.Expand description
CLI launcher for running agents.
Quick way to run agents in console or server mode:
Launcher- Main entry point for CLI apps
Available with feature: cli
Launcher for running ADK agents with CLI support.
Provides console and web server modes out of the box.
§Console mode
Uses a rustyline REPL with history, Ctrl+C handling, and streaming
output that renders <think> blocks, tool calls, and inline data.
§Serve mode
Starts an Axum HTTP server with the ADK web UI.
§Note on with_streaming_mode
with_streaming_mode currently only affects console mode. ServerConfig
does not accept a RunConfig, so the setting is not forwarded to the
server. This will be addressed when ServerConfig gains that field.
Implementations§
Source§impl Launcher
impl Launcher
Sourcepub fn app_name(self, name: impl Into<String>) -> Launcher
pub fn app_name(self, name: impl Into<String>) -> Launcher
Set a custom application name (defaults to agent name).
Sourcepub fn with_artifact_service(
self,
service: Arc<dyn ArtifactService>,
) -> Launcher
pub fn with_artifact_service( self, service: Arc<dyn ArtifactService>, ) -> Launcher
Set a custom artifact service.
Sourcepub fn with_session_service(self, service: Arc<dyn SessionService>) -> Launcher
pub fn with_session_service(self, service: Arc<dyn SessionService>) -> Launcher
Set a custom session service.
Sourcepub fn with_memory_service(self, service: Arc<dyn Memory>) -> Launcher
pub fn with_memory_service(self, service: Arc<dyn Memory>) -> Launcher
Set a custom memory service.
Sourcepub fn with_compaction(self, config: EventsCompactionConfig) -> Launcher
pub fn with_compaction(self, config: EventsCompactionConfig) -> Launcher
Enable runner-level context compaction in serve mode.
Sourcepub fn with_context_cache(
self,
config: ContextCacheConfig,
cache_capable: Arc<dyn CacheCapable>,
) -> Launcher
pub fn with_context_cache( self, config: ContextCacheConfig, cache_capable: Arc<dyn CacheCapable>, ) -> Launcher
Enable automatic prompt cache lifecycle management in serve mode.
Sourcepub fn with_security_config(self, config: SecurityConfig) -> Launcher
pub fn with_security_config(self, config: SecurityConfig) -> Launcher
Set custom server security settings.
Sourcepub fn with_request_context_extractor(
self,
extractor: Arc<dyn RequestContextExtractor>,
) -> Launcher
pub fn with_request_context_extractor( self, extractor: Arc<dyn RequestContextExtractor>, ) -> Launcher
Set a request context extractor for authenticated deployments.
Sourcepub fn with_a2a_base_url(self, base_url: impl Into<String>) -> Launcher
pub fn with_a2a_base_url(self, base_url: impl Into<String>) -> Launcher
Enable A2A routes when building or serving the HTTP app.
Sourcepub fn with_telemetry(self, config: TelemetryConfig) -> Launcher
pub fn with_telemetry(self, config: TelemetryConfig) -> Launcher
Configure how serve mode initializes telemetry.
Sourcepub fn with_shutdown_grace_period(self, grace_period: Duration) -> Launcher
pub fn with_shutdown_grace_period(self, grace_period: Duration) -> Launcher
Set the maximum graceful shutdown window for the web server.
Sourcepub fn with_streaming_mode(self, mode: StreamingMode) -> Launcher
pub fn with_streaming_mode(self, mode: StreamingMode) -> Launcher
Set streaming mode for console mode.
Note: this currently only affects console mode. The server does not
yet accept a RunConfig.
Sourcepub fn with_thinking_mode(self, mode: ThinkingDisplayMode) -> Launcher
pub fn with_thinking_mode(self, mode: ThinkingDisplayMode) -> Launcher
Control how emitted thinking content is rendered in console mode.
Sourcepub async fn run(self) -> Result<(), AdkError>
pub async fn run(self) -> Result<(), AdkError>
Run the launcher, parsing CLI arguments.
- No arguments or
chat: Interactive console serve [--port PORT]: Web server with UI
Sourcepub async fn run_console_directly(self) -> Result<(), AdkError>
pub async fn run_console_directly(self) -> Result<(), AdkError>
Run in interactive console mode without parsing CLI arguments.
Use this when you already know you want console mode (e.g. from
your own CLI parser). run calls this internally.
Sourcepub fn build_app(self) -> Result<Router, AdkError>
pub fn build_app(self) -> Result<Router, AdkError>
Build the Axum application without serving it.
This is the production escape hatch for adding custom routes, middleware, metrics, or owning the serve loop yourself.
Auto Trait Implementations§
impl Freeze for Launcher
impl !RefUnwindSafe for Launcher
impl Send for Launcher
impl Sync for Launcher
impl Unpin for Launcher
impl UnsafeUnpin for Launcher
impl !UnwindSafe for Launcher
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