pub struct A2ASession {
pub id: String,
pub agent: String,
pub ttl_secs: u64,
pub max_concurrent: usize,
pub task: TaskStateMachine,
}Expand description
One A2A task session (DW-114), mirroring MCP’s session model: a
session id, a TTL, and a max-concurrent cap. The session is a
correlation handle for an agent-to-agent task exchange and owns a
TaskStateMachine tracking the task’s lifecycle state.
Fields§
§id: StringThe session id (a 128-bit hex handle, unique per process).
agent: StringThe agent name this session is bound to.
ttl_secs: u64Session TTL in seconds.
max_concurrent: usizeMax concurrent sessions.
task: TaskStateMachineThe task lifecycle state machine for this session’s task.
Implementations§
Source§impl A2ASession
impl A2ASession
Sourcepub fn new(agent: &str, ttl_secs: u64, max_concurrent: usize) -> Self
pub fn new(agent: &str, ttl_secs: u64, max_concurrent: usize) -> Self
Create a new session for agent, using the configured session
policy (or the defaults when none is set). The task starts in
the Submitted state.
Sourcepub fn task_state(&self) -> TaskLifecycle
pub fn task_state(&self) -> TaskLifecycle
The current task lifecycle state.
Sourcepub fn start_work(&mut self) -> Result<TaskLifecycle, A2AError>
pub fn start_work(&mut self) -> Result<TaskLifecycle, A2AError>
Start processing the task (Submitted -> Working). Delegates to
the session’s TaskStateMachine.
Sourcepub fn complete(&mut self) -> Result<TaskLifecycle, A2AError>
pub fn complete(&mut self) -> Result<TaskLifecycle, A2AError>
Mark the task as completed (Working -> Completed).
Sourcepub fn fail(&mut self) -> Result<TaskLifecycle, A2AError>
pub fn fail(&mut self) -> Result<TaskLifecycle, A2AError>
Mark the task as failed (Submitted|Working -> Failed).
Sourcepub fn cancel(&mut self) -> Result<TaskLifecycle, A2AError>
pub fn cancel(&mut self) -> Result<TaskLifecycle, A2AError>
Cancel the task (Submitted|Working -> Canceled).
Trait Implementations§
Source§impl Clone for A2ASession
impl Clone for A2ASession
Source§fn clone(&self) -> A2ASession
fn clone(&self) -> A2ASession
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 A2ASession
impl RefUnwindSafe for A2ASession
impl Send for A2ASession
impl Sync for A2ASession
impl Unpin for A2ASession
impl UnwindSafe for A2ASession
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§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