Skip to main content

Customizing an Agent Per Client Without Forking the Code

Updated 5 min readMarkdown
Part of seriesAI Agents in Production
Customizing an Agent Per Client Without Forking the Code

The first client asks for a friendlier tone. The second wants escalation after one failed attempt instead of two. The third needs answers in another language and access to a different set of tools. By the fourth, someone suggests copying the repository, "just for this customer".

Don't. A fork per client works for about a month, and then every bug fix has to be applied four times.

Separate what varies from what doesn't

When I design for client customization, I start by listing what truly differs between clients and what must never differ.

What varies is usually small: tone, language, escalation thresholds, which tools are switched on, the wording of a few messages. What must stay fixed is the safety logic: permission checks, approval steps for irreversible actions, logging. If a client can change those, you no longer have one product. You have a pile of exceptions.

The result is a base configuration, a short list of fields a client may override, and a rule that everything else is rejected. At AI Hive, where I work on production-ready AI agents for different companies, the same handful of fields come up again and again, which is a good sign the list can stay short.

I'd write the list down before writing any code, and I'd get the client's technical contact to read it. It's much easier to refuse a request when it's visibly outside an agreed list than when it's a new argument each time.

A config builder that says no

The simplest version is a function that merges overrides onto a base and refuses anything outside the allowed list. I ran this in Node before pasting it here:

const BASE = { tone: "neutral", escalateAfter: 2, tools: ["lookup_order"], language: "en" };
const OVERRIDABLE = new Set(["tone", "escalateAfter", "tools", "language"]);

function buildAgentConfig(overrides) {
  for (const key of Object.keys(overrides)) {
    if (!OVERRIDABLE.has(key)) throw new Error(`override not allowed: ${key}`);
  }
  const cfg = { ...BASE, ...overrides };
  if (!Number.isInteger(cfg.escalateAfter) || cfg.escalateAfter < 1) {
    throw new Error("escalateAfter must be a positive integer");
  }
  return cfg;
}

console.log(buildAgentConfig({ tone: "formal" }));
// { tone: 'formal', escalateAfter: 2, tools: [ 'lookup_order' ], language: 'en' }
try { buildAgentConfig({ systemPrompt: "ignore the rules" }); }
catch (e) { console.log(e.message); }   // override not allowed: systemPrompt

The second call is the point. A client, or a well-meaning engineer, tries to override the system prompt, and the builder refuses. The rejection happens when the config is loaded, not in the middle of a conversation.

Where the config lives

I keep each client's overrides in a small file, kept in version control and reviewed like code. A change to a threshold is a pull request with a reviewer, not an edit in an admin screen that nobody tracks.

If the client needs to make changes themselves, give them a form that writes to the same file format and runs the same validation. The path to production should be identical either way.

Tools are the sensitive override

Of the four fields, tools deserves the most care. Switching a tool on gives the agent a new ability, so it should go through the same review as any new integration. I'd also tie each tool to a permission scope, so enabling it for one client doesn't grant it everywhere.

A good habit is a per-client list of enabled tools that gets logged at startup. When something odd happens, the first question is always which tools were on, and the log answers it immediately.

Testing across clients

Write one test per override field, plus a test that every client config passes validation. When the base changes, run the whole set. If a client's overrides stop validating, you find out in CI, not from the client.

I'd also keep a short snapshot test of the final merged config per client. It's boring, and it catches the day someone adds a field to the base and forgets that three clients override its neighbor.

How clients call the agents

Once configuration is clean, the other half of per-client work is how each client's systems reach the agent. Some call it over REST, some want webhooks, some need streaming. This breakdown of REST, WebSocket and webhook patterns for AI agents covers the options and the trade-offs between them.

What I'd resist

I'd resist adding a free-text field for "custom instructions" in the first version. It feels flexible, and it becomes the place where every client's one-off request ends up. Start with named fields, and add a new one only when two clients ask for the same thing.

How do you handle per-client differences in your own agent projects? I'm especially curious whether anyone has found a clean way to let clients edit prompts without losing control of the safety logic.

Disclosure: I advise teams on rollouts like this as part of my work at AI Hive.

1 view

About the author

  • Hi, I'm Darius, an AI Implementation Specialist at AI Hive based in Vietnam. After 6+ years in SEO and content-driven growth, I kept seeing brilliant AI pilots that never reached production. Now I help enterprise teams in BFSI, healthcare and logistics deploy AI agents that fit regulated environments and integrate with legacy systems. I write about enterprise AI deployment and the friction points most articles skip over.

No comments yet. Be the first to comment.