The most common way to store an agent's prompt is as a string in the repository next to the code. Changing the wording takes a pull request and a deploy. So does switching the model. While one developer edits the agent once a week, this works.

We keep the agent's behaviour separate from its code. The code describes how the agent works. The prompt, the model, the set of tools and the limits live in a config that changes without a deploy and keeps a history of versions. Below we explain why, how it is built and where this approach is weak.

The prompt changes more often than the code

In the first three weeks of work on our analytical agent, the main agent's prompt changed dozens of times, and the models of different agents in the team were switched between providers several times. The code changed during that time too, but at a different pace and for different reasons.

When the prompt lives in the code, these two rhythms get glued together. Every change of wording goes through a build and a rollout. The product team, which knows best how the agent should answer, cannot change the prompt itself. And after a few rollouts it is hard to say which version of the prompt answered in a particular conversation a week ago.

Graph and config

We split an agent into two parts. The graph holds the logic: steps, tools, rules for working with data. The graph also declares the schema of its settings: which fields it has and of what type. The config stores the values of these settings for a particular agent. In simplified form it looks like this:

{
  "modelId": "<a model from the catalog>",
  "systemPrompt": "You help analysts...",
  "availableTools": [
    {"name": "search_catalog", "enabled": true},
    {"name": "web_search", "enabled": false}
  ],
  "limits": {"maxModelCalls": 30}
}

The platform validates each new config against the graph's schema before saving it, so a typo in a field or a value of the wrong type never reaches the live agent. Several agents can run on one graph. In our analytical agent, the orchestrator, the collector and the writer use one graph and differ only in their configs.

Versions

An agent can have many configs, and one of them is active. We change behaviour like this: take the active version, create a new one with the edit and activate it. The previous one stays next to it, and going back to it takes one action. Before activation, the new version can be run through the tests. We wrote about that separately in How to tell a new version of an agent is no worse than the old one.

Knowledge apart from the prompt

A prompt is a good place for the agent's role and general rules. A detailed methodology quickly bloats it, and the model starts getting lost in its own instructions. So our prompts are short and free of special cases, and the details live as articles in a knowledge base. The agent gets a list of articles and opens the one it needs when it needs it. To adjust the methodology, it is enough to edit an article, and that takes neither a developer nor a new config version.

What it costs us

The agent's behaviour is now defined in two places, and when you investigate a mistake you have to look at both the code and the config. Every new setting has to be declared in the graph's schema, otherwise it cannot be set.

The main cost is elsewhere: a change without a deploy goes through without code review. Nobody reads a prompt edit the way they read a pull request, and it reaches users immediately. That is why activating a config without tests is more dangerous than shipping code without tests.

And an honest note: version immutability in our platform rests on an agreement. Technically, an existing config can be edited, and the team keeps the rule "every edit creates a new version" on its own.

The opposite mistake

When configs are convenient, you want to move everything into them. First comes a flag that turns a step on, then a condition, then a list of rules with priorities. At some point the config becomes a programming language without a debugger or tests. We keep a rule: the config stores values and texts, while branching and the order of steps stay in the graph's code.

What's next

In Flutch, configs, versions and tests are available both in the console and through the MCP connector, so you can go through this cycle right from Claude: find the conversations where the agent went wrong, propose a prompt edit, create a new version and run the tests. We still leave activation to a human. But even without a platform it is worth taking the prompt and the model out of the code and logging which version of the settings answered in each conversation.