pub struct Launcher { /* private fields */ }Expand description
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>) -> Self
pub fn app_name(self, name: impl Into<String>) -> Self
Set a custom application name (defaults to agent name).
Sourcepub fn with_artifact_service(self, service: Arc<dyn ArtifactService>) -> Self
pub fn with_artifact_service(self, service: Arc<dyn ArtifactService>) -> Self
Set a custom artifact service.
Sourcepub fn with_session_service(self, service: Arc<dyn SessionService>) -> Self
pub fn with_session_service(self, service: Arc<dyn SessionService>) -> Self
Set a custom session service.
Sourcepub fn with_memory_service(self, service: Arc<dyn Memory>) -> Self
pub fn with_memory_service(self, service: Arc<dyn Memory>) -> Self
Set a custom memory service.
Sourcepub fn with_compaction(self, config: EventsCompactionConfig) -> Self
pub fn with_compaction(self, config: EventsCompactionConfig) -> Self
Enable runner-level context compaction in serve mode.
Sourcepub fn with_context_cache(
self,
config: ContextCacheConfig,
cache_capable: Arc<dyn CacheCapable>,
) -> Self
pub fn with_context_cache( self, config: ContextCacheConfig, cache_capable: Arc<dyn CacheCapable>, ) -> Self
Enable automatic prompt cache lifecycle management in serve mode.
Sourcepub fn with_security_config(self, config: SecurityConfig) -> Self
pub fn with_security_config(self, config: SecurityConfig) -> Self
Set custom server security settings.
Sourcepub fn with_request_context_extractor(
self,
extractor: Arc<dyn RequestContextExtractor>,
) -> Self
pub fn with_request_context_extractor( self, extractor: Arc<dyn RequestContextExtractor>, ) -> Self
Set a request context extractor for authenticated deployments.
Sourcepub fn with_a2a_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_a2a_base_url(self, base_url: impl Into<String>) -> Self
Enable A2A routes when building or serving the HTTP app.
Sourcepub fn with_telemetry(self, config: TelemetryConfig) -> Self
pub fn with_telemetry(self, config: TelemetryConfig) -> Self
Configure how serve mode initializes telemetry.
Sourcepub fn with_shutdown_grace_period(self, grace_period: Duration) -> Self
pub fn with_shutdown_grace_period(self, grace_period: Duration) -> Self
Set the maximum graceful shutdown window for the web server.
Sourcepub fn with_streaming_mode(self, mode: StreamingMode) -> Self
pub fn with_streaming_mode(self, mode: StreamingMode) -> Self
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) -> Self
pub fn with_thinking_mode(self, mode: ThinkingDisplayMode) -> Self
Control how emitted thinking content is rendered in console mode.
Sourcepub async fn run(self) -> Result<()>
pub async fn run(self) -> Result<()>
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<()>
pub async fn run_console_directly(self) -> Result<()>
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>
pub fn build_app(self) -> Result<Router>
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> 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