Skip to main content

A2aServerBuilder

Struct A2aServerBuilder 

Source
pub struct A2aServerBuilder { /* private fields */ }
Available on crate feature server only.
Expand description

Builder for configuring an A2A server with custom settings.

Allows customization of the agent card metadata, session service, bind address, and capabilities before building the server app.

§Defaults

  • Session service: InMemorySessionService
  • Bind address: 0.0.0.0:8080
  • Agent card name: from agent.name()
  • Agent card description: from agent.description()
  • Agent card version: "1.0.0"
  • Agent card URL: http://localhost:8080
  • Streaming: enabled
  • Push notifications: disabled

Implementations§

Source§

impl A2aServerBuilder

Source

pub fn agent(self, agent: Arc<dyn Agent>) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Set the agent to expose via A2A protocol.

This is required — the builder will return an error if no agent is set.

Source

pub fn session_service( self, service: Arc<dyn SessionService>, ) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Set a custom session service implementation.

Defaults to InMemorySessionService if not specified.

Source

pub fn bind_addr(self, addr: impl Into<String>) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Set the bind address for the server.

Defaults to "0.0.0.0:8080".

Source

pub fn agent_card_name(self, name: impl Into<String>) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Override the agent card name.

Defaults to agent.name().

Source

pub fn agent_card_description(self, desc: impl Into<String>) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Override the agent card description.

Defaults to agent.description().

Source

pub fn agent_card_version(self, version: impl Into<String>) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Override the agent card version.

Defaults to "1.0.0".

Source

pub fn agent_card_url(self, url: impl Into<String>) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Override the agent card URL.

Defaults to "http://localhost:8080".

Source

pub fn streaming(self, enabled: bool) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Enable or disable streaming support.

Defaults to true.

Source

pub fn push_notifications(self, enabled: bool) -> A2aServerBuilder

Available on crate feature a2a-v1 only.

Enable or disable push notifications.

Defaults to false.

Source

pub fn build(self) -> Result<A2aServerApp, AdkError>

Available on crate feature a2a-v1 only.

Build the configured A2A server application.

§Errors

Returns an error if:

  • No agent was provided (call .agent(my_agent))
  • The agent has an empty name
§Example
let server = A2aServer::builder()
    .agent(my_agent)
    .build()?;

Trait Implementations§

Source§

impl Default for A2aServerBuilder

Source§

fn default() -> A2aServerBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more