This chapter covers
- Selecting the right LLM for agent development
- Using LLM APIs with LiteLLM
- Using prompt engineering for agents
- Experiencing LLM limitations through the GAIA benchmark
Throughout this book, we’ll build a research agent—a system that can interpret requests such as “survey recent work on X” and “extract key findings from these PDFs,” gather information from multiple sources, and synthesize findings into comprehensive answers. At the heart of this agent is the large language model (LLM), which serves as its decision-making brain. But before we can build an effective agent, we have to answer some fundamental questions. Which LLM should we use, and how do we communicate with it programmatically? What can an LLM do on its own, and where does it fall short?
We’ll address these questions head-on in this chapter (figure 2.1), starting by exploring how to choose an LLM for agent development; then we’ll get hands-on with APIs, using LiteLLM to work seamlessly across providers. We’ll examine prompt engineering principles that transform a general-purpose LLM into a reliable agent. Finally, we’ll put LLMs to the test using the General AI Assistants (GAIA) benchmark, directly experiencing their limitations when faced with real-world problems. This experiment will reveal exactly why agents need tools, setting the stage for everything we build in chapter 3 and beyond.
Figure 2.1 Journey through the book: chapter 2