Using a Language Model in Code › What We've Built
Michael BrenndoerferJune 27, 20251 min read
AI Agent HandbookAll chapters Part 2 of 15Language Models - The Brain of the Agent
Using a Language Model in Code › What We've BuiltOne section · Sections in this chapter10 / 15 ↓
Sections in this chapter15
In just a few dozen lines of code, you've created the foundation of an AI agent:
- A function that can send prompts to a language model
- Error handling for when things go wrong
- A simple chat interface for interacting with the assistant
- Understanding of how to control the model's behavior
This is the core of every AI agent. Everything else we build (tools, memory, planning, reasoning) will be additions and enhancements to this basic pattern of sending messages and receiving responses.