Skip to main content

SkillCard

Struct SkillCard 

Source
#[non_exhaustive]
pub struct SkillCard {
Show 13 fields pub id: String, pub name: String, pub description: String, pub tags: Vec<String>, pub examples: Vec<String>, pub input_modes: Vec<String>, pub output_modes: Vec<String>, pub security_requirements: Vec<String>, pub input_schema: Option<Value>, pub output_schema: Option<Value>, pub execution_hints: Option<ExecutionHints>, pub provider_config: Option<Value>, pub body: String,
}
Expand description

The A2A view of an Agent Skills SKILL.md.

The skill’s spec name is its catalog identity; metadata.a2a-id, when present, is the wire id (AgentSkill.id) and otherwise the name is. The other A2A fields come from a2a-* metadata keys, and the schemas and provider config from JSON files under the skill directory. LLM-backed skills supply execution hints and provider config; non-LLM skills omit them. The Markdown body is the prompt template (used only by LLM-backed skills); template grammar is {{ name }} with dotted paths.

SkillCard::from_embedded, SkillCard::from_skill and TryFrom<&Skill> are the only constructors: the struct is #[non_exhaustive] and deliberately implements neither Deserialize nor Default, so every card has passed the metadata, strict-keyword and schema-compilation checks.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: String§name: String§description: String§tags: Vec<String>§examples: Vec<String>§input_modes: Vec<String>§output_modes: Vec<String>§security_requirements: Vec<String>§input_schema: Option<Value>§output_schema: Option<Value>§execution_hints: Option<ExecutionHints>§provider_config: Option<Value>§body: String

Markdown body (prompt template for LLM-backed skills).

Implementations§

Source§

impl SkillCard

Source

pub fn from_skill( skill: &Skill, assets: impl Fn(&str) -> Option<String>, ) -> Result<Self, ManifestError>

Project a loaded skill onto a SkillCard, reading asset files through assets.

assets is called with the path a metadata key names, relative to the skill directory (assets/input.schema.json), and returns the file’s text or None when it is absent. Use it for a skill embedded in the binary; SkillCard::try_from(&skill) reads the files from the directory the skill was loaded from.

List keys hold a JSON array of strings, the execution hints a decimal string, and the schema and provider-config keys a relative path to a JSON file. An unknown a2a-* key, a path that leaves the skill directory, a missing asset, or a value that does not parse is a ManifestError::Parse at that key. Declared schemas must be usable: unknown JSON Schema keywords and schemas the 2020-12 validator cannot compile are a ManifestError::Schema, never deferred to the first validate call.

Source

pub fn from_embedded( dir_name: &str, skill_md: &str, assets: &[(&str, &str)], ) -> Result<Self, ManifestError>

Load a skill embedded in the binary and project it.

dir_name is the skill’s directory name, skill_md the text of its SKILL.md and assets its asset files as (relative path, text) pairs, typically all from include_str!. Embedded content is fixed at build time, so any problem the loader reports — an unknown field, a name that differs from dir_name — is an error here rather than a diagnostic. Errors from loading are ManifestError::Parse at SKILL.md; the rest are as for SkillCard::from_skill.

Source

pub fn to_agent_skill(&self) -> AgentSkill

Project the eight A2A discovery fields onto an AgentSkill.

Schemas, execution hints, and provider config are intentionally NOT projected — they are Turul-local planning metadata, not wire fields. For manifest-backed skills, params_schema is derived from the manifest’s input schema, ensuring there is exactly one schema per skill.

Source

pub fn render_prompt(&self, params: &Value) -> Result<String, RenderError>

Render the Markdown body against the given input parameters.

Grammar: {{ path }} with dotted access ({{ user.name }}). Literal {{ escaped as \{{. Missing variable -> structured RenderError::MissingVariable (no silent empty substitution).

Source

pub fn validate_input(&self, input: &Value) -> Result<(), ValidationError>

Validate input against the manifest’s input schema. A card without an input schema accepts any input. Error locations are JSON pointers into the instance rooted at #, as in validate_json.

Source

pub fn validate_output(&self, output: &Value) -> Result<(), ValidationError>

Validate output against the manifest’s output schema. A card without an output schema accepts any output. Error locations are JSON pointers into the instance rooted at #, as in validate_json.

Trait Implementations§

Source§

impl Clone for SkillCard

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SkillCard

Source§

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

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

impl TryFrom<&Skill> for SkillCard

Reads asset files from the directory the skill was loaded from. The resolved file must lie inside that directory, so a symlink pointing out of it is refused. A file that is absent, refused or unreadable fails as not found; so does every asset of a skill with no location (one that was built, or loaded from text).

Source§

type Error = ManifestError

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

fn try_from(skill: &Skill) -> Result<Self, ManifestError>

Performs the conversion.

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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