CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/maven-com-embabel-agent--embabel-agent-a2a

A2A protocol integration for Embabel Agent Framework enabling agent-to-agent communication

Overview
Eval results
Files

skill-factory.mddocs/api/

Skill Factory API

Conversion of internal agent capabilities (Goals) to A2A-compatible skill definitions.

AgentSkillFactory

Factory interface for creating agent skills.

/**
 * Factory interface for creating agent skills from internal capabilities.
 */
interface AgentSkillFactory {
    /**
     * Create skills for the given namespace.
     * @param namespace Skill namespace prefix (typically agent platform name)
     * @return List of AgentSkill objects
     */
    fun skills(namespace: String): List<AgentSkill>
}

FromGoalsAgentSkillFactory

Default implementation converting Embabel Goals to A2A AgentSkills.

/**
 * Converts Embabel Goals to A2A AgentSkills.
 * @param goals Set of goals to convert
 */
class FromGoalsAgentSkillFactory(
    private val goals: Set<Goal>
) : AgentSkillFactory {
    override fun skills(namespace: String): List<AgentSkill>
}

Goal-to-Skill Mapping

AgentSkill(
    id = "${namespace}_goal_${goal.name}",
    name = goal.name,
    description = goal.description,
    tags = goal.tags.toList(),
    examples = goal.examples.toList(),
    acceptedInputModes = listOf("application/json"),
    acceptedOutputModes = listOf("application/json"),
    configuration = null
)

Property Mapping

Goal PropertyAgentSkill PropertyTransformation
namenameDirect copy
nameidPrefixed: ${namespace}_goal_${name}
descriptiondescriptionDirect copy
tagstagsConverted to List
examplesexamplesConverted to List
N/AacceptedInputModesFixed: ["application/json"]
N/AacceptedOutputModesFixed: ["application/json"]
N/AconfigurationFixed: null

Basic Usage

val goals = setOf(
    Goal(
        name = "findNews",
        description = "Find news based on a person's star sign",
        tags = setOf("news", "astrology"),
        examples = setOf("Find news for Scorpios", "What news is relevant for Aries?")
    ),
    Goal(
        name = "researchTopic",
        description = "Research a topic using web tools",
        tags = setOf("research", "web"),
        examples = setOf("Research Australian elections", "Find information about climate change")
    )
)

val factory = FromGoalsAgentSkillFactory(goals)
val skills = factory.skills("my_agent")

// Results:
// - ID: "my_agent_goal_findNews"
//   Name: "findNews"
//   Description: "Find news based on a person's star sign"
//   Tags: ["news", "astrology"]
//
// - ID: "my_agent_goal_researchTopic"
//   Name: "researchTopic"
//   Description: "Research a topic using web tools"
//   Tags: ["research", "web"]

Usage in AgentCard

Typically used within EmbabelServerGoalsAgentCardHandler:

class EmbabelServerGoalsAgentCardHandler(
    private val agentPlatform: AgentPlatform,
    private val goalFilter: GoalFilter,
    /* ... */
) {
    override fun agentCard(scheme: String, host: String, port: Int): AgentCard {
        return AgentCard.Builder()
            .skills(
                FromGoalsAgentSkillFactory(
                    goals = agentPlatform.goals.filter { goalFilter.invoke(it) }.toSet()
                ).skills(agentPlatform.name)
            )
            .build()
    }
}

Custom Implementation

class CustomSkillFactory : AgentSkillFactory {

    override fun skills(namespace: String): List<AgentSkill> {
        return listOf(
            AgentSkill(
                id = "${namespace}_custom_search",
                name = "customSearch",
                description = "Perform a custom search operation",
                tags = listOf("search", "custom"),
                examples = listOf("Search for X", "Find Y"),
                acceptedInputModes = listOf("application/json", "text/plain"),
                acceptedOutputModes = listOf("application/json"),
                configuration = mapOf("maxResults" to 10)
            ),
            AgentSkill(
                id = "${namespace}_data_analysis",
                name = "dataAnalysis",
                description = "Analyze data and generate insights",
                tags = listOf("analysis", "data"),
                examples = listOf("Analyze sales data", "Generate report"),
                acceptedInputModes = listOf("application/json"),
                acceptedOutputModes = listOf("application/json", "text/html"),
                configuration = null
            )
        )
    }
}

Best Practices

Descriptions

  • Be concise but informative
  • Describe what the skill does, not how
  • Use action verbs ("Find", "Analyze", "Generate")

Tags

  • Use lowercase tags
  • Include domain tags ("news", "research")
  • Include technical tags ("web", "llm", "api")

Examples

  • Provide 2-5 concrete examples
  • Show variety in phrasing
  • Use natural language

Good:

Goal(
    name = "researchTopic",
    description = "Research a topic using web tools and summarize findings",
    tags = setOf("research", "web", "summarization"),
    examples = setOf(
        "Research the recent Australian federal election",
        "Find information about renewable energy trends",
        "What are the latest developments in quantum computing?"
    )
)

Poor:

Goal(
    name = "doResearch",
    description = "Does research",  // Too vague
    tags = setOf("RESEARCH", "Web"),  // Inconsistent casing
    examples = setOf("research")  // Not specific
)

Thread Safety

FromGoalsAgentSkillFactory is immutable and thread-safe:

  • Goals set is final
  • skills() method has no side effects
  • Safe for concurrent use

See Also

  • AgentCard API - AgentCard generation
  • Common Tasks - Configuration examples
tessl i tessl/maven-com-embabel-agent--embabel-agent-a2a@0.3.3

docs

api

agent-card.md

configuration.md

endpoint-registration.md

events.md

overview.md

request-handling.md

skill-factory.md

streaming.md

task-state.md

index.md

tile.json