pub struct MessageSendParams {
pub tenant: Option<String>,
pub message: Message,
pub configuration: Option<SendMessageConfiguration>,
pub metadata: Option<Value>,
}Expand description
Parameters for the SendMessage and SendStreamingMessage methods.
Maps exactly to proto SendMessageRequest (lines 642-651 of a2a.proto).
Context is specified via message.context_id per the proto definition.
Fields§
§tenant: Option<String>Optional tenant for multi-tenancy.
message: MessageThe message to send to the agent.
configuration: Option<SendMessageConfiguration>Optional send configuration.
metadata: Option<Value>Arbitrary caller metadata attached to the request.
Implementations§
Source§impl MessageSendParams
impl MessageSendParams
Sourcepub const fn new(message: Message) -> MessageSendParams
pub const fn new(message: Message) -> MessageSendParams
Wraps a Message in the parameters for message/send.
Tenant, configuration and metadata start as None, which is what the
single-tenant default-configuration case wants. Together with
Message::user_text this is the
whole of “send this text to an agent”:
use a2a_protocol_types::message::Message;
use a2a_protocol_types::params::MessageSendParams;
let params = MessageSendParams::new(Message::user_text("m1", "hello"));
assert_eq!(params.message.text(), Some("hello"));
assert!(params.configuration.is_none());Sourcepub fn with_tenant(self, tenant: impl Into<String>) -> MessageSendParams
pub fn with_tenant(self, tenant: impl Into<String>) -> MessageSendParams
Routes this request to a named tenant.
Sourcepub fn with_configuration(
self,
configuration: SendMessageConfiguration,
) -> MessageSendParams
pub fn with_configuration( self, configuration: SendMessageConfiguration, ) -> MessageSendParams
Sets the send configuration — output modes, history length, push config, and whether to return before the task completes.
use a2a_protocol_types::message::Message;
use a2a_protocol_types::params::{MessageSendParams, SendMessageConfiguration};
let params = MessageSendParams::new(Message::user_text("m1", "hello"))
.with_configuration(SendMessageConfiguration {
return_immediately: Some(true),
..SendMessageConfiguration::default()
});
assert_eq!(
params.configuration.and_then(|c| c.return_immediately),
Some(true)
);Sourcepub fn with_metadata(self, metadata: Value) -> MessageSendParams
pub fn with_metadata(self, metadata: Value) -> MessageSendParams
Attaches opaque metadata to the request itself, as distinct from
Message::with_metadata,
which attaches it to the message the agent receives.
Trait Implementations§
Source§impl AcceptedFields for MessageSendParams
impl AcceptedFields for MessageSendParams
Source§fn accepted_fields() -> &'static [&'static str]
fn accepted_fields() -> &'static [&'static str]
Source§impl Clone for MessageSendParams
impl Clone for MessageSendParams
Source§fn clone(&self) -> MessageSendParams
fn clone(&self) -> MessageSendParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MessageSendParams
impl Debug for MessageSendParams
Source§impl<'de> Deserialize<'de> for MessageSendParams
impl<'de> Deserialize<'de> for MessageSendParams
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageSendParams, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MessageSendParams, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for MessageSendParams
impl Serialize for MessageSendParams
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl TryFrom<MessageSendParams> for SendMessageRequest
impl TryFrom<MessageSendParams> for SendMessageRequest
Source§type Error = ConvertError
type Error = ConvertError
Source§fn try_from(
value: MessageSendParams,
) -> Result<SendMessageRequest, <SendMessageRequest as TryFrom<MessageSendParams>>::Error>
fn try_from( value: MessageSendParams, ) -> Result<SendMessageRequest, <SendMessageRequest as TryFrom<MessageSendParams>>::Error>
Source§impl TryFrom<SendMessageRequest> for MessageSendParams
impl TryFrom<SendMessageRequest> for MessageSendParams
Source§type Error = ConvertError
type Error = ConvertError
Source§fn try_from(
value: SendMessageRequest,
) -> Result<MessageSendParams, <MessageSendParams as TryFrom<SendMessageRequest>>::Error>
fn try_from( value: SendMessageRequest, ) -> Result<MessageSendParams, <MessageSendParams as TryFrom<SendMessageRequest>>::Error>
Auto Trait Implementations§
impl Freeze for MessageSendParams
impl RefUnwindSafe for MessageSendParams
impl Send for MessageSendParams
impl Sync for MessageSendParams
impl Unpin for MessageSendParams
impl UnsafeUnpin for MessageSendParams
impl UnwindSafe for MessageSendParams
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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