Skip to main content
Sometimes an agent needs to know something before it starts: which customer is writing, what is in stock, what a pull request changed. Context gathering is a set of steps that run first, every time, and hand what they find to the sub-agent’s prompt. In a config file, a set of steps is called a context group.
The canvas with a context node named Look up the customer in front of a sub-agent named Reply

A step always runs. A tool runs if the agent decides to.

A context step and a tool can do the same job, such as looking something up in a database. The difference is who decides. Use a step for what you always need. It costs nothing in model decisions, and the agent cannot forget to do it. Use a tool for what you sometimes need.

Using what a step found

Each step has a name, and the prompt reads the step’s result by that name. In this User prompt, customer is a step that looked the customer up from the email address in the message:
You do not have to remember a step’s name. In any prompt, Insert a variable lists every step under Step & agent outputs and writes the braces for you. If a step found nothing, that part of the prompt is left empty, so write prompts that still read sensibly.

One after another, or all at once

In order, which is how steps run unless you say otherwise, each step can use what the ones before it found. Look up the customer, then look up that customer’s orders. With Run steps in parallel, the steps start together. That is faster, and the steps cannot use each other’s results. Use it for look-ups that do not depend on each other.

When a step fails

If a step cannot finish, the run stops there and the sub-agent is not called. If an agent that gathers context goes quiet, check its steps first.

Where it sits

Context gathering belongs to a sub-agent and runs just before it. On the canvas it is a node of its own, in front of the sub-agent. See Agents for the path a run takes.

Set up context gathering in the dashboard

  1. Open a sub-agent. Under Flow, find Context gathering and click Configure context. A context node appears in front of the sub-agent with one step in it, and its panel opens.
  2. Under Steps, click Configure step on the step. Choose what the step does under Type, and fill in its fields.
  3. To add another step, click Add step.
  4. Optional: under Execution, turn on Run steps in parallel.
  5. Click Save.
The context panel with two steps, the Run steps in parallel setting, and the Next setting

Agents

How entries, context gathering, and sub-agents fit together.

Add a tool to an agent

For what the agent should decide to do itself.

Dynamic content

How a prompt reads the message and what steps found.

Available actions

What a step can do.