Performance: Why agents add autonomy to LLM apps
This concept affects the responsiveness and resource usage of LLM apps by enabling autonomous decision-making and task management.
Jump into concepts and practice - no test required
const agent = new Agent(llm, tools); const result = await agent.run(input);
const response = await llm.call(input); const result = await processResponse(response);
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual sequential LLM calls | Minimal | 0 | Low | [X] Bad |
| Agent-managed autonomous calls | Minimal | 0 | Low | [OK] Good |
from langchain.agents import initialize_agent
from langchain.llms import OpenAI
llm = OpenAI(temperature=0)
tools = [SearchTool(), CalculatorTool()]
agent = initialize_agent(llm=llm, tools=tools, agent_type='zero-shot')
response = agent.run('What is the square root of 256?')from langchain.agents import initialize_agent
llm = OpenAI()
tools = [SearchTool()]
agent = initialize_agent(llm, tools, agent_type='zero-shot')
agent.run('Find the weather in Paris')