Core Features
- Annotation-Based: Quickly define tools using
@Tooland@ToolParam - Reactive Programming: Native support for
Mono/Fluxasync execution - Auto Schema: Automatically generate JSON Schema for LLM understanding
- Tool Groups: Dynamically activate/deactivate tool collections
- Preset Parameters: Hide sensitive parameters (e.g., API Keys)
- Parallel Execution: Support parallel invocation of multiple tools
Quick Start
Define Tools
Note: Thenameattribute of@ToolParamis required because Java doesn’t preserve parameter names by default.
Strict Mode
strict controls whether model providers that support strict schema enforcement should strictly follow
the tool parameter schema.
@Tool(..., strict = true)annotation-based registrationAgentToolinterface implementations (viagetStrict())Toolkit#registerSchema(...)andToolkit#registerSchemas(...)
Register and Use
Tool Types
Sync Tools
Return results directly, suitable for quick operations:Async Tools
ReturnMono<T> or Flux<T>, suitable for I/O operations:
Streaming Tools
UseToolEmitter to send intermediate progress, suitable for long-running tasks (progress is only visible to Hooks, not sent to LLM):
Return Types
Tool Groups
Manage tools by scenario with dynamic activation/deactivation:- Permission control: Activate different tools based on user roles
- Scenario switching: Use different tool sets at different conversation stages
- Performance optimization: Reduce the number of tools visible to LLM
Preset Parameters
Hide sensitive parameters (e.g., API Key) from LLM:to and subject parameters; apiKey is auto-injected.
Tool Execution Context
Pass business objects (e.g., user info) to tools without exposing to LLM:See Agent documentation for detailed configuration.
Built-in Tools
File Tools
Shell Command Tool
Quick Start:
Multimodal Tools
Sub-agent Tools
Agents can be registered as tools for other agents to call. See Agent as Tool for details.AgentTool Interface
For fine-grained control, implement the interface directly:Configuration Options
Meta Tools
Allow agents to autonomously manage tool groups:Tool Suspend
When a tool throwsToolSuspendException, the Agent execution pauses and returns to the caller, allowing external systems to perform the actual execution before resuming.
Use Cases:
- Tool requires external system execution (e.g., remote API, user manual operation)
- Need to asynchronously wait for external results
Schema Only Tool
Register only the tool’s schema (name, description, parameters) without execution logic. When LLM calls this tool, the framework automatically triggers suspension and returns to the caller for execution. Use Cases:- Tool implemented by external systems (e.g., frontend, other services)
- Dynamically register third-party tools
TOOL_SUSPENDED → external execution → provide result to resume.
Complete Examples
- Tool Call Example: ToolCallingExample.java
- Tool Group Example: ToolGroupExample.java
- MultiModal Tool Example: MultiModalToolExample.java