Agent as code

ProductionOperations and adoptionPublished By Simon Budziak

Agent as code is the practice of defining an agent in version-controlled files rather than in a console: its instructions, model settings, tools, permissions and memory, applied to a running environment through a reviewed plan. It applies infrastructure-as-code habits to agent configuration.

What moves into the repository with agent as code?

Everything that changes behavior, which is more than the prompt: the model and its effort setting, the tool list, the permission scope, the memory backend, and the guardrails. The test of whether the definition is complete is whether two people applying the same files get agents that behave the same way. Where a lockfile pins the resolved versions, that reproducibility survives a redeploy weeks later, which is the part a console cannot offer.

Why does this matter once agents are in production?

Because the common production question is what changed, and only a diff answers it. A reviewed change gives you an author, a reason and a rollback, and it extends prompt versioning to the rest of the definition. It also makes the estate countable, since a repository of agent definitions is a real source for an AI inventory instead of a survey. Pair it with a defined agent lifecycle, a promotion path through agent deployment, and cross-cutting behavior kept in agent middleware rather than copied into every definition.

Frequently asked questions

Why not just configure agents in the vendor console?

A console has no diff, no reviewer and no rollback. When an agent misbehaves, the question is what changed, and a console can rarely answer it. Files make a behavior change a reviewable pull request with an author and a date attached.

Is this the same as prompt versioning?

Prompt versioning covers one part of the definition. Agent as code covers the whole unit: prompt, model, effort setting, tool list, permissions and memory backend, because changing any one of them changes behavior and all of them need the same review path.

Summarize this page with

Train your team to build this