Skip to content

Build an adaptive research workflow ​

Research from two directions at once, merge the evidence, improve the brief until it meets a quality bar, then branch and route the right deliverable.

  • What you'll build β€” A market-entry brief that combines public research with account knowledge, iterates up to three times, detects whether it is ready, and produces either a sales or content playbook.
  • Workflow features β€” parallel, sequence, loop, condition, router, nested composites, {input}, {previous}, CEL expressions and bounded worst-case execution.
  • Time & plan β€” About 25 minutes once Claude Code is connected to the Agents MCP. The complete graph has a worst case below the 25-call preview limit.

This example is read-oriented: it creates a report but does not message a lead, publish content, or change an external record. Follow Build and test a routine with Claude for the full setup and activation process.

The graph ​

text
parallel research
       β”‚
       β–Ό
sequence: merge β†’ loop until DECISION_READY
       β”‚
       β–Ό
condition: ready?
       β”œβ”€ yes β†’ router β†’ sales or content sequence
       └─ no  β†’ unresolved-gaps report
       β”‚
       β–Ό
executive summary

Each control-flow node has one job. That makes the run history readable and lets Claude reason about cost and limits before saving it.

1. Ask Claude for the outcome ​

text
Build a read-only market-entry routine. Research the market publicly and inspect
our existing Business Knowledge in parallel. Merge the evidence, then run a
maximum three-pass critique loop that ends when the result is genuinely ready.
If it is ready, route to a sales playbook when the run message contains "sales";
otherwise route to a content playbook. If it is not ready after three passes,
return an unresolved-gaps report. Finish with an executive summary.

Use the MyChatBot Agents MCP. Inspect my account and the complete YAML reference,
reuse existing Agents and knowledge, validate the routine, show me canonical
YAML, and ask before saving or starting a billed tool-free preview. Do not create
a schedule or trigger.

Claude should verify which Agent can access the relevant Business Knowledge and which can browse. The YAML below uses standard built-ins; Claude can substitute effective slugs from your inventory.

2. Review the complete YAML ​

yaml
name: adaptive-market-entry-brief
display_name: Adaptive market-entry brief
description: Research a market, improve the evidence until ready, and route it into the right go-to-market playbook.
archetype: personal-assistant
run_message: Build a sales plan for entering the Polish market.
steps:
  - type: parallel
    title: Research the opportunity from two sides
    steps:
      - title: Research the public market
        archetype: personal-assistant
        prompt: |
          Research the market requested in {input}. Return sourced evidence on
          demand, competitors, pricing, risks, and recent changes. Distinguish
          facts from assumptions and do not invent a source.
      - title: Inspect our internal fit
        archetype: platform-assistant
        prompt: |
          Use the account's read-oriented Business Knowledge and Sales Platform
          tools to assess our products, positioning, customer patterns, and
          operational constraints for {input}. Do not change any record.

  - type: sequence
    title: Merge and improve the brief
    steps:
      - title: Merge the evidence
        archetype: personal-assistant
        prompt: |
          Merge these parallel findings into one evidence table: {previous}
          Resolve contradictions where the evidence permits it. List every
          material unknown explicitly.

      - type: loop
        title: Improve until decision-ready
        max_iterations: 3
        end_condition: last_step_content.contains("DECISION_READY")
        forward_iteration_output: true
        steps:
          - title: Critique and improve
            archetype: personal-assistant
            prompt: |
              Critique the current brief in {previous}. Repair weak reasoning,
              unsupported claims, missing risks, and vague recommendations.
              End with DECISION_READY only when the evidence supports a concrete
              entry decision; otherwise end with NEEDS_EVIDENCE and the gaps.

  - type: condition
    title: Check whether the brief is ready
    evaluator: previous_step_content.contains("DECISION_READY")
    steps:
      - type: router
        title: Choose the go-to-market playbook
        selector: 'input.contains("sales") ? "Sales playbook" : "Content playbook"'
        choices:
          - type: sequence
            title: Sales playbook
            steps:
              - title: Design the sales motion
                archetype: personal-assistant
                prompt: |
                  Turn the decision-ready brief in {previous} into target
                  segments, an offer, qualification rules, and a 30-day sales
                  motion. Draft only; do not contact anyone.
              - title: Define sales measures
                archetype: bulk-text-worker
                prompt: |
                  Convert {previous} into a compact weekly scorecard with
                  leading indicators, stop conditions, and owners.

          - type: sequence
            title: Content playbook
            steps:
              - title: Design the content motion
                archetype: personal-assistant
                prompt: |
                  Turn the decision-ready brief in {previous} into audience
                  themes, proof points, channels, and a 30-day content plan.
                  Draft only; do not publish anything.
              - title: Define content measures
                archetype: bulk-text-worker
                prompt: |
                  Convert {previous} into a compact weekly scorecard with
                  leading indicators, stop conditions, and owners.
    else_steps:
      - title: Explain unresolved gaps
        archetype: personal-assistant
        prompt: |
          The brief did not become decision-ready after its bounded loop.
          Turn {previous} into a short evidence-gathering plan. Name each gap,
          the source needed to close it, and the decision it blocks.

  - title: Write the executive summary
    archetype: bulk-text-worker
    prompt: |
      Turn {previous} into a one-page executive summary. State the decision,
      strongest evidence, main risk, first seven-day action, owner, and the
      metric that determines whether to continue.

3. Understand each feature ​

FeatureWhat it does hereWhy it is bounded
parallelStarts public and internal research togetherExactly two authored branches
sequenceMakes the merge happen before iterative reviewTwo ordered children
loopImproves the merged brief until it ends with DECISION_READYStops at the condition or after 3 iterations
conditionChooses delivery or an evidence-gap reportRuns only one branch
routerSelects the sales or content playbookCEL returns exactly one named choice
Nested compositesPlaces a Router and Sequences inside the true branchBelow the 8-level nesting limit

The worst case is nine Agent calls: two research calls, one merge, three loop iterations, two steps in the selected playbook, and one final summary. The false condition path is shorter. validate_routine returns the authoritative estimate for the account and final canonical spec.

4. Preview the decisions ​

This graph is statically bounded, so Claude can ask to run it directly with start_routine_dry_run. Try at least two representative messages:

text
Build a sales plan for entering the Polish market.
text
Build a content plan for entering the Polish market.

Inspect whether:

  • both research branches contribute to the merge;
  • the loop carries the improved result into the next iteration;
  • DECISION_READY is used only when the stated quality bar is met;
  • the condition takes the expected branch;
  • the router title exactly matches Sales playbook or Content playbook;
  • the final summary reflects the selected branch rather than inventing work.

The preview proves graph and prompt behavior only. Public browsing, Business Knowledge and Sales Platform reads are simulated because all tools are removed. Use a narrow live run in MyChatBot to verify those reads.

Variations to ask Claude for ​

Let a person choose the route ​

Replace the Router's selector with:

yaml
        requires_user_input: true
        user_input_message: Choose the playbook to produce.

Claude must remove selector. A user-input Router pauses for a real selection; it cannot sit inside foreach.

Use a different model for the loop ​

Ask Claude to inspect the account model catalog and pin a stronger model only on Critique and improve, while leaving synthesis on the cheaper Agent default. Never copy a model alias from this guide without inventory and validation. See Give each routine step the right model.

Schedule a weekly refresh ​

After a narrow live read succeeds, ask Claude to stage a disabled weekly schedule. Review the run message, timezone, nine-call worst case, and external read volume before separately enabling it.

See also ​