50 lines to code an agent, 5000 to trust it

← All talks

Abstract

Every developer has watched an AI coding agent read files, edit code and run tests, and every developer has wondered what is actually going on. The honest answer is less magical than it looks: a model with a toolbox, and a loop that lets your own code decide what the model may do.

In this talk we build that loop from scratch in PHP, in about 50 lines. We use native tool calling, give the agent three small tools defined as plain classes with attributes, and watch it turn an empty folder into working, tested code. It's the easy part, and it's also where most tutorials stop.

Then we do what the tutorials skip. We point the naive agent at a file containing a hidden instruction and watch it obey. We show how it escapes the project directory and how it can run forever. Each failure leads to a small, testable control: a path jail, approvals for risky actions, budgets for steps, tokens and time, and a sandbox with no secrets. We replay the same attack against the hardened agent.

Finally, we look at what separates a demo from something your team can rely on: logging the path an agent took rather than just its final answer, a tiny eval harness that turns "it feels better" into a pass rate, and how PHPStan, Rector and PHPUnit become the agent's feedback loop. We close with an honest comparison of building your own, extending Symfony AI, or using a mature agent, and where MCP fits in.

You'll leave with a clear mental model of how coding agents work, a working PHP starting point, and a checklist for deciding when an agent is trustworthy enough to use.

What attendees will learn
- How the agent loop works, and why the model never touches your filesystem
- How to define tools in PHP with attributes and reflection
- How prompt injection works in practice, and which defences are structural rather than prompt-based
- How to add path jails, approvals, budgets and sandboxing
- How to observe and evaluate an agent with logs and a small eval set
- When to build, extend Symfony AI, or adopt an existing agent