Multi-step research agent with web search tools and plan-and-execute strategy. Java equivalent of research-agent/.
export OPENAI_API_KEY=sk-...mvn compile exec:javaWith a custom query:
mvn compile exec:java -Dexec.args="How does event sourcing work?"- Defines two tools:
WebSearchandFetchPageusing@Tool+ToolCall<T> - Builds an agent with
plan-and-executestrategy (plan steps, execute each, synthesize) - Validates the compiled IR with
IrValidator - Runs the agent, which generates a plan and executes it step-by-step
@Toolannotation andToolCall<T>interface for tool definitionplan-and-executestrategy — generates a plan, then executes each stepmaxCostUsd()— cost budget limit- Multi-tool agent with automatic tool dispatch
- Swap stub tools for real APIs (Brave Search, SerpAPI)
- Try
criticstrategy for iterative refinement - Add eval scoring — see the eval guide