Class AgentSkill.Builder
- Enclosing class:
- AgentSkill
AgentSkill instances.
The Builder pattern provides a fluent API for setting skill properties. This approach ensures that once an AgentSkill is created, its state cannot be modified, which is important for protocol correctness and thread-safety.
Example usage:
AgentSkill skill = AgentSkill.builder()
.id("weather_query")
.name("Weather Queries")
.description("Get current weather conditions for any location")
.tags(List.of("weather", "information"))
.examples(List.of(
"What's the weather in Tokyo?",
"Current temperature in London"
))
.inputModes(List.of("text"))
.outputModes(List.of("text"))
.build();
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds an immutableAgentSkillfrom the current builder state.description(String description) Sets a detailed description of what the skill does and how to use it.Sets example queries or use cases demonstrating the skill.Sets the unique identifier for the skill.inputModes(List<String> inputModes) Sets the supported input formats for this skill.Sets the human-readable name of the skill.outputModes(List<String> outputModes) Sets the supported output formats for this skill.securityRequirements(List<SecurityRequirement> securityRequirements) Sets security requirements specific to this skill.Sets categorization tags for discovery and filtering.
-
Method Details
-
id
Sets the unique identifier for the skill.The ID should be a stable identifier that doesn't change across versions, typically in snake_case format (e.g., "weather_query", "translate_text").
- Parameters:
id- the skill ID (required)- Returns:
- this builder for method chaining
-
name
Sets the human-readable name of the skill.The name is displayed to users and should clearly describe the skill's purpose.
- Parameters:
name- the skill name (required)- Returns:
- this builder for method chaining
-
description
Sets a detailed description of what the skill does and how to use it.The description should provide sufficient information for users to understand when and how to invoke the skill.
- Parameters:
description- the skill description (required)- Returns:
- this builder for method chaining
-
tags
Sets categorization tags for discovery and filtering.Tags help organize skills and enable clients to filter or search for specific categories of functionality.
- Parameters:
tags- list of tags (required, may be empty)- Returns:
- this builder for method chaining
-
examples
Sets example queries or use cases demonstrating the skill.Examples help users understand how to phrase requests to effectively invoke the skill.
- Parameters:
examples- list of example queries (optional)- Returns:
- this builder for method chaining
-
inputModes
Sets the supported input formats for this skill.If not specified, the skill inherits the default input modes from the AgentCard. Common values include "text", "audio", "image", "video".
- Parameters:
inputModes- list of supported input formats (optional)- Returns:
- this builder for method chaining
-
outputModes
Sets the supported output formats for this skill.If not specified, the skill inherits the default output modes from the AgentCard. Common values include "text", "audio", "image", "video".
- Parameters:
outputModes- list of supported output formats (optional)- Returns:
- this builder for method chaining
-
securityRequirements
Sets security requirements specific to this skill.Security requirements override or supplement the agent-level security defined in the AgentCard. Each entry represents an alternative security requirement (OR relationship). Schemes within a single SecurityRequirement must all be satisfied (AND relationship).
- Parameters:
securityRequirements- list of security requirements (optional)- Returns:
- this builder for method chaining
- See Also:
-
build
Builds an immutableAgentSkillfrom the current builder state.- Returns:
- a new AgentSkill instance
- Throws:
IllegalArgumentException- if any required field (id, name, description, tags) is null
-