An AI agentAn AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.Full definition →'s application code controls the conversation history and executes the tools the model requests. Fly.io'stutorial makes that division visible with a small loop: send the history and available tools to a model, execute a requested tool, append its result, and ask the model what to do next.
That makes context windowThe maximum amount of text a model can consider at once — its working memory for the current conversation or task.Full definition → management an ordinary programming responsibility. Saved messages, tool descriptions, and returned data all occupy the model's limited input space. The application can choose what to retain or give separate tasks different histories and tools. Building the loop exposes those choices directly, even though the tutorial's small example leaves production engineering unresolved.
Terms in this piece · Glossary
AI agent — An AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.
context window — The maximum amount of text a model can consider at once — its working memory for the current conversation or task.