Scaffolding in silhouette against a teal sky

The agent stack, layer by layer

What each piece of a modern AI agent system does, how parallel agents split and merge work, how the system learns from its runs, and where System One models like Jev fit.

The agent stack

Top to bottom follows the guide, one section at a time. Each layer has a code the sections use. The dashed band around the whole stack is security and : it applies to every layer, not just one.

Security and governance: the wrapper around the whole stack

Every layer in this guide raises the same questions: who is allowed to act, what it is allowed to touch, and who signs off. Governance is not one more layer in the pile. It is the wrapper around all of them, which is why the agent stack above draws it as a band around every layer.

Getting a first agent working is easy. Keeping it safe enough to leave running is where the expertise goes, and it is often the difference between a that sticks and one that gets switched off after one bad week. None of this has to be finished before you start: begin with one painful task and build the wrapper around it as you go.

The is the car's brakes and seatbelts. Governance is the driver's license, the insurance and the rules of the road.

Who and what can act

Every person and every agent signs in as itself. Staff use single sign-on (SSO, one company login), so access ends the day someone leaves. Each agent gets its own credentials, never a shared login or someone's personal account, and only the permissions its task needs, known as : an agent that reads invoices should not be able to pay them.

Applies to agents, the harness and tools.

What data can go in

Sort data into a few plain tiers, such as public, internal, confidential and personal. Write down what never goes into AI tools: customer personal details (often called PII), passwords and bank details, confidential client files. Decide how long , files and outputs are kept, and know where the data lives: which vendor, which region, and whether it is used to train anyone's model.

Applies to the data layer and contracts.

Human approval gates

Some actions always pause for a named person: moving money, signing or changing contracts, anything that touches safety, and anything a customer will see until it has earned trust. Put the gate in the harness's permissions, not in the instructions. An instruction can be ignored; a permission cannot.

Applies to the human, the harness and System One models.

Seeing what happened

Audit logs record who or what took each action, when, and on whose authority. Traces let you replay a run step by step. Monitoring flags unusual behavior, like an agent suddenly calling a tool far more than usual or reading records it never reads. Cost limits per agent and per run stop the loop, not just report on it afterward.

Applies to evals and observability and the harness.

Testing before changes ship

Every change to a prompt, model version, tool, threshold or contract runs the eval suite before it goes live, and the previous version stays ready to roll back to. This is the learning loop's safety catch: a system that improves itself needs a test it must pass first.

Applies to learning loops and evals and observability.

Outside inputs can't be trusted

Web pages, emails, PDFs and tool results can carry hidden instructions meant to hijack an agent (prompt injection). Treat everything a tool returns as data, never as orders. Contracts check its shape; tight permissions limit the damage if something slips through. Connect only tools and servers you have vetted, from their real publisher.

Applies to tools and contracts.

Vendor and model risk

Read the terms: whether the vendor trains on your data, how long it keeps it, and where it is processed. Ask for security attestations such as SOC 2. Models change under you, so pin versions and re-run before moving to a new one. Limit lock-in by keeping your prompts, contracts, evals and data in your own systems, and by preferring open standards like MCP and A2A so a model or vendor can be swapped.

Applies to System One models, agents and the harness.

Ownership

Every agent has a named owner: the person who answers for what it does, reviews its logs, and decides when it changes or retires. Back that with short written guidance covering three things: the approved tools, what never goes in, and who approves new tools.

Applies to the human and every layer.

In practice these controls live in different places: logins with your identity provider, permissions in the harness, logs in . An orchestration and governance layer, such as SigmaEra, can bring them into one view.

Ninja Concepts builds this wrapper in from the first agent, because the governance layer is a big part of what makes an AI rollout stick.

Agents

An agent is a language model placed in a loop: it reads the situation, decides on an action, takes it through a tool, looks at the result, and repeats until the goal is met or it runs out of budget. A answers once. An agent keeps going.

A chatbot is a consultant you email. An agent is a contractor you give the keys to.

Decide next stepAct with a toolObserve resultRead contextGoal+ budgetrepeats until the goal is met or the budget runs out
The loop that turns a model into an agent. The goal and budget sit in the middle and decide when it stops.

Goal

What "done" looks like. Vague goals are the most common cause of agents wandering.

Instructions

The system prompt, which sets role, rules and style.

Tools

What additional resources the agent has at its disposal to complete the goal.

Budget

Steps, , time or money before it must stop or ask.

Check: what makes an agent different from a chatbot?

Tools

A tool is a function the model can ask the harness to run: search the web, query a database, send an email, write a file. The model never runs code itself. It emits a structured request with the tool's name and arguments, the harness executes it, and the result comes back as text the model reads.

ModelHarnessTool / worldtool call: search("OKC cap rates")permission checkruns itraw resultsresult as text, into context
The model only writes the request. The harness checks it, runs it, and hands the result back.

What a tool needs

A name, a plain-language description (this is how the model decides when to use it), and an input listing each argument and its type.

MCP

The Model Context Protocol is the common plug for tools. A service exposes its tools once as an MCP server, and most major AI tools can connect to it, subject to sign-in and admin controls. HubSpot, Salesforce and GitHub all publish official MCP servers. An MCP is really a connection that allows different tools to communicate between themselves without the rigid structure of an .

Read vs. write

Read is simply reviewing existing content with no direct action, while writing is the ability to create, edit and delete data. Reading is cheap to get wrong. Writing, sending, paying and deleting are not, so those tools usually require approval.

Skills

A packaged set of instructions (and sometimes scripts) that teaches an agent how to do one kind of job well. A tool is a verb; a skill is a playbook.

Check: when an agent "searches the web," who actually runs the search?

The harness

The harness is all the software wrapped around the model that turns it into an agent. Two products can use the same model and behave completely differently because their harnesses differ. Claude Code, Codex and OpenClaw are all harnesses.

The model is the engine. The harness is the rest of the car: steering, brakes, dashboard and seatbelts.

SANDBOX · an isolated machinePERMISSIONS + HOOKSCONTEXT MANAGER · what the model seesModelthe enginecall model →run tools →feed resultsback, repeatsearchemailfiles
Everything outside the teal box is the harness. Swap the rings and the same model behaves like a different product.

The loop

Call the model, run requested tools, feed results back, repeat.

Context management

Deciding what goes into the model's limited each turn, and summarizing or dropping the rest. Doing this well is called context engineering.

Permissions

Which tools run automatically, which ask a human first, which are blocked.

Sandbox

An isolated machine or container so mistakes stay contained.

Hooks

Code that runs before or after a tool call to check, log or block it.

Recovery

Retries, timeouts and checkpoints so a long job survives errors.

Check: two products run the exact same model, but one is far more reliable. The most likely reason?

The data layer

Once several agents and people work on the same job, they need one place where the facts live. Without it, each agent keeps a private copy in its context window, those copies drift, and nobody can tell which is true. The data layer is the shared system of record that agents read from and write to, under rules.

Data layerstate · memory · provenanceHumanreads · corrects · winsAgent AAgent BAgent Cr/wr/wCONFLICT · lease end dateJun 30 vs Jul 31 → reconcile
One shared record instead of three private copies. Conflicting writes get flagged, and the human has the final word.

Shared state

The current status of the work: tasks, owners, decisions, open questions. Sometimes called a blackboard, where every agent posts and reads.

Memory

Durable facts that outlast one session: who the customer is, what was decided last week, house preferences.

Provenance

Every fact records who wrote it, when, and from what source, so a human can audit it and an agent can weigh it.

Versioning and conflicts

When two agents write different values, the layer flags the conflict and a rule or a human reconciles it. Nothing is silently overwritten.

Access control

Which agent, tenant or person may see or change which records. Agents get the least access the task needs.

Retrieval

Search over documents and facts (often called ) so an agent pulls only what it needs into context.

The human sits on top of this layer, not beside it. People should read the same state the agents see, correct it, and have those corrections win.

Check: two agents record different lease end dates for the same property. What should the data layer do?

Contracts

A contract is an explicit agreement about what crosses a boundary. Natural language is fine for people but fragile between machines, so contracts turn hand-offs into something that can be checked.

Billing agent{order_id, …}{amount only}order_idamountreasonCONTRACTRefund toolrejected: missing order_id
The contract is a gate checked by code. A result missing a required field never reaches the refund tool.

The full chain

In a real system there is a contract at every boundary, not just between the agent and its tools. The user speaks plain language; from there on, every hand-off is checked. Click a contract to see what it carries.

Userplain language
Modelinterprets, plans
Agentdoes the work
Tooltakes the action
Sourced datasystem of record
← the answer travels back through C3, C2, C1, checked at each gate, with its sources attached

Read it as a chain of custody. The model is the first translator: it turns the user's words into a task contract. The agent can only reach the world through tool contracts, and tools can only reach data through data contracts. Because every record carries its source on the way back, the user's final answer can show where each fact came from.

Check: the agent's answer cites a vacancy rate, but no one can tell which system it came from. Which contract failed?

Between agents

Input and output schemas (usually Schema) so bad output is rejected before anyone acts on it. Done criteria so the receiver knows when it has finished and must report failures, not hide them. Protocols: MCP for agent-to-tool, A2A for agent-to-agent hand-off. Both are open standards under the Linux Foundation's Agentic AI Foundation.

For agents

Permissions: allowed tools, data and spend. Policies: rules that hold no matter what it reads mid-task. Escalation: when it must stop and ask. Budget: limits on steps, tokens, time or cost.

Treat a contract like an API version. Change it deliberately, and pin which version each agent was built against. Contracts matter most in parallel work: if every branch returns the same shape, merging is easy.

Check: the billing agent returns a result with no order ID. With an output contract in place, what happens?

Orchestration and graphs

Graph engineering is planning a job as a set of related but different tasks that parallel agents run at the same time, then putting the results back together. One agent working through ten subtasks in order is slow. Ten agents each taking one, with a lead that splits the work and a merge step that assembles it, finishes in a fraction of the time. The gain is throughput.

Leadplan + splitMarket compsA1Financial modelA2Zoning and permitsA3Tenant mixA4EnvironmentalA5needs compsLeadmerge + reconcileFAN-OUTFAN-INone answer
The same job as the lab below. Five agents work at once; the orange arrow is a dependency that forces two branches into a chain.

One agent is a single contractor building a house room by room. A graph is a general contractor running the framers, electricians and plumbers at once, then doing the final walk-through.

1. Plan and split (fan-out)

The lead agent breaks the job into branches that can run independently, writes each one a brief, and gives them all the same output contract.

2. Run in parallel

Each worker agent has its own clean context focused on one branch, so it goes deeper and does not get distracted by the others' material.

3. Merge (fan-in)

The lead collects the branch results, reconciles overlaps and contradictions, and synthesizes one answer. This step is serial and grows with the number of branches.

4. Dependencies

Some branches need another's output first. That chain, the critical path, sets the floor on how fast the whole job can finish.

Lab: Prairie Ridge's due diligence on a commercial property

Times in minutes

Prairie Ridge Property Co., an illustrative 60-person real estate firm that manages and buys commercial property, is weighing an acquisition. The lead plans for 3 minutes, five research branches run, then the lead merges. Merging costs 2 minutes plus 0.75 per branch it has to reconcile. Change the number of agents and watch the timeline.

0Finish time
1.0×Speedup
0Agent-minutes paid
0%Worker utilization

Design rules

Split by independence

Good branches share a goal but not each other's work. Split by region, document, competitor or question, not by step in a sequence.

One output contract for every branch

Same fields, same format, so the merge is assembly instead of translation.

Shared brief, separate context

Every worker gets the same goal and rules, but only its own materials.

Write findings to the data layer

Branches post results with provenance, so the merge can see where each claim came from and spot conflicts.

Mind the serial parts

Planning and merging do not parallelize. If they are 20% of the job, no number of agents gets you past 5× faster. This limit is known as Amdahl's law.

Time drops, cost doesn't

Parallel agents finish sooner but the total agent-minutes stay the same or rise. You are buying speed.

Bound every loop

A branch that retries needs an exit, such as passing a check, a retry limit, or escalating.

You will also see "graph" used for the wiring of checks and retries in a , and for knowledge graphs of linked facts in the data layer. Those are related ideas; this primer uses the parallel split-and-merge meaning.

Check: you split a job into five parallel branches, but it only got about 2× faster. The most likely cause?

System One models and Jev

The name borrows from psychologist Daniel Kahneman: System 1 is fast, intuitive judgment, System 2 is slow, deliberate reasoning. Large language models, especially reasoning models, behave like System 2. They write their answer word by word, which is slow and costly when all you needed was a yes or no.

A System One model does not write text at all. You hand it some state (text or JSON) plus typed questions, and it returns an answer to each with a probability. TypeSafe AI coined the category and launched Jev, the first public System One model, on September 15, 2026, backed by a $40M seed round led by DCVC. On October 9 it raised an $870M Series A at a $7.5B valuation, led by a16z. The current version, jev-1.14.0 (October 14), is still in early access.

GENERATIVE LLM · one pass per token~secondsThispass 1ispass 2apass 3plumbingpass 4leakpass 5.pass 6SYSTEM ONE (JEV) · one pass, every option scored~0.1–0.5 stenant message +which trade?plumbing0.94HVAC0.04electric0.02
An LLM has to write its way to an answer. Jev skips the writing and returns the decision with a probability for each option.

Choice

Pick one option from a list you supply, with a probability for each. "Which trade does this tenant request need: plumbing, electrical or HVAC?"

Score

An ordered rating. "How urgent is it: can wait, this week, within 24 hours, or now?"

Noul

TypeSafe's name for its yes/no judgment type. "Is something happening right now that makes this an emergency?"

Box

Added as a preview in jev-1.14: returns a single bounding box marking where something is.

Calibration

If Jev says 0.92, it should be right about 92% of the time. That lets code set a threshold: act automatically above it, send to a big model or a human below it.

Worked example (illustrative)

Picture a 2 a.m. message to Prairie Ridge Property Co., an illustrative 60-person real estate firm that manages and buys commercial property: "water's coming through the ceiling." A System One model reads it in a fraction of a second and answers emergency? yes, 0.97 and trade? plumbing, 0.94. The on-call tech is paged before anyone opens the inbox. A vaguer message, like "the thing under the sink is acting weird again," scores lower and goes to a coordinator in the morning. Thresholds follow the stakes: the emergency question pages someone at just 0.30, because a false alarm costs a phone call and a miss costs a flooded unit. The trade question creates a work order on its own only at 0.90 or above.

Lab: set the confidence gate

60 sample tenant requests

Each square is a tenant maintenance request Jev has routed to a trade. Above the threshold, the system acts on its own; below it, a person reviews. These sample scores are calibrated, so a 0.80 is wrong about one time in five.

Handled automatically, correctHandled automatically, wrongSent to a person
0Automated
0Auto mistakes
0Human reviews
0%Error rate on auto
Generative LLMSystem One model (Jev)
OutputFree text, parsed afterwardTyped answers with probabilities
How it answersOne token at a timeAll options scored in parallel in one pass
SpeedSecondsRoughly 70–500 ms, per TypeSafe
PriceInput and output tokens$0.042 per million input tokens, no output metering (checked Oct 29, 2026)
Good atWriting, reasoning, planning, codeRouting, classifying, gating, scoring, monitoring
CannotGuarantee a clean structured answerWrite anything

In a graph, Jev is the cheap node at the junctions: it decides which branch a request goes to, whether a branch result is good enough to merge, and whether a step needs a human.

Keep in mind. Jev is early access, and its architecture and training method (TypeSafe calls it RLCD, Reinforcement Learning for Calibrated Decisions) are described only in company posts, with no paper or weights. In September tests of jev-1.13, independent testers found it about 1.4–1.6× faster than Claude Haiku 4.5 (WotAI), and a separate 24-document test found its confidence scores tracked agreement well (Lindfors). Speed gains depend on what you compare against. TypeSafe's own headline speed figures are company-reported, and TypeSafe expects they are on the high end (launch post). TypeSafe also lists Jev's known weak spots, such as numbers, counting and dates, on its jaggedness page.
Check: which job is a good fit for Jev?

Evals and observability

Agents fail quietly. They finish, sound confident, and are wrong. Two practices catch that.

  • Tracing: a record of every model call, tool call, input and output in a run, including each parallel branch, so you can replay exactly what happened.
  • Evals: a fixed set of test tasks with known good answers, run every time you change a prompt, model, tool, contract or graph. This is unit testing for agents.
  • Graders: code, a person, or another model that scores outputs. A separate grader that did not produce the work is more trustworthy than self-review.
Check: why have a separate agent grade the work instead of the one that wrote it?

Learning loops

A learning loop is how the system gets better from its own experience instead of staying exactly as good as the day it shipped. Every run produces evidence: , outcomes, human corrections, failures. A learning loop turns that evidence into changes and checks them before they go live.

Evals tell you how good the system is today. Learning loops are how it gets better tomorrow.

RunTrace + outcomeEvaluateChangeevals pass?OUTER LOOPacross runs, changes the systemINNER LOOPcheck, retry
The small loop fixes this run. The big loop improves every run after it, and nothing ships until it passes evals.

Inner loop (within a run)

The agent checks its own work and tries again: run the tests, read the error, fix, re-run. A reviewer node critiques a branch result before it is merged. Nothing permanent changes.

Outer loop (across runs)

Patterns from many runs change the system itself: a better prompt, a new skill, a corrected memory, a tuned threshold, a better split, a model.

What can learn, cheapest to costliest

The bars show cost and difficulty of undoing.

Where the signal comes from

  • Human corrections: every edit, rejection or override a person makes in the data layer is labeled training data. Capture it on purpose.
  • Outcomes: did the work order go to the right trade, did the lead convert, did the code hold up in production.
  • Graders: eval scores from code, people or a separate judge model.
Guard the loop. A system that changes itself can also get worse. Run every change through the eval suite before it ships, keep the previous version to roll back to, and watch for the system optimizing the score instead of the goal (often called reward hacking). Changes to permissions, policies and contracts should always need human sign-off.
Check: a user corrects a fact the agent got wrong. What is the cheapest, most reversible place for that lesson to land?

Risks and considerations

Ten things that go wrong with agent systems, the layer each one hits, and the usual fix. None is a reason to stay out; each is a reason to design for it from the start.

RiskWhat it looks likeLayer it hitsMitigation
Wrong or made-up answersA confident answer that cites a policy, figure or date that does not exist.AG · DL · CTRequire sources through the data contract, and send low-confidence cases to a person.
Prompt injectionA document or email hides text telling the agent to ignore its rules or send data out.TL · CTTreat tool output as data, keep permissions tight, and require approval for anything sent out.
Data leakageConfidential files or customer details end up in a vendor's tool, a log, or the wrong person's answer.DL · HAClassify data, keep a written "never goes in" list, and set access per agent.
Over-permissioned agentsAn agent built to read invoices can also pay them or delete records.HA · TLSeparate credentials per agent, least privilege, and approval on every write action that matters.
Runaway costA loop retries all night, or a makes far more calls than planned.HA · GRSpend caps per run and per agent that stop the work, plus alerts on spikes.
Silent regressionsA prompt tweak or model update quietly breaks something that used to work.LL · OBRun evals before every change ships, pin versions, and keep rollback ready.
Vendor or model changesA provider changes its terms or pricing, or retires a model you depend on.S1 · AG · HAPin versions and keep prompts, evals and data in your own systems so you can switch.
Adoption and changeStaff don't trust the system, work around it, or drift back to personal AI accounts.HUStart with one painful task, teach the concepts, and show the hours saved.
Unclear accountabilityThe agent gets something wrong and nobody knows who owns the fix.HU · every layerA named owner per agent, written guidance, and approvals logged by name.
No plan for when it goes wrongAn agent misbehaves in live use and nobody knows how to stop it, undo it or who to tell.HA · OB · HUA pause switch for every agent, rollback to the last good version, a named person to notify, and a log review before it restarts.

One request, end to end

A tenant's 2 a.m. maintenance message, handled by a stack that uses every layer. Step through it and watch which layer is working.

S1ORGRCTAGTLDLHAHUOBLL
Step 1 of 10
  1. S1 · Reads a 2 a.m. tenant message, "water's coming through the ceiling": emergency 0.97, trade plumbing 0.94, urgency "now."

    System One models

  2. OR · Lead agentEmergency clears the 0.30 paging gate and trade clears 0.90, so it takes the case instead of leaving it for the morning queue.

    Orchestration

  3. GR + CT · Fan-outSplits into three parallel branches (unit and lease record, on-call vendor roster, building history), each with the same output contract.

    Graph engineeringContracts

  4. AG + TL · WorkersEach branch agent looks up its piece with read-only tools, at the same time.

    AgentsTools

  5. DL · Data layerBranches post findings with provenance. The lead merges them into one work order.

    Data layer

  6. HA · HarnessDispatching an after-hours vendor is a write action with a call-out fee, so permissions pause and page the on-call manager.

    Harness

  7. HU · HumanApproves from a phone. The approval is written back to the data layer.

    HumanData layer

  8. S1 · JevChecks the outgoing text to the tenant against policy before it sends.

    System One models

  9. OB · TraceThe whole run, every branch included, is logged and becomes a candidate eval case.

    Evals and observability

  10. LL · Learning loopTwo weeks later a "leak" turns out to be AC condensation. The case joins the eval set, and the emergency question gets a sharper line after the change passes evals.

    Learning loops

Other terms worth knowing

Models and context

Context window
The model's working memory for one call, measured in tokens. Everything the agent knows right now must fit in it.
Context engineering
Choosing what goes into the context window each turn. Parallel branches help because each gets a clean, focused window.
Reasoning model
An LLM that thinks step by step before answering. Better on hard problems, slower and pricier. The System 2 counterpart to Jev.
Model routing
Sending each request to the cheapest model that can handle it well.

Running work in parallel

Fan-out / fan-in
Splitting work across parallel agents, then gathering their results back into one.
Critical path
The longest chain of steps that must happen in order. It sets the fastest possible finish time.
Amdahl's law
The speedup from parallel work is capped by the part that cannot be parallelized.
Checkpoint
A saved point in a long run so work can resume after a failure instead of restarting.

Safety and control

Human in the loop
A required human approval at defined points, usually before irreversible actions.
Guardrails
Checks on inputs and outputs that block unsafe or off-policy content.
Prompt injection
Instructions hidden in a web page, email or file that try to hijack the agent. The harness should treat tool results as data, never as orders.
Structured outputs
Forcing an LLM's answer to match a schema. A partial step toward what System One models do natively.

Knowledge and learning

Knowledge graph
Facts and entities linked by typed relationships, often with time and provenance. GraphRAG retrieves by following those links.
Embedding
A list of numbers representing meaning, used to find similar text for retrieval.
Reflection
An agent critiquing its own output before finalizing. The simplest inner learning loop.
Reward hacking
A system learning to raise its score without actually getting better at the goal.

Put the stack to work in your business

Thirty minutes. Your problem. Our honest read on what we would build.

Book your free call

Keep reading, free

Free. Add your work email to read all 15 sections, with labs you can try as you read.