Back to all posts

Developer & technical insights November 5, 2026 8 min read

A Look Inside the Agent Harness (Where the LLM Is Not in Charge)

by Melek Messoussi AI Product Specialist at Myna

Eight stages, one safe reply, over soft violet clouds

Most of what makes an AI agent safe to put in front of customers happens where nobody looks: in the few seconds between a customer’s message arriving and the reply going out.

At Myna, those seconds always follow the same path. A message is checked before any AI model sees it. The agent does its work with tools that report back exactly what happened. One composer writes the reply, and the reply is checked again before it is sent.

This post opens up that path stage by stage, from the moment a message arrives to the moment the reply lands, and ends with the eight rules the runtime keeps on every turn.

What runs behind every Myna agent?

Every Myna agent runs inside the Myna Runtime, the harness that sits between your customers and the AI model.

A Myna runtime has two main components that work together:

  • The AI model: the part that understands language. It reads what your customer writes, works out what they need, decides which actions to take and writes the reply.
  • The control layer: the software built around the model. It checks every message before the model sees it, gives the model only the information it needs, runs the tools that carry out actions, and checks every reply before it reaches your customer.

This runtime is built into every agent and works the same way on every channel, whether a message arrives by SMS, WhatsApp, email or webchat. There is nothing to install or set up.

The Myna Runtime: a customer message passes checks before the AI model, the model understands and plans, allowed actions run, and checks after come before the reply reaches the customer

The AI model never works on its own. The control layer decides when it runs, what it sees and what happens to its answers, and enforces your rules exactly, every time.

Tip: No prompt writing needed to create a Myna agent! A prompt is the block of written instructions an AI model reads before it answers. In Myna you never write one yourself. You describe the job in plain words, choose a persona and switch on tools in Workflow Studio, and the runtime turns those choices into the right instructions for each step.

Why not just write one big prompt?

Many AI agents out there are built on a single long prompt that holds everything at once: the personality, the business rules, the tool instructions, the prices and the formatting. But with this strategy as a business adds rules and edge cases, the prompt keeps growing, and problems start to show.

  • Rules collide: Instructions like “keep replies short” and “explain every service in detail” can sit side by side, and the model decides which one wins.
  • Critical rules get buried: A rule such as never confirming a booking before it happens sits in the same text as a rule about emoji, and to the model, both are just lines of text with the same weight.
  • Stronger wording doesn’t fix anything: Writing a rule in capital letters doesn’t guarantee the model follows it. It is still one instruction weighed against hundreds of others.
  • Mistakes are hard to trace: When everything lives in one document, it’s hard to tell whether a problem came from the instructions, the knowledge or a conflicting rule. The usual fix is one more sentence.

Myna splits that work apart. Your agent’s setup is kept in separate modules for instructions, persona, tool rules and knowledge. The rules that must always hold are written into the software itself, outside the prompt.

Instead ofMyna does this
One long prompt that holds everythingKeeps instructions, persona, tool rules and knowledge as separate modules, each used only where it is needed
Hoping the AI remembers a ruleEnforces the rule in code, so it applies every single time
Letting the AI act and write in one goDoes the work first, then writes the reply from what actually happened

The principle behind the runtime: use a model for judgment and language, and software for anything that requires certainty.

Follow one message through the runtime

Every message your agent receives goes through the same eight stages, in the same order. Here is the whole journey at a glance, followed by a closer look at each stage.

The eight stages of a Myna agent turn: inbound, pre-gates, context, planner, tools, composer, post-gates and send

1. Inbound: a message arrives

A customer sends a message on any connected channel. The runtime records who sent it, what they wrote and which channel it came through, so every stage after this one starts from the same facts.

Messages from any connected channel arrive at a single inbound point

2. Pre-gates: checking the message before any model runs

Before any AI model runs, the runtime checks the message against a set of rules written in code. If a check fails, the message is blocked or deferred, and no model is involved at all.

The pre-gates check duplicates, opt-outs, takeovers and hours, then either stop the message, hold it, or pass it on to context

These checks cover common situations that can be handled automatically:

CheckWhat it catches
DuplicatesThe same message arriving more than once
Opt-outsContacts who have asked not to be messaged
TakeoverConversations a teammate has taken over
Channel complianceRules that apply to the channel the message came from
Message capsLimits on how many messages can be sent
Business hoursTimes when your agent isn’t allowed to reply

Because these checks are code, they behave the same way every time. An opt-out is enforced by the software itself, so it never depends on the model remembering a rule.

3. Context: assembled in modules

Your data is never merged into one giant block. Myna keeps them as separate modules, and each stage reads only the modules it needs. The composer, for example, uses your persona to write in the right voice and the channel policy to get the length right.

The eight context modules: objective, persona, tool policy, channel policy, knowledge, corrections, summary and live state

ModuleWhat it holds
ObjectiveWhat the agent is trying to achieve, from your instructions
PersonaThe voice and personality the agent writes in
Tool policyThe rules for when and how each tool may be used
Channel policyHow replies should look on each channel, such as length and layout
KnowledgeRelevant information retrieved from Memory Hub
CorrectionsFeedback you have reviewed and approved in the Playground
SummaryA summary of the conversation so far
Live stateThe contact’s current fields, answers, appointments and tickets

4. Planner: reasons, then calls its tools

The planner is the part of the agent that thinks. It reads the context, works out what the customer needs and calls tools by name. After each tool returns, it reads the result and decides what to do next. It repeats this for a few steps at most, and it never writes a single word the customer sees.

The planner reasons and chooses from its tools: search, update, offer, book, ticket and handoff, each picked, available or not yet open

At any moment, each tool is in one of three states. In the diagram, the thick border is the tool being picked, solid borders are available tools, and dashed grey borders are tools that aren’t open yet.

StateWhat it means
PickedThe planner has chosen this tool for the current step
AvailableThe tool is enabled and can be used right now
Not yetThe tool isn’t open at this point in the conversation. For example, the Schedule Appointments engine keeps booking locked until every required question is answered

5. Tool evidence: tools return evidence

When the planner calls a tool, the tool fills in its own inputs from the conversation and the contact record, runs, and returns structured output. That output is evidence of what actually happened, not a message for the customer. It goes back to the planner for its next decision, and on to the composer.

A tool takes its input arguments, makes one write per step, and returns output that goes back to the planner and on to the composer as evidence

Here is the same booking as data:

RuntimeInput · what the tool filled in
{
  "time": "tue 10:00",
  "calendar": "cleaning",
  "contact": "from record"
}
Evidence · what the tool returned
{
  "ok": true,
  "outcome": "booked",
  "summary": "Tue 10:00"
}

Tools that change data, such as booking an appointment or updating a contact, are treated as critical. Only one of them can run per step, and if a call has already succeeded, running it again returns the first result instead of booking twice.

6. Composer: writes the reply

Once the planner is done, a single composer writes the reply, using confirmed evidence only. Its voice comes from your persona, set with the persona sliders or learned by the Emulator from real messages. Its length and layout come from the channel policy, so the same answer can be a short text on SMS and a fuller message by email.

The composer combines tool evidence, the persona and the channel policy into one reply

7. Post-gates: before anything gets sent

Before anything is sent, a second set of checks written in code compares every claim in the reply with the tool evidence. They catch replies that claim something no tool proved, and replies that would reveal the agent’s internal instructions. A reply that fails gets one repair pass. If it still fails, the runtime sends a safe line instead.

The post-gates check every claim against the evidence: a passing reply is sent, a failing one is repaired once, and if it fails again a safe line is sent

The reply saysThe evidence showsWhat happens
You’re booked for Tuesday at 10:00.outcome: bookedThe reply is sent
You’re booked for Tuesday at 10:00.The booking failedThe reply is repaired, or replaced with a safe line
Text that repeats the agent’s internal instructionsNot applicableCaught as prompt leakage before it reaches the customer

8. Send: sends the message, then lands

Only the runtime sends messages, and only after the post-gates approve. In a workflow with more than one agent node, the contact then lands on the right next step. Routing uses deterministic conditions, and the workflow graph is verified so it can always run.

After the reply is sent, an intake agent node routes the contact to a booking or support agent node

Every turn is fully traced. When you test an agent, the logs show the plan, the tool calls and the checks behind each reply.

What the runtime promises

These eight rules hold on every turn, on every channel, for every agent.

  • Tools never send: Only the runtime sends messages, and only after the post-gates approve. A tool built to send messages can’t even be registered.
  • Tools can be removed: Each layer can only narrow the tools on offer. A tool that isn’t enabled for the current turn is refused, even one that only reads data.
  • One change per step: At most one tool that changes data runs per step, and a call that already succeeded returns its result instead of running twice.
  • No false confirmations: A failed booking, move or handoff can never be reported as done. A reply can only claim what a tool proved.
  • A bounded loop: Planning runs for a small, capped number of steps. Any tool failure ends it, and the customer still gets an honest reply.
  • Takeover means silence: When someone on your team takes over, the agent stops before any model runs. Incoming messages still reach your team.
  • A fixed order of priority: Safety comes first, then truth and your instructions, then the channel, then the persona’s voice.
  • Facts come from records: Contact fields, answers, appointments and tickets are read from structured records every turn, not remembered from the transcript.

What wins when rules conflict?

Every rule in the runtime has a rank, and a higher rank always wins.

The order of priority: safety, then truth and instructions, then the channel, then the persona's voice

If staying in your persona’s playful voice would mean bending a fact, the fact wins. If a channel needs a shorter reply than your persona likes to write, the channel wins. Corrections you approve in the Playground can change how your agent words things, but never the facts it states.

What does this look like in practice?

Here is how a Myna agent handles the situations that most often go wrong with AI agents.

When this happensWhat the runtime does
A customer opts outThe opt-out check stops the agent before any model runs
A teammate takes over a conversationThe agent goes silent, and new messages go straight to your team
The same message arrives twiceThe duplicate check stops the second copy
A message comes in outside your reply hoursThe business hours check keeps the agent from replying
A booking failsThe agent can’t say the customer is booked, and still sends an honest reply
The same booking is requested twiceThe second call returns the first result instead of creating a duplicate
The planner reaches for a tool you didn’t enableThe runtime refuses the call

The takeaway

Every Myna reply takes the same path: checks in code before the model, a planner that decides but never speaks, tools that report what really happened, one composer, and checks in code again before anything is sent. The AI handles judgment and language. Everything that has to be exactly right is handled by software.

If you’re new to Myna, start with Getting to Know Myna, and see what AI agents can do for the tools behind every turn.

Read the runtime reference →

Frequently asked questions

What is the Myna Runtime?

The Myna Runtime is the harness every Myna agent runs inside. It sits between your customers and the AI model, checks every message before the model sees it, runs the tools that carry out actions, and checks every reply before it reaches your customer.

What are pre-gates and post-gates?

Pre-gates are checks written in code that run before any AI model, catching duplicates, opt-outs, takeovers, channel compliance, message caps and business hours. Post-gates run after the reply is written and compare every claim in it with the tool evidence. A reply that fails gets one repair pass, and if it still fails, the runtime sends a safe line instead.

Does the AI that picks the tools also write the reply?

No. The planner reasons and calls tools by name, but it never writes a word the customer sees. A single composer writes the reply afterwards, using confirmed evidence only, with its voice from your persona and its length and layout from the channel policy.

Do I need to write prompts to build a Myna agent?

No. You describe the job in plain words, choose a persona and switch on tools in Workflow Studio, and the runtime turns those choices into the right instructions for each step.

Sign up free