E1 · The matrix in the example
10 minClone the practice project, save decide.py and tarefas.txt, and run it.
Done when: python3 decide.py tarefas.txt | grep -c "^decisão:" → 4, and the market research comes out as decisão: híbrido.
Lesson 1 · 15 min
Every extra agent reads the context again, spends its own quota, and has to be coordinated. For most code tasks, a single agent, or subagents that return little, gets you more. In this lesson you decide before opening the second agent, using a matrix of signals that runs as a script.
Start the lesson
Goal: decide between a single agent, sequence, parallel, or hybrid using the signal matrix, before opening the second agent.
Click each step. The matrix comes from the arquiteto-de-execucao kit (agenteexecuta).
The matrix is a starting point, not a measurement. It prevents the reflex of opening agents just because you can.
What is published, with dates, and what each number measures.
In Anthropic's post about its research system (06/13/2025): agents use about 4× the tokens of a chat, and multi-agent systems about 15×. The data is theirs, from a research product.
The Claude Code agent teams doc says the same without a number: a team uses significantly more tokens than a single session, and the spend grows with each active teammate.
In the same post, an Opus 4 lead with Sonnet 4 subagents beat Opus 4 alone by 90.2% on their internal research evaluation, on breadth questions (many independent directions).
The post itself warns: most coding tasks have fewer parallelizable parts than research, and agents still coordinate poorly in real time. No measurement from this course shows that gain carrying over to your code.
The arquiteto-de-execucao matrix shows the math (illustrative example, not measured): three agents that read 50k of context and work 20k each add up to 210k; one agent that reuses the context does the same with 110k.
The savings come from not repeating the setup. Parallel pays off when each task has small context.
No subagent without an explicit task, input, and output; at most one level of delegation, unless clearly necessary; two attempts per item before rethinking; don't reprocess an approved item.
Mechanical work (converting, rendering, running tests) goes to a script, not an agent.
Write each task's signals in a file; the script adds them up and decides. No model involved: it runs for free.
git clone https://github.com/inematds/inema-agent-runtime.git ~/treino-multi cd ~/treino-multi && git log -1 --format='%h %cs' # testado em 5cb431b 2026-10-05
# decide.py — decision matrix of the arquiteto-de-execucao (inematds/agenteexecuta), in code
# Usage: python3 decide.py tarefas.txt
# tarefas.txt: one block per task; "# nome" opens the block; then, one code per line:
# S1..S6 = sequence signals, P1..P7 = parallel signals,
# simples = small task (the matrix does not apply), erro-caro = high cost of error
import sys
SEQ = {"S1": "depende da saída anterior", "S2": "contexto compartilhado grande",
"S3": "decisões precisam ficar consistentes", "S4": "erro inicial contamina várias tarefas",
"S5": "juntar versões divergentes sai caro", "S6": "uma etapa ensina a seguinte"}
PAR = {"P1": "tarefas independentes", "P2": "entradas congeladas",
"P3": "cada saída se valida sozinha", "P4": "trabalho mecânico ou determinístico",
"P5": "contexto pequeno por tarefa", "P6": "urgência alta", "P7": "há máquina sobrando"}
def decide(nome, cods):
print(f"# {nome}")
for c in cods:
if c not in SEQ and c not in PAR and c not in ("simples", "erro-caro"):
print(f"aviso: código desconhecido '{c}' (ignorado)")
if "simples" in cods:
print("decisão: direto (um agente só, sem matriz)\n")
return
s = sum(c in SEQ for c in cods)
p = sum(c in PAR for c in cods)
if abs(s - p) >= 2:
d = "sequencial" if s > p else "paralelo"
else:
d = "híbrido"
print(f"sequência: {s} · paralelo: {p} · diferença: {abs(s - p)}")
print(f"decisão: {d}")
if "erro-caro" in cods:
print("custo de erro alto: planejamento e revisão centralizados")
print()
nome, cods = None, []
for linha in open(sys.argv[1], encoding="utf-8"):
linha = linha.strip()
if linha.startswith("#"):
if nome:
decide(nome, cods)
nome, cods = linha.lstrip("# ").strip(), []
elif linha:
cods.append(linha.split()[0])
if nome:
decide(nome, cods)# refactor the login module S1 each step uses the previous one S2 the whole module has to be in your head S3 same names and contracts everywhere S4 an error in the contract breaks the rest erro-caro # convert 500 .md files to .html P1 one file doesn't depend on another P2 the converter and the model are locked P3 each .html checks itself P4 it's mechanical P5 each file is small # market research across 4 segments S3 the questions have to be the same S6 the first segment tunes the questions P1 independent segments P5 little context per segment # summarize a text in 5 lines simples
cd ~/treino-multi python3 decide.py tarefas.txt; echo "saída: $?"
# refatorar o módulo de login sequência: 4 · paralelo: 0 · diferença: 4 decisão: sequencial custo de erro alto: planejamento e revisão centralizados # converter 500 arquivos .md para .html sequência: 0 · paralelo: 5 · diferença: 5 decisão: paralelo # pesquisa de mercado em 4 segmentos sequência: 2 · paralelo: 2 · diferença: 0 decisão: híbrido # resumir um texto em 5 linhas decisão: direto (um agente só, sem matriz) saída: 0
Converting 500 files is mechanical parallel work: a script with several workers and a sample check at the center (that's lesson 3). The market research came out tied: the first segment runs alone, the other three in parallel.
A lowercase code doesn't count. The script warns you instead of quietly adding it up, and the decision changes. Captured the same day:
# migrar o banco aviso: código desconhecido 's1' (ignorado) sequência: 1 · paralelo: 1 · diferença: 0 decisão: híbrido
With the correct S1, it would be sequence 2 × parallel 1, still hybrid, but for a reason you chose. Check grep -c "^aviso:" decisao.md → 0.
First the example, then three tasks of your own.
Clone the practice project, save decide.py and tarefas.txt, and run it.
Done when: python3 decide.py tarefas.txt | grep -c "^decisão:" → 4, and the market research comes out as decisão: híbrido.
Write minhas-tarefas.txt with three real tasks from your week (one you've thought about splitting between agents). Mark only the signals that are true today.
Done when: python3 decide.py minhas-tarefas.txt > decisao.md; grep -c "^decisão:" decisao.md → 3 and grep -c "^aviso:" decisao.md → 0.
Question 1 of 4
According to Anthropic's post (Jun/2025), how many tokens does a multi-agent system use compared to a chat?skill
Question 2 of 4
Sequence 3, parallel 2. What does the matrix say?skill
Question 3 of 4
A migration with a high cost of error scored parallel. What changes?
Question 4 of 4
Why doesn't the research system's 90.2% gain apply directly to your code?
Choose one option. The explanation appears after your attempt.