---
title: "You Should Write An Agent"
description: "Thomas Ptacek argues that people should build an LLM agent before forming strong opinions about the technology, because implementation reveals how simple and surprising the underlying system can be. The example starts with a Python loop around the OpenAI Responses API, storing user and assistant messages in a context list to simulate conversation with a stateless model. Adding a JSON-defined ping function and a tool-calling loop lets the model choose and execute multiple network checks, demonstrating behavior not explicitly hard-coded in the loop. The discussion extends this pattern to coding agents, contexts persisted in SQLite, sub-agents, and design choices involving nondeterminism, ground truth, interchange formats, and token costs. It concludes that these remain open software-engineering problems whose practical behavior can be understood by building and iterating on agents."
---

# You Should Write An Agent

[Fly.io](https://yomu.fyi/company/fly-io) · Nov 6, 2025

**Type:** Tutorial

## Summary

Thomas Ptacek argues that people should build an LLM agent before forming strong opinions about the technology, because implementation reveals how simple and surprising the underlying system can be. The example starts with a Python loop around the OpenAI Responses API, storing user and assistant messages in a context list to simulate conversation with a stateless model. Adding a JSON-defined ping function and a tool-calling loop lets the model choose and execute multiple network checks, demonstrating behavior not explicitly hard-coded in the loop. The discussion extends this pattern to coding agents, contexts persisted in SQLite, sub-agents, and design choices involving nondeterminism, ground truth, interchange formats, and token costs. It concludes that these remain open software-engineering problems whose practical behavior can be understood by building and iterating on agents.

## Context

The author presents LLM agents as a major computing idea whose practical behavior is difficult to understand abstractly. Building one is framed as a way to form sharper opinions, including informed criticism, while investigating unresolved engineering questions around agent design.

## Approach / What changed

A Python implementation uses the OpenAI Responses API, a context array, and a loop for multi-turn interaction. A JSON-defined ping tool is added through function calls, with the agent repeatedly processing tool outputs. The discussion then considers extensions including bash, SQLite-backed context, alternative languages, and sub-agents.

## Takeaways

- The LLM is described as a stateless black box; multi-turn conversation comes from replaying stored user and assistant messages on every call.
- Tool use requires a tool definition, a function that executes the requested operation, and a loop that returns function-call outputs to the model until no further calls are requested.
- Agent design involves balancing explicit control against useful nondeterminism, connecting outputs to ground truth, coordinating intermediate forms, and containing token costs.

**Tags:** [AI Agents](https://yomu.fyi/topic/ai-agents), [LLMs](https://yomu.fyi/topic/llm), [Python](https://yomu.fyi/topic/python)

- Source: [Fly.io](https://fly.io/blog/everyone-write-an-agent)
- Source URL: https://fly.io/blog/everyone-write-an-agent
- Ingested by Yomu: 2026-09-02T11:57:29.652Z

[Read original post](https://fly.io/blog/everyone-write-an-agent)
