Expand description
turul-a2a-patterns defines reusable abstractions for A2A skill
authoring — the SkillHandler trait, SkillRegistry, SkillCard
(SKILL.md) helpers, and the SkillProgressSink trait. It depends only
on turul-a2a-proto and turul-a2a-types, never on the server
runtime. It does NOT change the A2A wire contract; profile/extension
machinery lives elsewhere.
Public surface (all re-exported from the crate root):
- Errors:
SkillError,SinkError,ManifestError,RenderError,ValidationError. - Skill handler trait:
SkillHandlertaking aSkillProgressSinkfor non-terminal status / artifact emits. - Progress sink:
SkillProgressSink+ProgressState(non-terminal states only; terminals come from the handler’s return value). - Pre-terminal gates:
PreTerminalGate+GateContext, run on a handler’s output byGatedHandler; a gate error replaces it. - Terminal hook:
TerminalHook+SkillOutcome. - SKILL.md projection:
SkillCard(from_embedded,from_skill,TryFrom<&Skill>, validate_input, validate_output, render_prompt, to_agent_skill) +ExecutionHints.turul-agent-skillsloads and validates theSKILL.md; this crate reads itsa2a-*metadata and asset files. - Registry:
SkillRegistrytrait +InMemorySkillRegistry+SkillDescriptor. - Schema validation:
validate_json(JSON Schema 2020-12 strict-keyword check).
Internal modules (error, sink, handler, gate, hook, manifest,
template, schema, registry) are implementation detail; use
the flat re-exports above.
Structs§
- Execution
Hints - Provider-neutral execution hints.
- Gate
Context - What a gate sees: the skill id, the invocation params and the output the handler produced.
- Gated
Handler - A
SkillHandlerthat runs its gates on the inner handler’s output. - InMemory
Skill Registry - Default in-memory
SkillRegistry. - Skill
Card - The A2A view of an Agent Skills
SKILL.md. - Skill
Descriptor - Returned by
SkillRegistry::describe.
Enums§
- Manifest
Error - Structured manifest parse error.
- Progress
State - Non-terminal task states a skill may emit during execution. Terminal states are framework-owned; not constructible here.
- Render
Error - Structured template render error.
- Sink
Error - Sink-side error variants.
- Skill
Error - Skill error surface. Exactly three variants; richer error shapes are the adopter’s concern at the call site.
- Skill
Outcome - Outcome of a skill execution observed by a terminal hook.
- Validation
Error - Structured I/O schema validation error.
Traits§
- PreTerminal
Gate - A check that can veto a successful skill output.
- Skill
Handler - A handler that runs when a skill is invoked.
- Skill
Progress Sink - Object-safe progress emission trait used by
SkillHandler::run. - Skill
Registry - Registry mapping
AgentSkill.idto a registeredSkillHandler. - Terminal
Hook - Post-execution hook fired after
SkillHandler::runreturns.
Functions§
- validate_
json - Validate
instanceagainstschema(JSON Schema 2020-12).