pub struct ServerConfig {
pub agent_loader: Arc<dyn AgentLoader>,
pub session_service: Arc<dyn SessionService>,
pub artifact_service: Option<Arc<dyn ArtifactService>>,
pub memory_service: Option<Arc<dyn Memory>>,
pub compaction_config: Option<EventsCompactionConfig>,
pub context_cache_config: Option<ContextCacheConfig>,
pub cache_capable: Option<Arc<dyn CacheCapable>>,
pub span_exporter: Option<Arc<AdkSpanExporter>>,
pub backend_url: Option<String>,
pub security: SecurityConfig,
pub request_context_extractor: Option<Arc<dyn RequestContextExtractor>>,
}server only.Expand description
Configuration for the ADK server.
Fields§
§agent_loader: Arc<dyn AgentLoader>§session_service: Arc<dyn SessionService>§artifact_service: Option<Arc<dyn ArtifactService>>§memory_service: Option<Arc<dyn Memory>>§compaction_config: Option<EventsCompactionConfig>§context_cache_config: Option<ContextCacheConfig>§cache_capable: Option<Arc<dyn CacheCapable>>§span_exporter: Option<Arc<AdkSpanExporter>>§backend_url: Option<String>§security: SecurityConfig§request_context_extractor: Option<Arc<dyn RequestContextExtractor>>Implementations§
Source§impl ServerConfig
impl ServerConfig
pub fn new( agent_loader: Arc<dyn AgentLoader>, session_service: Arc<dyn SessionService>, ) -> ServerConfig
pub fn with_artifact_service( self, artifact_service: Arc<dyn ArtifactService>, ) -> ServerConfig
pub fn with_artifact_service_opt( self, artifact_service: Option<Arc<dyn ArtifactService>>, ) -> ServerConfig
Sourcepub fn with_memory_service(
self,
memory_service: Arc<dyn Memory>,
) -> ServerConfig
pub fn with_memory_service( self, memory_service: Arc<dyn Memory>, ) -> ServerConfig
Configure a memory service for semantic search across sessions.
When set, the runner injects memory into the invocation context,
allowing agents to search previous conversation content via
ToolContext::search_memory().
Sourcepub fn with_compaction(
self,
compaction_config: EventsCompactionConfig,
) -> ServerConfig
pub fn with_compaction( self, compaction_config: EventsCompactionConfig, ) -> ServerConfig
Configure automatic context compaction for long-running sessions.
Sourcepub fn with_context_cache(
self,
context_cache_config: ContextCacheConfig,
cache_capable: Arc<dyn CacheCapable>,
) -> ServerConfig
pub fn with_context_cache( self, context_cache_config: ContextCacheConfig, cache_capable: Arc<dyn CacheCapable>, ) -> ServerConfig
Configure automatic prompt-cache lifecycle management for cache-capable models.
pub fn with_backend_url(self, backend_url: impl Into<String>) -> ServerConfig
pub fn with_security(self, security: SecurityConfig) -> ServerConfig
pub fn with_span_exporter( self, span_exporter: Arc<AdkSpanExporter>, ) -> ServerConfig
Sourcepub fn with_allowed_origins(self, origins: Vec<String>) -> ServerConfig
pub fn with_allowed_origins(self, origins: Vec<String>) -> ServerConfig
Configure allowed CORS origins
Sourcepub fn with_max_body_size(self, size: usize) -> ServerConfig
pub fn with_max_body_size(self, size: usize) -> ServerConfig
Configure maximum request body size
Sourcepub fn with_request_timeout(self, timeout: Duration) -> ServerConfig
pub fn with_request_timeout(self, timeout: Duration) -> ServerConfig
Configure request timeout
Sourcepub fn with_error_details(self, expose: bool) -> ServerConfig
pub fn with_error_details(self, expose: bool) -> ServerConfig
Enable detailed error messages (for development only)
Sourcepub fn with_request_context(
self,
extractor: Arc<dyn RequestContextExtractor>,
) -> ServerConfig
pub fn with_request_context( self, extractor: Arc<dyn RequestContextExtractor>, ) -> ServerConfig
Configure a request context extractor for auth middleware bridging.
When set, the server invokes the extractor on each incoming request
to extract authenticated identity (user_id, scopes, metadata) from
HTTP headers. The extracted context flows into InvocationContext,
making scopes available via ToolContext::user_scopes().
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ServerConfig
impl !RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnsafeUnpin for ServerConfig
impl !UnwindSafe for ServerConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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