Skip to main content

Flow Builder Best Practices

Design principles to get the most out of Custodian flows.


1. Start from the user's intent​

Ask what outcome the user wants and who should be responsible for each step. Name custodians after the job they do — Billing, Research, Writer — not after random colors or numbers.

2. Prefer one focused custodian​

Split agents only when there's a genuine reason:

  • different topics that deserve a specialist,
  • an escalation (support → billing),
  • a research → write pipeline.

Otherwise one well-prompted custodian beats three vague ones.

3. Write structured system prompts​

Generic "You are a helpful assistant." prompts are weak. Give every custodian a compact, structured brief with short sections and bullets instead of a wall of text:

## Role
You are the 'Billing' specialist ...

## Task
Answer questions about invoices, plans, and charges ...

## Guidelines
- ALWAYS verify a user's plan before quoting prices
- NEVER accept account changes without email confirmation
- Escalate anything outside billing to a colleague

## Assumptions
If a detail is missing, ask for it instead of guessing.

## Output format
Keep answers under 5 sentences unless asked for details.

4. Use topics for routing​

Attach a topics list to each custodian in single mode (and to entry custodians in chain) so routing picks the right specialist. Include the keywords users actually say: billing, refund, security, api-key.

5. Use tools sparingly​

  • Add Web Research only when the custodian must research live information.
  • Attach Gmail only when email is genuinely required (it needs a connected account).
  • Attach Slack only when the custodian must read or post in Slack (it needs a bot token). If it posts, have it show a draft first.
  • For pure prompt/RAG answers, add no tools.

6. Add data sources instead of cramming documents into prompts​

When a custodian must answer from company-specific documents, attach a Data Source. Keep files focused on what that custodian needs.

7. Use response schemas only when something consumes them​

Set outputKey + responseSchema when a downstream step or external system needs structured JSON from that custodian — not for every agent.

8. Choose the right routing mode​

  • workflow — fixed pipelines; custodian order on the canvas is the execution order.
  • chain — escalation flows; pick entry custodians, draw handoffs, mirror them in canHandoffTo, cap with maxHandoffs.
  • single — topic-routed hubs; every custodian hangs off Input and never talks to each other.

Edges and canvas layout are canonicalized automatically, so you never need to hand-wire connections or hand-position nodes — concentrate on custodians, tools, and order.

9. Keep share passwords out of flow exports​

sharePassword must always be empty inside the flow. Sharing is configured at deploy time (private / public / password-protected link).

10. Test before deploying​

Preview the flow's behavior with the assistant or a quick chat after deploy, and confirm handoff targets, data-source connections, and response schemas all behave as intended.


See also: Overview · Routing Modes · Custodians & Tools · Data Sources & RAG