Build Your Own Coding Agent
| Instructor: | Duncan Ogilvie |
|---|---|
| Duration: | 1 day |
| Format: | Virtual workshop with presentation and guided exercises. |
| Price: | €200 per attendee (10 minimum) plus consumed API credits |
| Registration: | training@ogilvie.pl |
Description
Coding agents combine an LLM with tools, context, state, and an execution loop. This workshop teaches participants how coding agents work by building a small agent from scratch.
The course starts with LLM API fundamentals. Participants learn how chat messages, roles, tokens, context windows, model parameters, errors, and cost tracking affect agent behavior. They build a command-line chat client and extend it into a multi-turn conversation loop.
The second part adds tool calling. Participants define tool schemas, execute controlled file-system and shell operations, return tool results to the model, and implement an agent loop that can inspect files, edit code, run commands, and recover from failures.
The final part covers model selection, system prompts, context management, task decomposition, safety boundaries, and evaluation. Participants leave with a working reference implementation and a mental model for debugging production coding agents such as Claude Code, Cursor, and Codex.
Teaching
The workshop is exercise-driven. Each concept is implemented immediately in a small task, and the exercises build toward a working coding agent. Python and C++ tracks are available.
The course goal is operational understanding. Participants learn how to reason about model output, tool-call failures, prompt changes, context growth, command output, edit mistakes, and cost tradeoffs using simple code they wrote themselves.
The material is designed for software teams adopting AI coding tools, developers who want to build internal agents, and technical leads who need to evaluate agent capabilities and limitations.
Learning Objectives
- Explain the components of a coding agent: model, messages, tools, context, state, and loop.
- Use a chat completions API from a small command-line program.
- Track conversation history and understand context-window limits.
- Define tool schemas that an LLM can call reliably.
- Implement tool dispatch for file reads, file writes, targeted edits, and shell commands.
- Feed tool results back into the model and continue the agent loop.
- Handle errors from API calls, invalid tool requests, failed commands, and malformed edits.
- Design prompts and system instructions that constrain agent behavior.
- Compare models by cost, latency, context size, reliability, and tool-use quality.
- Add basic safeguards around command execution and file modification.
- Understand how production coding agents plan, act, observe results, and recover.
- Evaluate when an agent should continue, ask for input, or stop.
Outline
- Day 1: Coding Agent Fundamentals and Implementation
- Agent architecture overview
- LLM APIs, chat messages, roles, and model responses
- Tokens, context windows, latency, and cost
- Tool calling as the bridge between language output and program actions
- The agent loop: plan, act, observe, and continue
- Common failure modes in coding agents
- Environment setup
- Python 3.12+ or C++ compiler setup
- Repository checkout and dependency installation
- API key configuration
- First request sanity check
- Exercise 1: Basic LLM client
- Send a single chat request
- Parse the response
- Print token usage and estimated cost
- Handle API errors
- Exercise 2: Multi-turn chat
- Store message history
- Add a command-line interaction loop
- Preserve context across turns
- Experiment with system prompts and model parameters
- Tool-calling foundations
- Function/tool schemas
- JSON arguments and validation
- Tool result messages
- Separating model decisions from local side effects
- Exercise 3: First tools
- Implement a small tool registry
- Add a deterministic utility tool
- Dispatch model-requested tool calls
- Return structured tool results to the model
- File-system tools
- Reading files safely
- Writing new files
- Targeted text replacement for edits
- Handling missing files, duplicate matches, and failed edits
- Exercise 4: Coding tools
- Add read, write, and edit tools
- Ask the agent to inspect a small project
- Make a controlled code change
- Review the diff produced by the agent
- Shell execution tools
- Running commands from the agent loop
- Capturing stdout, stderr, exit codes, and timeouts
- Passing command output back into the model
- Limiting command scope for safety
- Exercise 5: Autonomous coding task
- Give the agent a small bug or feature request
- Let it read files, edit code, and run tests
- Diagnose failed commands and bad edits
- Stop the loop when the task is complete
- Model selection and agent quality
- Comparing cheap, fast, and high-capability models
- Context-size effects on coding tasks
- Prompt length, tool descriptions, and reliability
- Cost controls and logging
- Exercise 6: Self-improvement and evaluation
- Add logging for agent traces
- Compare two models on the same task
- Improve the system prompt or tool descriptions
- Run the task again and compare behavior
- Discussion
- How production coding agents differ from the workshop implementation
- Integration options for internal developer tools
- Security and governance concerns for agentic file and shell access
- Follow-up paths for planning, retrieval, memory, sandboxing, and code review workflows
- Agent architecture overview
Requirements and Recommendations
Prerequisites
Participants should be familiar with:
- Programming in Python or C++.
- Basic command-line usage.
- Git and ordinary software project workflows.
- Reading small API examples and adapting them.
Helpful but optional:
- Prior use of Claude Code, Cursor, Codex, or another coding agent.
- Basic knowledge of HTTP APIs and JSON.
- Experience with automated tests.
Workstation Requirements
Each participant needs their own workstation with:
- A working Python 3.12+ environment or a C++ compiler.
- Git.
- A terminal and code editor.
- Internet access.
- Access to an LLM API key for the exercises.
Delivery Requirements
The workshop is delivered virtually by default for 10–30 participants. Screen sharing, chat, and breakout troubleshooting are used during the exercise blocks.
In-person delivery is possible. A dedicated room with a projector, reliable Wi-Fi, and participant power access is required.
Instructor
Duncan Ogilvie is the creator of x64dbg and the author of Vibe Engineering: What I've Learned Working with AI Coding Agents. He has professional experience in reverse engineering, binary tooling, DRM, mobile security, and AI-assisted development workflows. He has delivered this workshop to 30+ participants and uses the material to explain coding agents through implementation.