Course Content
LangGraph Agents
7 sections · 49 lessons
How do you avoid “agent chatter” and keep collaboration cost-effective?
What you need to know
| Source of chatter | Fix |
|---|---|
| Agents pass whole transcripts | Pass {"findings": [...]} and ids |
| Critic writes essays | {"approved": bool, "issues": [{"where", "problem", "fix"}]} |
| LLM supervisor for obvious routing | An if in code |
| Strong model everywhere | Small models for classify, extract, route |
| Unlimited revision rounds | One round by default, second only below a score |
| Agents that add nothing | Ablate in evals; remove if score holds |
Budgets in state
1class Budget(TypedDict):2 handoffs: Annotated[int, operator.add]3 tool_calls: Annotated[int, operator.add]4 cost_inr: Annotated[float, operator.add]5 deadline: floatEach node adds its usage; the supervisor or a routing edge sends the run to finalise when any limit is reached.
Measure the right thing
Cost per successful task = total cost of all runs divided by the number of runs that succeeded. A system that costs Rs 2 per run but succeeds 50% of the time costs Rs 4 per success.
A real-life example
A market-research system had five agents that reviewed each other's work in a round-table. Average run: 64 model calls, 410,000 tokens, Rs 38. Tracing showed that 40% of tokens were agents summarising what the previous agent said. The team changed three things: artifacts instead of shared messages, a structured critic with one round, and a code supervisor. The result was 19 calls, 95,000 tokens and Rs 9 per run, with the same eval score (84% versus 85%). Then they removed the "fact-checker" agent: the score stayed at 84%, and cost fell to Rs 7.
Follow-up questions to expect
- "How do you find chatter?" — Trace every node's input and output tokens; look for agents whose output is mostly restatement, and for loops that end with the same artifact they started with.
- "Does a smaller model hurt quality?" — Measure per role. Routing and extraction usually hold up on small models; final writing often does not.
- "What is an ablation?" — Removing one component and re-running the eval to see whether the score drops. No drop means the component was not earning its cost.