Child agents: one agent running another
Audience: agent builders who want to split a large job into smaller, reusable agents, such as a "log in to the ERP" agent or a "book one invoice" agent that several parent agents use.
Contents
- Why use child agents
- Prepare the child agent
- Add a Run Agent step
- Give inputs and keep outputs
- The other settings
- Open the child, and find the way back
- Which agents run this one: the "Run by" note
- Test child agents
- Child agents in One CommandCenter
- If it goes wrong
- Related guides
1. Why use child agents
- Reuse: build "Sign in to the portal" once and run it from every agent that needs it.
- Clarity: a parent agent of ten steps that each run a child is easier to read than one of two hundred steps.
- Testing: each child can be run and tested on its own.
- Team work: different people can own different children.
A child agent runs with its own variables. It sees only the inputs it is given, and the parent sees only the outputs it returns.
2. Prepare the child agent
- Create the child agent as usual (see Building agents).
- With no step selected (press Esc), give it a clear id under Advanced: the agent's id > Change the id… (for example
portal_sign_in) and a Description under Properties. Parents choose it by its id. - In Variables, decide what it needs and what it gives back:
- tick Use as input for each value the parent must give (mark it Required when it cannot run without it);
- tick Use as output for each result the parent should get;
- write a Description for each: it appears under the field in the parent's settings.
- Save it.
Tip: Pass a secret to a child as a Credential input. The parent hands over its own Credential variable, so the secret never appears in either agent.
3. Add a Run Agent step

-
Open the parent agent.
-
In Actions > Logic and flow, add Run Agent where the child should run.
-
In Action settings, Agent to run has three choices:
- This agent: the agent runs itself again from its first step (at most 10 levels deep);
- Agent in the workspace: press Choose…. Find an agent opens with two tabs. Browse shows the folder tree (with Agents at the top) and the agents of the folder you click, with how many inputs and outputs each has. Search finds agents by name or folder in every folder. Click the child, then Choose (or double-click it);
- Variable: the agent's id comes from a variable when the step runs (section 5).
The field then shows where the child is, for example Agents › Finance › Invoice. File names (
.flow.json) are never shown. An agent that is not in the workspace shows as "(not in this workspace)".
What you see: the step's line says which agent runs and where its outputs go, for example "runs Invoice, keeps outputs in $total$". The Input values and Save outputs to fields fill with the child's variables.
4. Give inputs and keep outputs
Input values shows one row per input variable of the child, with a tick box, its type and description. Tick an input to give it a value; an input left unticked takes the child's default:
- type text or a number, or a
$variable$of the parent (use {x}, F2 or type$to pick one); - a Number input turns
42into a number and a Boolean input turnstrue/falseinto true or false; - the placeholder shows the child's default ("default: …"), or says required;
- for a Credential input, give a Credential variable of the parent, for example
$erp_password$; - untick a row (or leave it empty) to use the child's default.
Quick map (the button beside Input values) maps the child's inputs and outputs to the parent's variables of the same name in one go. It first shows each input and output under what will happen to it:
| Group | Meaning |
|---|---|
| Ready to map | The parent has a variable of that name and a type that fits. |
| New variable needed | The parent has no variable of that name. |
| Already set | The row has a value already; it is kept unless you tick Also replace values already set. |
| Same name, another type | The parent's variable of that name cannot hold the value; it is left as it is. |
Make the missing variables, with the same name and type is ticked at first; Also replace values already set is
not. Press Apply: each mapped input shows its $name$, each mapped output its variable, and a line says what was
done, for example "2 mapped, 1 new variable". Undo (Ctrl+Z) takes it back.
Save outputs to shows one row per output of the child:
- choose a variable of the parent with a matching type,
- or + New variable "
" , which creates a parent variable of the right type, - or leave (do not keep).
The step also has its own outputs, under Outputs in Action settings:
| Output | Holds |
|---|---|
| outputs | A Dictionary with all of the child's outputs (of the last run when repeated). |
| status | success or failed. |
| error | The child's error (code, message, stepId) when it failed and Fail on error is off; empty otherwise. |
| runs | How many times the child ran. |
If the child has no inputs or outputs, the fields say "The agent has no input variables." or "The agent has no output variables."
5. The other settings
Run Agent has more settings under More options (labels as Studio shows them):
| Setting | What it does |
|---|---|
| Version | Which version runs in One CommandCenter: a version number, or production (the live production version, the default). |
| Timeout seconds | Stops the child with CHILD.TIMEOUT when one run takes longer; empty means no limit. |
| Same session | Shares the parent's open sessions (workbooks, browsers, connections) with the child; sessions the child opens stay open for the parent. |
| Fail on error | On by default: when the child fails, this step fails. Turn it off to carry on and read status and error yourself. |
| Repeat / Repeat delay seconds | Run the child several times in a row, with a pause between runs. |
The usual Error handling settings (retries, continue on error) apply too. A child's error codes start with CHILD.;
a Catch for CHILD.* handles them.
6. Open the child, and find the way back
When you work on a parent you often want to look at the child it calls. There are two ways to open it:
- In Action settings of the Run Agent step, click Open this agent under Agent to run.
- In the step menu (⋮ or right-click), choose Open the agent it runs.
What you see: the child opens. The breadcrumb at the top shows the way back to the parent, at the step you came from:
Automation / Invoice run › line 7 / Book one invoice
- Click Invoice run › line 7 to go back. The parent opens with that Run Agent step selected and in view.
- If you went down several levels (parent → child → grandchild), each level has its own link.
Before switching agents, Studio asks "Discard unsaved changes to the open agent?" if you have unsaved changes. Save first.
7. Which agents run this one: the "Run by" note
When you open an agent that other agents of your workspace run, the breadcrumb ends with a note:
Automation / Shared / Book one invoice · Run by Invoice run, Month end close
Each name is a link. Clicking it opens that parent at its (first) Run Agent step for this agent.
The Dependencies tab gives the same information in more detail: Child agents and agent tools (the agents this one calls) and Used by (the agents that call it). Click a row to open it.
Tip: Before you change a child's inputs or outputs, look at Run by. Every parent that uses the child may need its Run Agent step updated.
8. Test child agents
- Test the child on its own first. Open it, fill in its inputs in the Run tab, and click Run. Check the outputs in the result.
- Then test the parent. Run it; the Run log shows the child's steps too.
- Debug into the child. Set a breakpoint on the Run Agent step, click Debug, then Step into (F11). The run
stops at the child's first step. The debugger panel says "in child agent
" and the Call stack lists the child above the parent. Step out (Shift+F11) finishes the child and stops back in the parent. - Run this step only on the Run Agent step runs just the child with the inputs the step gives, using the values the parent's last run had at that step. See Running and debugging.
9. Child agents in One CommandCenter
- When a parent runs in One CommandCenter, it calls the child by its agent id, in the version you chose
(
productionby default). - So check in every child agent as well as the parent, and make sure each has a live version (tick Make this the live version at check-in, or set it in the repository). The Dependencies tab of the parent lists them and reminds you: "Agent check-in child agents too before running this agent from One CommandCenter."
- If you duplicate an agent in the Explorer, the copy gets a new agent id so it does not replace the original as a child.
10. If it goes wrong
| What you see | Cause and fix |
|---|---|
| "Choose the agent to run first." | Agent to run is empty. |
| "Agent … is not in this workspace." | The child was deleted, renamed with a new id, or is only in One CommandCenter. Check it out or pick another agent. |
| The list says "No other agents in this workspace" | Create the child first, then click ↻. |
| Input values shows "Loading the agent's variables…" for a long time | Click ↻ next to Agent to run. |
The parent fails with a CHILD. error | Open the child and run it with the same inputs to see where it fails. |
| A new output of the child is missing from Save outputs to | Save the child, then click ↻ in the parent. |
| In One CommandCenter the parent cannot find the child | Check in the child, and make sure it has a live production version (or set Version). |