#[non_exhaustive]pub struct AgentSkill {
pub id: String,
pub name: String,
pub description: String,
pub tags: Vec<String>,
pub examples: Option<Vec<String>>,
pub input_modes: Option<Vec<String>>,
pub output_modes: Option<Vec<String>>,
pub security_requirements: Option<Vec<SecurityRequirement>>,
}Expand description
Represents a distinct capability or function that an agent can perform.
§Construction
AgentSkill::new takes the id, name and description; tags, examples and
the two mode lists are set by the with_* methods beside it.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: StringA unique identifier for the agent’s skill.
name: StringA human-readable name for the skill.
description: StringA detailed description of the skill.
A set of keywords describing the skill’s capabilities.
ProtoJSON printers omit empty repeated fields — a skill published by an
official SDK with no tags arrives without the key. Absence means empty;
failing the whole card parse over it is not interoperable.
examples: Option<Vec<String>>Example prompts or scenarios that this skill can handle.
input_modes: Option<Vec<String>>The set of supported input media types for this skill, overriding the agent’s defaults.
output_modes: Option<Vec<String>>The set of supported output media types for this skill, overriding the agent’s defaults.
security_requirements: Option<Vec<SecurityRequirement>>Security schemes necessary for this skill.
Implementations§
Source§impl AgentSkill
impl AgentSkill
Sourcepub fn new(
id: impl Into<String>,
name: impl Into<String>,
description: impl Into<String>,
) -> AgentSkill
pub fn new( id: impl Into<String>, name: impl Into<String>, description: impl Into<String>, ) -> AgentSkill
A new skill with no tags, examples, modes or security requirements.
use a2a_protocol_types::agent_card::AgentSkill;
let skill = AgentSkill::new("echo", "Echo", "Repeats the caller's text");
assert!(skill.tags.is_empty());
assert!(skill.examples.is_none());Replaces the skill’s searchable tags.
use a2a_protocol_types::agent_card::AgentSkill;
let skill = AgentSkill::new("analyze", "Analysis", "Counts things")
.with_tags(["code", "metrics"]);
assert_eq!(skill.tags, ["code", "metrics"]);Sourcepub fn with_examples<I, S>(self, examples: I) -> AgentSkill
pub fn with_examples<I, S>(self, examples: I) -> AgentSkill
Replaces the skill’s example prompts.
use a2a_protocol_types::agent_card::AgentSkill;
let skill = AgentSkill::new("echo", "Echo", "Repeats").with_examples(["say hello"]);
assert_eq!(skill.examples.as_deref(), Some(&["say hello".to_owned()][..]));Sourcepub fn with_input_modes<I, S>(self, modes: I) -> AgentSkill
pub fn with_input_modes<I, S>(self, modes: I) -> AgentSkill
Replaces the MIME types this skill accepts.
use a2a_protocol_types::agent_card::AgentSkill;
let skill = AgentSkill::new("ocr", "OCR", "Reads text").with_input_modes(["image/png"]);
assert_eq!(skill.input_modes.as_deref(), Some(&["image/png".to_owned()][..]));Sourcepub fn with_output_modes<I, S>(self, modes: I) -> AgentSkill
pub fn with_output_modes<I, S>(self, modes: I) -> AgentSkill
Replaces the MIME types this skill produces.
use a2a_protocol_types::agent_card::AgentSkill;
let skill = AgentSkill::new("ocr", "OCR", "Reads text").with_output_modes(["text/plain"]);
assert_eq!(skill.output_modes.as_deref(), Some(&["text/plain".to_owned()][..]));Sourcepub fn with_security_requirements(
self,
reqs: Vec<SecurityRequirement>,
) -> AgentSkill
pub fn with_security_requirements( self, reqs: Vec<SecurityRequirement>, ) -> AgentSkill
Replaces the security requirements that apply to this skill alone.
Trait Implementations§
Source§impl Clone for AgentSkill
impl Clone for AgentSkill
Source§fn clone(&self) -> AgentSkill
fn clone(&self) -> AgentSkill
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 AgentSkill
impl Debug for AgentSkill
Source§impl<'de> Deserialize<'de> for AgentSkill
impl<'de> Deserialize<'de> for AgentSkill
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentSkill, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentSkill, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<AgentSkill> for AgentSkill
impl From<AgentSkill> for AgentSkill
Source§fn from(value: AgentSkill) -> AgentSkill
fn from(value: AgentSkill) -> AgentSkill
Source§impl From<AgentSkill> for AgentSkill
impl From<AgentSkill> for AgentSkill
Source§fn from(value: AgentSkill) -> AgentSkill
fn from(value: AgentSkill) -> AgentSkill
Source§impl Serialize for AgentSkill
impl Serialize for AgentSkill
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,
Auto Trait Implementations§
impl Forget for AgentSkill
impl Freeze for AgentSkill
impl Move for AgentSkill
impl RefUnwindSafe for AgentSkill
impl Send for AgentSkill
impl Sync for AgentSkill
impl Unpin for AgentSkill
impl UnsafeUnpin for AgentSkill
impl UnwindSafe for AgentSkill
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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>,
§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].