Skip to content

Instantly share code, notes, and snippets.

@codebutler
Created July 9, 2026 20:58
Show Gist options
  • Select an option

  • Save codebutler/2b6d9d77c023da097f867381ac172195 to your computer and use it in GitHub Desktop.

Select an option

Save codebutler/2b6d9d77c023da097f867381ac172195 to your computer and use it in GitHub Desktop.
interview-agent.md

Overview

Build a minimal chat agent that runs a small open-weight language model locally on your machine. The agent should converse and answer general questions. When the user asks something involving arithmetic, it should call a calculator tool to compute the exact answer instead of doing the math itself.

Agenda

  1. Model selection and setup (~10 min)
  2. Design doc (~15 min)
  3. Build + background chat (~10 min)
  4. Code review (~25 min)

Requirements

  1. Local model — Everything must run on your own machine. No calls to a hosted LLM API (OpenAI, Anthropic, etc).
  2. Chat interface — A way to send a message and see the conversation history, including assistant turns and an indicator when a tool is being called.
  3. Agent loop — The agent should be able to hold a conversation, and call a tool when needed, get the result back, and use it to produce a final answer. Small models often malform tool calls, so handle that gracefully.
  4. Calculator tool — A tool that takes a standard math expression as a string (e.g. "(12 + 8) * 3 / 2") and returns the correct numeric result. Must support at minimum + - * / and parentheses with correct operator precedence.

Use of AI tools

Use whatever AI coding assistants you'd normally reach for. We care about your design decisions, not your typing speed. You're welcome to use AI for research, or to improve the writing in your design doc, but the decisions in it need to be yours. Do not paste this entire prompt into a tool and let it generate the whole solution.

1. Model selection and setup

Pick any instruct-tuned model that runs responsively on a laptop. Explain your choice, including things like:

  • Parameter count and what it means for speed and quality.
  • Quantization level and the tradeoff it represents.
  • Context window and any other characteristics relevant to your pick.

A few known-good options if you want a starting point:

  • Llama-3.2-1B-Instruct
  • Qwen2.5-1.5B-Instruct
  • Phi-3-mini-4k-instruct

Once you've picked a model, select your tech stack, and use a coding agent to set up an empty project. Kick off the model download right away so it can run in the background while you write your design doc (might be slow). Options include:

  • Browser — run the model locally via WebLLM (Chromium recommended). Implement the minimal code to trigger a download, then confirm it works.
  • CLI — run the model locally via a local inference runtime (e.g. Ollama, llama.cpp, LM Studio). Install your runtime of choice and start pulling a model (e.g. ollama pull qwen2.5:1.5b or ollama pull llama3.2:1b).

Use of any third-party libraries is fine, as long as you can explain what they do and why you picked them.

2. Design doc

Write a design doc explaining how the system will work and the decisions behind it. Include things like:

  • Agent loop — how the conversation flows, and how tool calls get triggered, executed, and fed back.
  • Tool schema — what the calculator tool takes as input and returns as output.
  • Dependencies — any third-party libraries you plan to use.
  • Failure handling — what happens when a tool call comes back malformed.

3. Build + background chat

Hand your design doc to a coding agent (Claude Code, Cursor, Copilot, or whatever you'd normally reach for) and let it build the implementation.

While it works, we'll use the time to talk about your background: past AI projects you've worked on, and what draws you to this role.

4. Code review

Treat the generated code like a pull request someone else opened that you now need to review. Walk through it and explain your thinking as you go. Leave comments for the agent so it can make a final pass.


Extra credit (optional)

If you finish early, any of these are fair game, pick whatever interests you most:

  • Notes tool — add a second tool that lets the agent save and recall notes across turns, giving it some persistent state to manage.
  • Streaming — stream the model's response token by token instead of waiting for the full completion.
  • Model comparison — try a second model size and talk through how tool-calling reliability changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment