Class AgentGenerateTool

java.lang.Object
io.agentscope.harness.agent.tool.AgentGenerateTool

public class AgentGenerateTool extends Object
Tool that generates a new subagent spec from a natural-language description and either persists it to subagents/<name>.md (where DynamicSubagentsMiddleware will pick it up on the next reasoning step) or returns the markdown for human review.

Wraps SubagentSpecGenerator; takes care of name validation, collision detection against the live DefaultAgentManager registry, and dry-run handling.

Not registered by SubagentsMiddleware by default; callers must opt in via SubagentsMiddleware#enableAgentGenerateTool(...).

  • Constructor Details

  • Method Details

    • agentGenerate

      @Tool(name="agent_generate", description="Generate a new subagent spec from a natural-language description. Validates the LLM output against the SubagentDeclaration schema and writes it to subagents/<name>.md so DynamicSubagentsMiddleware picks it up on the next reasoning step. Use dry_run=true to preview the markdown without writing.") public reactor.core.publisher.Mono<String> agentGenerate(io.agentscope.core.agent.RuntimeContext runtimeContext, @ToolParam(name="name",description="Kebab-case subagent id (e.g. code-reviewer). Must not collide with an existing agent.") String name, @ToolParam(name="description",description="What the agent should do \u2014 its purpose, expected output, and when to use it.") String description, @ToolParam(name="dry_run",description="If true, return the generated markdown without persisting it (default false).",required=false) Boolean dryRun)