Writing fiction made my AI agents better
I run a fleet of AI coding agents for a living, and I write science-fantasy novels. People treat those as two separate facts about me. They’re not. The second one is a load-bearing part of the first.
Here’s the observation that connects them: an AI agent that works is an AI agent that stays in character. Not in the theatrical sense, in the engineering sense. It keeps its role, its boundaries, its voice, and its priorities stable across thousands of interactions, most of which nobody scripted. And keeping an entity coherent through unscripted situations is not some new problem the AI industry invented. It’s the oldest problem in fiction!
Personality is an anchor, not a paint job
When folks build their first agent persona, they usually write adjectives: “You are a helpful, professional assistant with a friendly tone.” That’s not a character. That’s a mood board. It drifts the moment the context gets long or weird, because there’s nothing underneath holding shape.
A novelist builds characters differently. A character is a small set of anchors: what it wants, what it will never do, how it speaks when stressed, what it knows and doesn’t. Everything else derives from those. Put the character in a scene the author never planned and it still behaves recognizably, because the anchors constrain the space of things it would ever do.
Agent personas work exactly the same way. The ones I build hold up because they’re anchored: a job to be done, hard boundaries (enforced in the transport layer, not just asserted, though the persona states them too because identity and enforcement should agree), a voice, and an explicit relationship to the humans around it. When an agent hits a situation nothing prepared it for, and at fleet scale that’s a Tuesday, the anchors are what keep its behavior in the space I intended.
Worldbuilding is systems design
The other half of the craft is the world. Science-fantasy taught me a rule that sounds aesthetic but is actually mechanical: the world’s rules must not bend for the author’s convenience. The moment magic can do anything, the story stops meaning anything. Readers feel the cheat instantly, even when they can’t name it.
Software systems obey the same law, and agent fleets especially. The “world” my agents live in is a set of rules: what the queue gives you, what your credentials open, what the git remote will accept, what a human must sign. If those rules bend under pressure (a special case here, a bypassed gate there), the system stops meaning anything. Worse, the agents learn the world from its behavior rather than its documentation, so they start exploiting the inconsistency. Internal consistency isn’t a literary nicety. It’s what makes behavior predictable, in fiction and in production.
Roleplay is the test suite
Between the novels and the fleet there were years of roleplay, the long-form collaborative kind, where you hold a character for months while other people throw uncontrolled situations at it. I didn’t know it at the time, but that was training for exactly this job (life’s funny that way).
Roleplay teaches you the difference between a character description and a character model. A description answers “what is this character like?” A model answers “what does this character do when a stranger insults it, when it’s offered a shortcut, when its goal conflicts with its rules?” You only find out whether the model holds by playing it against situations you didn’t choose. Which is precisely how I evaluate agent personas now: write the persona, then adversarially roleplay against it. Probe it with the weird, the hostile, the tempting. Where it breaks character, it needs another anchor, not another adjective.
The rounded version
The tech industry likes its founders single-threaded. But every distinct thing I’ve shipped came from threads crossing. Factory floors taught me what software has to survive. Radar rooms taught me what discipline costs. And fiction taught me how identity holds together, which turned out to be the exact skill the agent era rewards. Go figure.
If you’re building agents and they feel generic, drift under pressure, or collapse into obsequious mush, my honest advice is not another prompt guide. Go write a character. Give it three anchors and put it somewhere you didn’t plan. What you learn about keeping it coherent is what your agents are missing.
The novels are over here, if you’re curious what the training data looked like.
I'm Joseph Dattilo — engineer-founder in Lansing, Michigan, author of the FleetHarbor suite, and founder of Date Palm Media. More about me · More writing · Get in touch