Agentic Architectures

Catalogue / Reasoning & Self-critique

Self-Discover

Compose a reasoning method for this task, then follow it

Shape
pipeline
Model calls
4 (3 to compose the structure, 1 to solve)
Latency
medium
Complexity
low
1

What if no standard method fits my problem?

Before solving, the agent chooses a few general thinking methods from a fixed list, rewrites them for the task at hand and arranges them into a step-by-step structure. Only then does it solve, by filling in that structure.

You may need it if

  • The problem is unusual and "think step by step" gives shallow answers.
  • Similar tasks arrive in batches, so a method found once can be reused.
  • You want to read the method that was followed, not only the answer.
2

When is designing a method overkill?

Use it when

  • The task needs several kinds of reasoning, for example decomposing, then checking constraints.
  • The same structure can serve many tasks of one type, which spreads its cost.
  • An auditor or a colleague must be able to follow how the answer was reached.

Avoid it when

What it costs

Model calls
4 (3 to compose the structure, 1 to solve)
Latency
medium
Complexity
low
3

How does a task become a method, then an answer?

A straight line with no loop. Three steps turn a list of generic thinking methods into a structure made for this task. A fourth step solves the task by completing that structure.

Task: The problem to solve, or one representative example of a task type.TaskSelect: Picks the few thinking methods that are relevant to this task.SelectMethod list: A fixed list of generic thinking methods, such as decomposing or working backwards.Method listAdapt: Rewrites each selected method in the vocabulary of the task.AdaptStructure: Orders the adapted methods into a step-by-step outline with empty slots.StructureSolve: Fills in every slot of the outline, in order, to reach the answer.SolveAnswer: The answer together with the completed outline that produced it.Answer
  1. Step 1 of 4

    Choose the methods

    The agent reads the task and a fixed list of generic thinking methods. It keeps only the three or four that matter here.

  2. Step 2 of 4

    Make them specific

    Each chosen method is rewritten for this task. "Break the problem down" becomes "split the order into stock, shipping and billing".

  3. Step 3 of 4

    Arrange them into an outline

    The adapted methods are ordered into numbered steps with empty slots. No solving happens yet. This outline is the reusable part.

  4. Step 4 of 4

    Solve by filling the outline

    A solver that sees only the task and the outline completes each slot in order. The filled outline is the reasoning trace.

What each part does
Task
The problem to solve, or one representative example of a task type.
Select
Picks the few thinking methods that are relevant to this task.
Method list
A fixed list of generic thinking methods, such as decomposing or working backwards.
Adapt
Rewrites each selected method in the vocabulary of the task.
Structure
Orders the adapted methods into a step-by-step outline with empty slots.
Solve
Fills in every slot of the outline, in order, to reach the answer.
Answer
The answer together with the completed outline that produced it.
  • Select → Adapt: chosen methods
  • Adapt → Structure: task-specific methods
  • Structure → Solve: empty outline

Where it connects

Entry
task
TaskQuestion

A problem statement complete enough to be solved without further information.

Exit
answer
Answer

When: The solver has filled every slot of the outline.

The answer, followed by the completed outline showing each reasoning step.

Memory kept between runs
methods
Procedure

A fixed, read-only list of generic thinking methods. The same list serves every run.

4

What do I ask my assistant to set up?

The agents to launch

Method architect

From the list of thinking methods, select the three or four most useful for this task. Rewrite each one for the task. Then arrange them into a numbered outline whose steps have empty slots. Do not solve the task.

Sees: The task and the full list of thinking methods.

Solver

Solve the task by completing the outline step by step. Fill every slot in order. Do not skip or reorder steps. Finish with the answer on its own line.

Sees: The task and the empty outline only. Not the architect's selection or reasoning.

A prompt you can paste

Works with any assistant that can launch sub-agents. It contains the agents, the procedure and the stop rule above.

Framework-agnostic prompt
You are the orchestrator of a multi-agent workflow that follows the "Self-Discover" architecture.
Launch every agent listed below as a separate sub-agent with its own context. Give each agent only the context stated for it. Do not do an agent's work yourself. If you cannot launch sub-agents, play each agent in a clearly separated turn and never let it use what is withheld from it.

# Task
[Describe your task here]

# Self-Discover
Compose a reasoning method for this task, then follow it.
Input: the task above. It must provide: A problem statement complete enough to be solved without further information. If something essential is missing, ask for it before starting.

Agents to launch:
- Method architect: From the list of thinking methods, select the three or four most useful for this task. Rewrite each one for the task. Then arrange them into a numbered outline whose steps have empty slots. Do not solve the task.
  Context for this agent: The task and the full list of thinking methods.
- Solver: Solve the task by completing the outline step by step. Fill every slot in order. Do not skip or reorder steps. Finish with the answer on its own line.
  Context for this agent: The task and the empty outline only. Not the architect's selection or reasoning.

Procedure:
1. Write a list of about ten generic thinking methods: decompose, work backwards, list constraints, find an analogy, test an extreme case, check assumptions, and similar.
2. Launch the architect on the task and that list. Ask for the selected methods, their adapted versions and the final outline as three separate sections.
3. Check that the outline contains no part of the answer. If it does, ask the architect to remove it.
4. Launch the solver in a fresh context with the task and the outline.

Stop rule: Stop when the solver has filled every step of the outline and stated an answer. There is no retry.

Exit:
- `answer`, when: The solver has filled every slot of the outline. Deliver: The answer, followed by the completed outline showing each reasoning step.

# Final deliverable
The answer, the completed outline, and the empty outline on its own so it can be reused on similar tasks.

The same thing in code

LangGraph, python, package langgraph
from typing import TypedDict, cast

from langchain.chat_models import init_chat_model
from langgraph.graph import END, START, StateGraph
from pydantic import BaseModel

model = init_chat_model("anthropic:claude-sonnet-5-5")

METHODS = [  # the fixed method list
    "Decompose the problem into parts", "Work backwards from the goal", "List the constraints",
    "Find an analogy", "Test an extreme case", "Check the assumptions", "Define the key terms",
    "Consider who is affected", "Estimate before computing", "Look for a counter-example",
]


class Plan(BaseModel):
    selected: list[str]
    adapted: list[str]
    outline: list[str]  # numbered steps with empty slots, no part of the answer


class Input(TypedDict):
    task: str


class State(TypedDict):
    task: str
    plan: Plan
    answer: str


async def architect(state: State) -> dict:
    # select, adapt and structure in one agent; it must not solve
    plan = cast(Plan, await model.with_structured_output(Plan).ainvoke(
        "From the list of thinking methods, select the three or four most useful for this task. "
        "Rewrite each one for the task. Then arrange them into a numbered outline whose steps "
        "have empty slots. Do not solve the task.\n"
        f"Methods: {METHODS}\n\nTask: {state['task']}"))
    return {"plan": plan}


async def solver(state: State) -> dict:
    # fresh context: the task and the empty outline only, not the selection or reasoning
    outline = "\n".join(state["plan"].outline)
    msg = await model.ainvoke(
        "Solve the task by completing the outline step by step. Fill every slot in order. Do "
        "not skip or reorder steps. Finish with the answer on its own line.\n"
        f"Outline:\n{outline}\n\nTask: {state['task']}")
    return {"answer": msg.text}


graph = StateGraph(State, input_schema=Input)
graph.add_node("architect", architect)
graph.add_node("solver", solver)
graph.add_edge(START, "architect")
graph.add_edge("architect", "solver")  # a straight line: no loop, no retry
graph.add_edge("solver", END)
app = graph.compile()


async def run(task: str):
    state = await app.ainvoke({"task": task})
    return {"answer": state["answer"], "outline": state["plan"].outline}

Add a check that the outline holds no part of the answer before the solver runs, and save the empty outline to reuse on tasks of the same type.

Claude Agent SDK, python, package claude-agent-sdk
from typing import Any

from claude_agent_sdk import AgentDefinition, ClaudeAgentOptions, ResultMessage, query

METHODS = [  # the fixed method list
    "Decompose the problem into parts", "Work backwards from the goal", "List the constraints",
    "Find an analogy", "Test an extreme case", "Check the assumptions", "Define the key terms",
    "Consider who is affected", "Estimate before computing", "Look for a counter-example",
]

AGENTS = {
    "architect": AgentDefinition(
        description="Composes a task-specific reasoning outline without solving the task.",
        prompt="From the list of thinking methods, select the three or four most useful for this "
               "task. Rewrite each one for the task. Then arrange them into a numbered outline "
               "whose steps have empty slots. Do not solve the task."),
    "solver": AgentDefinition(
        description="Solves a task by filling in a given outline step by step.",
        prompt="Solve the task by completing the outline step by step. Fill every slot in order. "
               "Do not skip or reorder steps. Finish with the answer on its own line."),
}

PLAN = {"type": "object", "required": ["selected", "adapted", "outline"], "properties": {
    "selected": {"type": "array", "items": {"type": "string"}},
    "adapted": {"type": "array", "items": {"type": "string"}},
    "outline": {"type": "array", "items": {"type": "string"}}}}


async def delegate(agent: str, payload: str, schema: dict[str, Any] | None = None) -> ResultMessage:
    options = ClaudeAgentOptions(
        agents=AGENTS, allowed_tools=["Agent"],
        output_format={"type": "json_schema", "schema": schema} if schema else None)
    prompt = f"Launch the {agent} agent with exactly this input and return its reply:\n{payload}"
    async for msg in query(prompt=prompt, options=options):
        if isinstance(msg, ResultMessage):
            return msg
    raise RuntimeError("no result")


async def run(task: str):
    plan = (await delegate(
        "architect", f"Methods: {METHODS}\n\nTask: {task}\n"
                     "Return the selected methods, the adapted methods and the outline.", PLAN)
            ).structured_output
    outline = "\n".join(plan["outline"])
    # a separate session: the solver gets the task and the empty outline only
    solved = await delegate("solver", f"Outline:\n{outline}\n\nTask: {task}")
    return {"answer": solved.result, "outline": plan["outline"]}

Add a check that the outline holds no part of the answer before the solver runs, and save the empty outline to reuse on tasks of the same type.

OpenAI Agents SDK, python, package openai-agents
from agents import Agent, Runner
from pydantic import BaseModel

METHODS = [  # the fixed method list
    "Decompose the problem into parts", "Work backwards from the goal", "List the constraints",
    "Find an analogy", "Test an extreme case", "Check the assumptions", "Define the key terms",
    "Consider who is affected", "Estimate before computing", "Look for a counter-example",
]


class Plan(BaseModel):
    selected: list[str]
    adapted: list[str]
    outline: list[str]  # numbered steps with empty slots, no part of the answer


architect = Agent(
    name="Method architect", output_type=Plan,
    instructions="From the list of thinking methods, select the three or four most useful for "
                 "this task. Rewrite each one for the task. Then arrange them into a numbered "
                 "outline whose steps have empty slots. Do not solve the task.")
solver = Agent(
    name="Solver",
    instructions="Solve the task by completing the outline step by step. Fill every slot in "
                 "order. Do not skip or reorder steps. Finish with the answer on its own line.")


async def run(task: str):
    plan = (await Runner.run(architect, f"Methods: {METHODS}\n\nTask: {task}")).final_output_as(Plan)
    outline = "\n".join(plan.outline)
    # a separate run: the solver never sees the selection or the architect's reasoning
    solved = await Runner.run(solver, f"Outline:\n{outline}\n\nTask: {task}")
    return {"answer": solved.final_output, "outline": plan.outline}

Add a check that the outline holds no part of the answer before the solver runs, and save the empty outline to reuse on tasks of the same type.

Vercel AI SDK, typescript, package ai
import { generateText, Output } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { z } from 'zod';

const model = anthropic('claude-sonnet-5-5');

const METHODS = [ // the fixed method list
  'Decompose the problem into parts', 'Work backwards from the goal', 'List the constraints',
  'Find an analogy', 'Test an extreme case', 'Check the assumptions', 'Define the key terms',
  'Consider who is affected', 'Estimate before computing', 'Look for a counter-example',
];

const Plan = z.object({
  selected: z.array(z.string()),
  adapted: z.array(z.string()),
  outline: z.array(z.string()).describe('Numbered steps with empty slots, no part of the answer'),
});

export async function run(task: string) {
  // the architect selects, adapts and structures, but does not solve
  const { output: plan } = await generateText({
    model,
    instructions:
      'From the list of thinking methods, select the three or four most useful for this task. ' +
      'Rewrite each one for the task. Then arrange them into a numbered outline whose steps ' +
      'have empty slots. Do not solve the task.',
    prompt: `Methods:\n${METHODS.join('\n')}\n\nTask: ${task}`,
    output: Output.object({ schema: Plan }),
  });

  // a fresh call: the solver gets the task and the empty outline only
  const { text: answer } = await generateText({
    model,
    instructions:
      'Solve the task by completing the outline step by step. Fill every slot in order. ' +
      'Do not skip or reorder steps. Finish with the answer on its own line.',
    prompt: `Outline:\n${plan.outline.join('\n')}\n\nTask: ${task}`,
  });
  return { answer, outline: plan.outline };
}

Add a check that the outline holds no part of the answer before the solver runs, and save the empty outline to reuse on tasks of the same type.

Snippets are generated when the site is built and type-checked against the SDK versions listed in the repository. Treat them as a starting skeleton.

What goes wrong

  • An architect that starts solving leaks its guess into the outline and the solver merely confirms it.
  • Selecting every method produces a long generic outline. Three or four methods is the useful range.
  • Reusing an outline on a task of a different type gives confident, wrong reasoning. Compose a new one.

Chain it

Its result can feed

Source