pub struct A2AServer {
pub agent_card: AgentCard,
pub registry: AgentCardRegistry,
pub profile_store: ProfileStore,
/* private fields */
}Expand description
A2A server for handling incoming JSON-RPC requests.
This is a protocol server (request router + in-memory task store), not a network server. A shell crate is responsible for exposing it over HTTP/SSE.
Fields§
§agent_card: AgentCardThis agent’s card.
registry: AgentCardRegistryRegistry of known agents.
profile_store: ProfileStoreProfile store for bearer token authentication.
Implementations§
Source§impl A2AServer
impl A2AServer
Sourcepub fn new(agent_card: AgentCard) -> A2AServer
pub fn new(agent_card: AgentCard) -> A2AServer
Create a new A2A server for the given agent card.
Sourcepub fn handle_request(&self, request: A2ARequest) -> A2AResponse
pub fn handle_request(&self, request: A2ARequest) -> A2AResponse
Handle an incoming JSON-RPC request.
Sourcepub fn handle_request_with_auth(
&self,
request: A2ARequest,
auth_token: Option<&str>,
) -> A2AResponse
pub fn handle_request_with_auth( &self, request: A2ARequest, auth_token: Option<&str>, ) -> A2AResponse
Handle an incoming JSON-RPC request with an optional bearer token.
Sourcepub fn get_task_caller(&self, task_id: &str) -> Option<AgentProfile>
pub fn get_task_caller(&self, task_id: &str) -> Option<AgentProfile>
Get the caller profile for a task (if known).
Sourcepub fn subscribe_events(&self) -> Receiver<A2ATaskEvent>
pub fn subscribe_events(&self) -> Receiver<A2ATaskEvent>
Subscribe to task lifecycle events for streaming adapters.
Sourcepub fn list_tasks(&self) -> Vec<A2ATask>
pub fn list_tasks(&self) -> Vec<A2ATask>
List currently known tasks.
Sourcepub fn update_task_status(
&self,
task_id: &str,
status: TaskStatus,
) -> Result<(), String>
pub fn update_task_status( &self, task_id: &str, status: TaskStatus, ) -> Result<(), String>
Update task status (for internal use).
Sourcepub fn update_task_status_with_reason(
&self,
task_id: &str,
status: TaskStatus,
reason: impl Into<String>,
) -> Result<(), String>
pub fn update_task_status_with_reason( &self, task_id: &str, status: TaskStatus, reason: impl Into<String>, ) -> Result<(), String>
Update task status and message for internal execution bridges.
Sourcepub fn update_task_progress(
&self,
task_id: &str,
progress: RemoteTaskProgress,
) -> Result<(), String>
pub fn update_task_progress( &self, task_id: &str, progress: RemoteTaskProgress, ) -> Result<(), String>
Report in-flight task progress for internal execution bridges.
Sourcepub fn add_message(
&self,
task_id: &str,
message: A2AMessage,
) -> Result<(), String>
pub fn add_message( &self, task_id: &str, message: A2AMessage, ) -> Result<(), String>
Append a message to a task for final result delivery.
Auto Trait Implementations§
impl !Freeze for A2AServer
impl RefUnwindSafe for A2AServer
impl Send for A2AServer
impl Sync for A2AServer
impl Unpin for A2AServer
impl UnwindSafe for A2AServer
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].