I spent a good part of my week evaluating prompts. Test specs, deterministic checks, judge criteria, iterations against all of it. Those prompts build software: they turn a story into a plan, a plan into an implementation, a rough skill into one I trust.

The application I work on has prompts too, just in a different place. It has agents working inside it, and for a long time each one’s prompt lived as a string in C# source.

The same evaluation approach I use on prompts that build software applies to prompts inside the software. The first step was getting the prompt out of the code.

A prompt in a string

When the prompt is a string literal, every change to it is a code change. You edit the source, rebuild, run the app, and watch what the agent does. The prompt has no file of its own, no history of its own, and no tests of its own.

The harder problem comes afterward. What else did I try? Which version was better, and better against what? When the only record is a diff in a commit log, the answer is usually “I think this one reads better.” That is not a measurement.

None of these agents had an evaluation behind it. No record of what had been tried, and no way to tell whether a change made the agent better or worse.

Phase one

Phase one was the smallest useful version of fixing that.

  1. Extracted the prompt out of the C# code into its own markdown file.
  2. Wrote evaluations for the agent using the same approach I use for my software-development prompts: a test spec, deterministic checks, and LLM-as-judge criteria.
  3. Iterated the prompt against those evaluations.
  4. Found real issues in the prompt and fixed them.
  5. Produced an audit trail showing how the iterations went.

Step one is trivial to describe and it changed everything downstream. A prompt in its own markdown file can be diffed, versioned, and handed to an evaluation harness. A prompt in a C# string can be none of those without effort.

Step two is where the transfer happened. I reused the evaluation system I already had instead of designing a new one for in-app prompts: the same spec format, the same split between structural checks and judgment, the same discipline of changing one thing and re-running. Nothing had to be rebuilt for a different context.

The constraint I worked inside

A valid question is why these agents are not running on Azure Foundry, where there is tooling for exactly this.

Because I do not have usable Foundry access right now. Getting it means dealing with things I cannot set up at the moment.

So I worked with what I had. The prompts are evaluated and refined in my own harness, driven from C# at runtime. If we move to Foundry later, the refined prompts port over with their evaluation history attached. That is a better starting position than arriving with a pile of hand-tuned strings and no evidence behind any of them.

I would rather have the evaluation discipline now and the platform later than wait for the platform to start.

What the work produced

The useful output of phase one was the record: here is the version I started with, here is the criterion it failed, here is the change, here is the re-run. That record lets someone else look at the agent and trust its prompt instead of taking my word for it.

It also changes the conversation about these agents. “This one feels off” becomes “this one fails a specific criterion on every run,” which is a much shorter path to a fix.

A prompt is an artifact wherever it lives, and it deserves the same treatment: its own file, its own tests, its own history. Extracting one out of a C# string is the smallest possible version of that, and it is where I would start again.

evaluate-the-prompts-inside-the-app.png

Leave a Reply

Trending