May 14, 2026

Reviewing an Agent: From “Works” to “Works Efficiently”

 I recently reviewed an agent that was functionally correct — it answered queries, used tools properly, and produced accurate results.

👉 But it wasn’t efficient.

This is a quick summary of what was happening and what improved.

🧠 Initial Behavior: Reactive Execution

The agent followed a step-by-step execution loop:

Cycle 1 → resolve date via tool
Cycle 2 → fetch primary data
Cycle 3 → fetch additional data
Cycle 4 → fetch metadata
Cycle 5 → final response

What was happening?

  • No upfront planning
  • Data discovered incrementally
  • Each missing piece triggered another tool call
  • All operations executed sequentially

The agent was technically correct, but operationally inefficient.


⏱️ Why a Time Tool Existed

The agent handled queries like:

“first 10 days of last month”

Since LLMs don’t reliably know the current date, a time tool was added to:

  • ensure correct date calculations
  • avoid inconsistent outputs

👉 It solved correctness
👉 But added an extra execution cycle every time


🚨 Core Issue

The agent was reactive instead of planned.

Execution looked like:

Do something → discover missing data → do more → repeat

Instead of:

Understand requirements → plan execution → execute efficiently

🚀 Improvements

1. Provide Current Date Directly

Removed dependency on the time tool by injecting the current date into context.

✅ Eliminated one full execution cycle.


2. Add Upfront Planning

The agent now:

  • identifies required data first
  • plans execution before calling tools
  • understands dependencies early

3. Parallelize Independent Calls

Independent data fetches now execute together instead of sequentially.

This reduced unnecessary waiting between cycles.


4. Add Dependency Awareness

Execution flow became smarter:

  • independent data → parallel execution
  • dependent data → delayed until required

✅ Final Execution Patterns

No dependency

Cycle 1 → fetch all data (parallel)
Cycle 2 → final response

With dependency

Cycle 1 → fetch base data (parallel)
Cycle 2 → fetch dependent data
Cycle 3 → final response

🎯 Final Thought

Many agents already “work.”

The bigger challenge is making them:

  • efficient
  • predictable
  • low latency
  • cost aware

In agent systems, execution planning often matters as much as model quality.

No comments:

Post a Comment