LangGraph Agents

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 chatterFix
Agents pass whole transcriptsPass {"findings": [...]} and ids
Critic writes essays{"approved": bool, "issues": [{"where", "problem", "fix"}]}
LLM supervisor for obvious routingAn if in code
Strong model everywhereSmall models for classify, extract, route
Unlimited revision roundsOne round by default, second only below a score
Agents that add nothingAblate in evals; remove if score holds

Budgets in state

Python
class Budget(TypedDict):    handoffs: Annotated[int, operator.add]    tool_calls: Annotated[int, operator.add]    cost_inr: Annotated[float, operator.add]    deadline: float

Each 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.