Combining Workflows
Sometimes you need one workflow to delegate a focused task to another workflow (for writing, summarizing, or specialized logic), then continue with the result. Combining workflows lets you chain capabilities while keeping each workflow focused.
When to combine workflows
Use AI intelligence for tasks that need reasoning:
- Writing — Composing emails, summaries, or reports
- Summarizing — Condensing information into key points
- Deciding — Making judgment calls about content
- Analyzing — Understanding context, sentiment, or priority
Use deterministic steps for tasks that need precision:
- Filtering — Removing items by specific criteria
- Formatting — Structuring output in a specific way
- Aggregating — Grouping, counting, or organizing data
- Iterating — Processing a list of items one by one
How it works
A workflow can call another workflow mid-run. The calling workflow pauses, the called workflow does its work (like writing a summary), and the result comes back for the caller to use.
This is powerful because it lets you combine the best of both approaches:
- Precise data gathering — Search emails, filter results, organize data
- Intelligent writing (AI) — Write a natural-sounding summary of what you found
- Precise delivery — Send the summary in a specific format
Example: Smart daily summary
Here’s how a daily summary workflow might combine code and AI:
Step 1: Gather (code) — Search for all emails processed by Auto-label in the last 24 hours
Step 2: Organize (code) — Group emails by label and format them into a structured list
Step 3: Write (AI) — Ask the AI to write a friendly intro and outro based on the day’s activity
Step 4: Send (code) — Combine the structured list with the AI-written intro and send it to you
The result is a daily email that has both precise data (exact email counts, correct groupings) and a human touch (a natural-sounding summary).
Setting up AI helpers
When you create workflows that delegate to other workflows, define each helper workflow with a clear purpose. Each helper should have:
- A description — What this helper does
- Instructions — How the helper should behave
- Expected output — What the helper should return
For example, you might define a “summary writer” helper with instructions like: “Given a list of emails, write a 2-3 sentence intro summarizing the day’s activity and a brief closing line.”
Keep each helper focused on one task. It’s better to have a “summarizer” and a “writer” than one helper that tries to do everything.
Best practices
Provide context. The more relevant information you give the AI helper, the better its output will be. Include the data it needs to work with.
Define the output format. Tell the helper exactly what structure you expect back — for example, an intro paragraph and a closing line. This makes it easier to use the result in subsequent steps.
Separate AI from logic. Let code handle data gathering and formatting. Let AI handle writing and reasoning. This gives you the best of both worlds.
Related
- How Workflows Remember Progress — How pausing and resuming works