Skip to content

Support for hierarchical / multi-level Deep Agents (agent-as-subagent) ? #206

@WarisBunglawala

Description

Hi

I wanted to ask whether DeepAgent currently supports (or plans to support) a hierarchical, multi-level deep agent structure, where agents themselves can act as sub-agents of a parent agent.

My use case looks roughly like this (user-defined and stored in DB):

Main Deep Agent
  - Tool 1
  - Tool 2
  - Sub Agent 1
  - Sub Agent 2
      - Sub Agent 1 of Sub Agent 2
      - Sub Agent 2 of Sub Agent 2
  - Sub Agent 3

And so on (Dynamic flow and can have multi level nested agents)

Key requirements:
The hierarchy is defined by the user and stored in a database
The structure is constructed at runtime but does not change during execution

I want the LLM planner to decide:
which tool to call
or which sub-agent to invoke next
I do not want to manually manage nodes/edges or orchestration logic

Ideally, sub-agents are exposed similarly to tools, so the planner can reason over them naturally

Is there an existing pattern, recommended approach, or planned feature in DeepAgent to support agent-as-tool / agent-as-subagent hierarchies like this?

Example I tested

Below is a simplified example of how I tried to model this:

const subAgent1 = {
  name: "SOME NAME 1",
  tools: [tool1_1, tool1_2],
};

const subAgent3 = {
  name: "SOME NAME 3",
  tools: [tool3_1, tool3_2],
};

const subAgent2_1 = {
  name: "SOME NAME 2-1",
  tools: [tool2_1, tool2_2],
};

const subAgent2_2 = {
  name: "SOME NAME 2-2",
  tools: [tool2_3, tool2_4],
};

const subAgent2 = createDeepAgent({
  subAgents: [subAgent2_1, subAgent2_2],
});

const mainAgent = createDeepAgent({
  subAgents: [subAgent1, subAgent2, subAgent3],
});

Thanks!

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions