Skip to main content

AgentCardBuilder

Struct AgentCardBuilder 

Source
pub struct AgentCardBuilder { /* private fields */ }
Expand description

The builder for AgentCard.

The builder is a sequence of with_* calls the caller makes consciously; the build method is the only way to get an AgentCard, and it checks the invariants the spec mandates at the end.

Implementations§

Source§

impl AgentCardBuilder

Source

pub fn new() -> Self

Starts a new builder with no fields set.

Source

pub fn with_name(self, name: impl Into<Arc<str>>) -> Self

Sets the agent’s human-readable name.

Source

pub fn with_description(self, description: impl Into<Arc<str>>) -> Self

Sets the agent’s human-readable description.

Source

pub fn with_version(self, version: impl Into<Arc<str>>) -> Self

Sets the agent’s version string.

Source

pub fn with_interface(self, interface: AgentInterface) -> Self

Adds an interface the agent publishes. The first call is the preferred interface; subsequent calls are fallbacks in the order the spec reads.

Source

pub fn with_provider(self, provider: AgentProvider) -> Self

Sets the service provider of the agent. Optional in the spec; a builder that does not call this method produces a card with no provider field on the wire.

Source

pub fn with_documentation_url(self, url: Url) -> Self

Sets the URL providing additional documentation about the agent. Optional in the spec; absent on the wire unless this method is called.

Source

pub fn with_icon_url(self, url: Url) -> Self

Sets the URL to an icon for the agent. Optional in the spec; absent on the wire unless this method is called. UI clients surface this as the agent’s avatar in a directory listing.

Source

pub fn with_capabilities(self, capabilities: AgentCapabilities) -> Self

Sets the capability set.

Source

pub fn with_extension(self, extension: AgentExtension) -> Self

Adds a single protocol extension the agent supports. Convenience for the common “one extension at a time” pattern; a caller that wants to set several at once builds the AgentCapabilities directly and uses with_capabilities.

Source

pub fn with_security_scheme( self, name: impl Into<Arc<str>>, scheme: SecurityScheme, ) -> Self

Registers a security scheme under name. The same name is the key in AgentCard::security_schemes and the key a client uses in SecurityRequirement to demand that scheme. The wire form is OpenAPI 3.x.

Source

pub fn with_security_requirement(self, requirement: SecurityRequirement) -> Self

Adds a security requirement to the agent’s published list. The requirements are tried in the order they are added; a client picks the first one it can satisfy.

Source

pub fn with_input_mode(self, mode: impl Into<Arc<str>>) -> Self

Adds a default input mode.

Source

pub fn with_output_mode(self, mode: impl Into<Arc<str>>) -> Self

Adds a default output mode.

Source

pub fn with_skill(self, skill: AgentSkill) -> Self

Adds a skill the agent advertises.

Source

pub fn build(self) -> Result<AgentCard, AgentCardError>

Builds the card, checking the spec’s required-field invariants.

§Errors

AgentCardError on the first invariant failure. The error names the field so the caller can fix the input.

Trait Implementations§

Source§

impl Debug for AgentCardBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AgentCardBuilder

Source§

fn default() -> Self

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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: Sized + 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: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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