Intelligent agents are considered by many to be the ultimate goal of AI. The classic book by Stuart Russell and Peter Norvig defines the field of AI research as the study of agents that perceive and act.[reference:149]
The unprecedented capabilities of foundation models have opened the door to agentic applications that were previously unimaginable. These new capabilities make it finally possible to develop autonomous, intelligent agents to act as our assistants, coworkers, and coaches.[reference:150]
What Is an Agent?
An agent is anything that can perceive its environment and act upon that environment.[reference:151] An agent is characterized by the environment it operates in and the actions it can perform.[reference:152]
The environment is defined by the use case: a game, the internet, a road system. The actions an AI agent can perform are augmented by the tools it has access to.[reference:153] ChatGPT is an agent, with tools like web search, Python execution, and image generation. RAG systems are agents, with retrievers and SQL executors as their tools.[reference:154]
Tools: The Key to Capability
Tools help an agent to both perceive the environment and act upon it. Actions that allow perception are read actions, while actions that act upon the environment are write actions.[reference:155]
The set of tools an agent has access to is its tool inventory. More tools give more capabilities, but also make it more challenging to understand and utilize them well.[reference:156]
Categories of Tools
Knowledge Augmentation: Text retrievers, image retrievers, SQL executors, internal people search, inventory APIs, Slack retrieval, email readers.[reference:157]
Web Browsing: Web browsers and APIs such as search APIs, news APIs, GitHub APIs, or social media APIs. Web browsing prevents a model from going stale and allows it to access up-to-date information.[reference:158]
Capability Extension: Calculators, calendars, timezone converters, unit converters, translators, code interpreters.[reference:159]
Multimodal Capabilities: Text-to-image models, image captioning, transcription, OCR.[reference:160]
The Power of Tool Use
Tool use can significantly boost a model's performance compared to just prompting or even finetuning. A GPT-4-powered agent augmented with 13 tools outperformed GPT-4 alone on several benchmarks. On ScienceQA, it improved the best published few-shot result by 11.37%. On TabMWP, it improved accuracy by 17%.[reference:161]
Planning: The Brain of the Agent
At the heart of a foundation model agent is the model responsible for solving user-provided tasks. A task is defined by its goal and constraints.[reference:162] Complex tasks require planning. The output of the planning process is a plan, a roadmap outlining the steps needed.[reference:163]
Decoupling Planning from Execution
To avoid fruitless execution, planning should be decoupled from execution. You ask the agent to first generate a plan, and only after this plan is validated is it executed.[reference:164]
The plan can be validated using heuristics or AI judges. If the plan is bad, generate another. If good, execute it.[reference:165]
Function Calling
Many model providers offer function calling, effectively turning their models into agents. You declare all tools, their parameters, and documentation. The model automatically generates what tools to use and their parameters.[reference:166]
Hierarchical Planning
A detailed plan is harder to generate but easier to execute. A higher-level plan is easier to generate but harder to execute. An approach to circumvent this tradeoff is to plan hierarchically: first generate a high-level plan, then expand each part.[reference:167]
Control Flows
Plans can be sequential, parallel, conditional (if statements), or repetitive (for loops).[reference:168]
Reflection and Error Correction
While reflection isn't strictly necessary for an agent to operate, it's necessary for an agent to succeed.[reference:169] Reflection can be done after each step, after a group of steps, or after the whole plan.[reference:170]
ReAct Framework
First proposed by Yao et al., interleaving reasoning and action has become a common pattern. At each step, the agent explains its thinking (planning), takes actions, then analyzes observations (reflection).[reference:171]
Reflexion Framework
Reflection is separated into two modules: an evaluator that evaluates the outcome and a self-reflection module that analyzes what went wrong.[reference:172]
Evaluating Agents
Evaluation is about detecting failures. Agents have unique failures caused by planning, tool execution, and efficiency.[reference:173]
Planning Failures
- Invalid actions (calling a tool that doesn't exist)[reference:174]
- Invalid parameters[reference:175]
- Wrong parameter values[reference:176]
- Goal failure: the plan doesn't solve the task or violates constraints[reference:177]
- Time constraints[reference:178]
- Reflection errors: the agent thinks it's done when it isn't[reference:179]
Tool Failures
- Wrong tool outputs[reference:180]
- Translation errors (if using high-level plans)[reference:181]
- Missing tools[reference:182]
Efficiency Metrics
- Number of steps[reference:183]
- Time per action[reference:184]
- Cost per action[reference:185]
The Bottom Line
At its core, the concept of an agent is fairly simple. An agent is defined by the environment it operates in and the set of tools it has access to. In an AI-powered agent, the AI model is the brain that leverages its tools and feedback from the environment to plan how best to accomplish a task.[reference:186]
Access to tools makes a model vastly more capable, so the agentic pattern is inevitable. While the concept of "agents" sounds novel, they are built upon many concepts that have been used since the early days of LLMs, including self-critique, chain-of-thought, and structured outputs.[reference:187]