Pular para o conteúdo principal

Subagentes

Definição

Subagentes são agentes que se situam dentro de uma hierarquia: um agente pai delega subtarefas a agentes filhos (subagentes), que por sua vez podem delegar a mais subagentes. Isso estrutura a complexix work and keeps each agent focused.

Eles são uma forma de implementar sistemas multi-agente com uma cadeia clara de responsabilidaty. The root agent owns the user-facing goal; subagents handle focused sub-tasks (por ex. recuperação, code execution, validation). Often used with spec-driven development or RDD so subagents receive and follow specs.

Como funciona

O agente raiz recebe a tarefa, divide-a em subtarefas e as atribui ao Subagente1, Subagente2, etc. (por papel ou capacidade). Cada subagente executa seu próprio loop (possivelmente com ferramentas e um LLM) and returns results to the root. The root aggregates results (por ex. merges, selects, or passes to another subagent) and either continues the loop or returns to the user. Subagents can be specialized (por ex. recuperação, code, critique) and use the same or different models. Clear contracts (inputs/outputs or tools) and error handling make the hierarchy debuggable and reusable.

Casos de uso

Subagents ajudam quando uma tarefa se divide naturalmente em subtarefas focadas que podem ser delegadas e agregadas.

  • Root agent delegating recuperação, generation, and validation to subagents
  • Complex workflows (por ex. research, code review) with focused sub-tasks
  • Reusing the same subagent in different parent workflows

Documentação externa

Vantagens e desvantagens

ProsCons
Clear separation of concernsCoordination and latency
Scalable to complex tasksNeed clear contracts and error handling
Reusable subagent capabilitiesDebugging across hierarchy can be hard

Veja também