Performance: Creating tools for agents
MEDIUM IMPACT
This affects the responsiveness and efficiency of agent interactions by controlling how external tools are integrated and called during runtime.
import asyncio class AsyncTool: async def run(self, input): await asyncio.sleep(0.1) # Simulates fast async response return f"Processed {input}" agent = Agent(tools=[AsyncTool()]) response = await agent.run('query')
class SlowTool: def run(self, input): import time time.sleep(2) # Simulates slow response return f"Processed {input}" agent = Agent(tools=[SlowTool()]) response = agent.run('query')
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous blocking tool call | Minimal | 0 | Blocks interaction for seconds | [X] Bad |
| Asynchronous non-blocking tool call | Minimal | 0 | Minimal delay, smooth interaction | [OK] Good |