Lasater describes an agent as an LLM with memory, planning, tools, and a loop. He breaks memory into read and write operations, and the loop into conditions and repetition, then starts with a standard chat completion call.
Lets Build An Agent from Scratch
Speaker
Kam Lasater of AI Engineer explains how to build a basic LLM agent from scratch, using code examples and tools to show how its components work.
He adds an LLM judge that checks whether an answer fully addresses the question, then introduces Google Search through SerpApi. The client code must handle tool calls and their arguments, return tool results to the conversation, and call the LLM again. A location validation error shows that tool inputs must meet the API’s requirements.
Lasater refactors the tool loop into a utility that can run multiple calls, including repeated calls to the same tool with different inputs. Each result is linked to its request with a tool call ID. He suggests thinking of tools as text transformations, often taking parameters and returning a string.
He adds tools to create and complete to-dos, inspect the list, and check whether the goal is done. The agent’s instructions tell it to make a plan before working, use available tools, and report its actions. A web-browsing tool fetches a URL and converts its content to Markdown; a sample run researches how to build agents without a framework.
Lasater demonstrates the agent planning a date with activities and dinner, while noting that it is imperfect. He describes the progression from an LLM call through conditions, tools, and to-do-list planning as a way to build a more capable system. Possible next steps include adding a vector database or a RAG system.
Takeaways
- Build an agent incrementally: start with an LLM call, then add conditions, tools, and planning.
- The client code must execute tool calls and pass each result back to the LLM.
- Use tool schemas to define valid inputs, and handle API validation errors explicitly.
- Add a limit on tool iterations so the agent cannot loop indefinitely.
- A to-do list can give the agent explicit steps and a way to track completed work.
Mentioned in this talk
Search inside this talk
What was claimed 8
- usesKam Lasater uses
OpenAI“This is straight from the OpenAI Hello World docs”
YouTube Unverified1 source· Talk
- feature
SERP API: Makes Google Search API queries accessible through a JSON API“they basically make the Google Search API easy to use as a JSON API”
YouTube Unverified1 source· Talk
- usesKam Lasater uses
SERP API“we're incorporating SerpApi”
YouTube Unverified1 source· Talk
- usesKam Lasater uses OpenAI SDK
“it's not handled by the OpenAI SDK”
YouTube Unverified1 source· Talk
- featureTurndown: Converts web page text into Markdown
“uses Turndown to turn it into Markdown”
YouTube Unverified1 source· Talk
- usesKam Lasater uses Turndown
“uses Cheerio and Turndown”
YouTube Unverified1 source· Talk
- usesKam Lasater uses Cheerio
“uses Cheerio and Turndown”
YouTube Unverified1 source· Talk
- usesKam Lasater uses
ChromaDB
“injecting these browsed web pages into a ChromaDB in memory”
YouTube Unverified1 source· Talk











