Skip to main content

Your research agent gives good answers but costs about ₹45 and takes three minutes per task, against a target of ₹10 and one minute. Where do you look?

Agents and tools · Pro 2

Short answer

Measure tokens and time per step from traces. In agents, input tokens usually dominate because the whole history is sent again at every step. So trim tool outputs, compact history, cache the stable prefix, cut needless steps, run independent tool calls in parallel, and use a smaller model for simple steps. Check quality on the eval set after each change.

Deeper answer

An agent's cost is not one call. It is the number of steps times a context that grows each time. A run of 25 steps, where each step re-sends everything so far, pays for the early tool results 25 times. So the biggest levers are usually fewer steps and less context per step, before model price.

In practice I look for large tool results, such as full web pages, and return only the relevant part. I summarise or drop old results. I keep the system prompt and tool definitions stable, so provider prompt caching applies. I look for steps the agent repeats and fix the cause. For latency, independent searches can run in parallel, and slow tools need their own fix. A cheaper model can do routing or extraction while the stronger one writes the final answer. Each change is checked against the eval set, because a cheap agent with wrong answers is worth nothing. Interviewers listen for measurement and for seeing how context growth drives cost.

What a strong answer covers

Answer it out loud in the mock interview about 2 min

Follow-ups to expect

Common mistakes

Learn it

Cost control

Practice Agents and tools questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.