Back to directory

Mini Agent

Mini Agent is a minimal AI agent example built with nothing but Python, the OpenAI SDK and a while loop, written to accompany a blog article series that explains how agent frameworks work under the hood.

Mini Agent

The agent calls tools when needed, observes their results, and loops until it produces a final answer, in three selectable modes: a fully local mode using only an Ollama model, a fully remote mode using a cloud provider such as OpenAI, Anthropic or Gemini, and a mixed mode where the local model orchestrates the loop and delegates complex subtasks to a remote model through its own helper function.

In mixed mode, simple tool calls such as arithmetic or getting the date stay local, while knowledge-heavy questions are delegated to the remote model, illustrating a concrete cost and capability trade-off rather than only a coding pattern.

It requires a Python virtual environment and, for local or mixed modes, a running Ollama installation with a function-calling-capable model pulled locally.

More in Tutorials

See all 478
  • BootLife

    github.com

    Conway's Game of Life implemented to run directly from a 512-byte x86 boot sector in assembly, using VGA memory itself as the simulation grid.

  • A technical blog post deriving the Y combinator as a composition of combinator birds in an array language, and examining how eager evaluation changes fixed-point recursion compared with the usual lazy telling.

  • System Design Atlas

    atlas-sysdes.vercel.app

    A free reference of worked system design problems with interactive architecture diagrams, covering ranked designs such as a feed, a chat app, a URL shortener, and a rate limiter, plus pages on the technologies behind them.