Agent Skill Building
Purpose
Within the broader scope of Remote Agent Communication (A2A), the Agent Skill Building subtopic addresses the need to dynamically generate descriptive skill metadata for agents exposed via the A2A protocol. This metadata enables A2A clients to understand and utilize an agent’s capabilities effectively by describing its skills based on its type (LLM-based, workflow, custom) and its configured tools or sub-agents.
The primary problem solved here is providing a structured, human-readable, and machine-consumable summary of what an agent can do, which is critical in distributed multi-agent systems where agents invoke or delegate tasks to others remotely. This skill descriptor generation enhances discoverability, usability, and orchestration when agents communicate over the network.
Functionality
The core functionality revolves around inspecting an agent’s configuration and composition to produce a list of a2a.AgentSkill objects that summarize:
The agent's core model or type (e.g., LLM-based, loop workflow, sequential workflow).
Tools integrated into LLM agents (e.g., artifact loaders, search tools).
Workflow orchestration capabilities when sub-agents are involved.
Nested sub-agent skills recursively, with hierarchical naming and tagging.
Key workflows and methods:
BuildAgentSkills(agent.Agent) []a2a.AgentSkill
Entry point that builds a complete skill list by concatenating primary agent skills and recursively gathered sub-agent skills.buildPrimarySkills(agent.Agent) []a2a.AgentSkill
Detects agent type (LLM or non-LLM) and delegates skill building accordingly.buildLLMAgentSkills(agent.Agent, llminternal.State) []a2a.AgentSkill
Generates skills for LLM agents including the underlying model description and any attached tools, each tool becoming a separate skill with an ID and description.buildNonLLMAgentSkills(agent.Agent) []a2a.AgentSkill
Builds skills for workflow or custom agents, including a description of the orchestration if sub-agents are present, and produces a summarized workflow skill plus individual sub-agent skills.buildSubAgentSkills(agent.Agent) []a2a.AgentSkill
Recursively collects skills from sub-agents, prefixing their IDs and names with the parent sub-agent’s name, and tagging them as sub-agent skills.Description Building
Multiple helper functions generate natural language descriptions tailored to agent type and sub-agent structures:buildLoopAgentDescription
These descriptions narrate the execution order or concurrency of sub-agents, including loop iteration counts if applicable.
Pronoun Replacement in Descriptions
When incorporating instruction texts into descriptions (common for LLM agents), pronouns like "you" are replaced with first-person equivalents "I" to make descriptions more natural from the agent’s perspective.Tagging and Naming
Skills are tagged by agent type (e.g., "llm_agent", "loop_workflow") to facilitate filtering or categorization by clients.
Example snippet illustrating skill building for LLM tools:
if len(llmState.Tools) > 0 {
for _, tool := range llmState.Tools {
desc := tool.Description()
if desc == "" {
desc = fmt.Sprintf("Tool: %s", tool.Name())
}
skills = append(skills, a2a.AgentSkill{
ID: fmt.Sprintf("%s-%s", agent.Name(), tool.Name()),
Name: tool.Name(),
Description: desc,
Tags: []string{"llm", "tools"},
})
}
}
This approach ensures each tool the LLM agent can invoke is explicitly described as a skill.
Integration
Agent Skill Building tightly integrates with the Remote Agent Communication (A2A) topic by supplying the skill descriptors used in the a2a.AgentCard structure. The agent card represents the advertised capabilities of an agent endpoint, enabling clients to understand what the agent offers before invoking it.
It complements other subtopics such as:
A2A Agent Implementation which manages the communication interfaces.
Event Conversion and Processing and Executor and Server which handle runtime interactions and execution.
By generating rich skill metadata, it enhances the orchestration of agents described in Agent Workflow Management subtopic by clarifying workflow compositions and capabilities.
The skill building also leverages internal agent state introspection (iagent.State) and LLM-specific internal state (llminternal.State) to accurately reflect agent configurations, including nested sub-agents from workflow agents like loops, parallels, and sequential steps.
Diagram
flowchart TD
Agent[Agent Instance]
BuildSkills(BuildAgentSkills)
PrimarySkills[buildPrimarySkills]
SubAgentSkills[buildSubAgentSkills]
LLMSkills[buildLLMAgentSkills]
NonLLMSkills[buildNonLLMAgentSkills]
SkillList["["]a2a.AgentSkill]
Agent --> BuildSkills
BuildSkills --> PrimarySkills
BuildSkills --> SubAgentSkills
PrimarySkills -->|LLM Agent| LLMSkills
PrimarySkills -->|Non-LLM Agent| NonLLMSkills
LLMSkills --> SkillList
NonLLMSkills --> SkillList
SubAgentSkills --> SkillList
This flowchart illustrates how the skill building process starts with the agent, branching based on agent type, and recursively includes sub-agent skills, before producing the final list of agent skill descriptors for A2A clients.