Skip to content
all longreads
Longread#AI4SDLC

Agent Stack Configurations: A Complete Analysis of Eight Options

Conversations about an agent platform are often reduced to a false choice: your own OpenCode on your own model, or someone else’s Claude Code/Codex with a model behind an API. In reality there are at least three independent axes: who controls the agent harness, where the model runs, and which tools the agent may call. What must stay controlled is the entire path from user intent to a change in a system — not a single logo along that path.

July 20, 2026≈ 39 min

An overview for architects and engineering leaders. Product capabilities and documents were verified on July 16, 2026 — clients, models, and data policies change faster than typical enterprise software. The condensed version of this study is the “Agent Stack Configurations” deck. The visualizations are original diagrams.

01

The “ours or theirs” choice is false

Open client code does not make the model local. A self-hosted model does not make tools safe. An internal MCP server does not restrict permissions by itself. Conversely, an external model API does not necessarily receive production secrets when planning is separated from execution, context is filtered, and authority remains in an internal gateway.

This article extends the formula Agent = Model + Harness and the model/tool gateway ideas from the agent-first approach to internal developer platforms. For a practical choice, the formula needs one more step:

agent stack = harness + model + tools + identity + technically enforced execution boundaries

diagram 01 · complete formula for a governable agent stack
The complete formula for a governable agent stackHARNESSloop + context(,MODELreasoning + inference,TOOLSavailable actions,IDENTITYon whose behalf,BOUNDARIESwhat is forbidden)stack = (harness, model, tools, identity, boundaries)Original framework · governability appears only across the complete chain

The article uses three kinds of statements to keep fact and opinion separate:

  • documentation links describe product properties stated and verified on the review date;
  • architecture conclusions interpret the consequences of those properties;
  • recommendations select for a specific implementation class rather than rank every solution universally.
02

“Ours” has four different meanings

The word “ours” is overloaded. It may refer to:

  1. 1Source-code ownership: the team can inspect and modify the harness.
  2. 2Operational control: the team deploys, upgrades, and observes the component.
  3. 3Data control: the team sets the region, retention period, and permitted transfer destinations.
  4. 4Policy control: permissions, routes, approvals, and denials are enforced by infrastructure rather than only by a system prompt.

These properties do not imply one another. Forking an open client gives control over code, not the external model. Self-hosted inference gives control over weights and compute location, not over a local shell running with a developer’s permissions. A managed service may be proprietary yet provide stronger isolation and audit than a home-grown service without a dedicated operations team.

diagram 02 · four independent meanings of ownership
Four independent meanings of ownershipCODEinspect and change the harness1OPERATIONSdeploy and observe2DATAdefine routing and retention3POLICYtechnically enforce prohibitions4Code, operations, data, and enforced policy are four separate controls
03

Three independent axes of the stack

Axis
Agent harness
Options
in-house implementation or fork; configurable off-the-shelf client; managed vendor client or cloud agent
What is actually being selected
planning loop, context management, tool calls, approvals, sandbox, logging, upgrades
Axis
Model
Options
self-hosted open weights; managed model in a selected cloud or region; external proprietary API; router with cascading and fallback routes
What is actually being selected
quality and behavior, inference location, data path, capacity, cost, update cadence, ability to pin a version
Axis
Tools
Options
local commands; internal API/MCP; external SaaS/MCP
What is actually being selected
available actions, execution location, identity used, and who sees arguments and results

Every axis has its own failure point. A configuration should therefore be recorded as a complete tuple rather than a product name, for example:

ready-made local client
× external model through an enterprise model gateway
× internal tools through a gateway with OBO identity
× local OS sandbox

OBO here and throughout means on-behalf-of — delegated authority: the gateway issues the agent a short-lived token on behalf of the person who initiated the task, so internal systems see who is asking and for which task rather than a faceless shared service account.

diagram 03 · three independent axes of the agent stack
Three independent axes of the agent stackAXIS 01HARNESSowned / forkedready-made clientmanaged agentWho owns the agent loop?AXIS 02MODELself-hostedregional cloudexternal API / routerWhere does inference run?AXIS 03TOOLSlocalinternalexternal SaaS / MCPWhere does the system change?Each axis changes its own data path, TCO, lock-in, and failure point

Axis 1. Agent harness

In-house development or a fork provides maximum freedom in the planning loop, context format, tool policy, and internal-platform integration. The price is permanent engineering work: model compatibility, context compaction, error recovery, approval UX, sandboxing across operating systems, tracing, and dependency updates. A fork also creates a separate supply-chain branch; upstream vulnerabilities are no longer fixed automatically.

A configurable off-the-shelf client lets a team change model endpoints, MCP servers, commands, and rules without building the complete agent loop. It is a practical way to test a hypothesis quickly. A configuration file is not technical control, however: verify where commands actually run, whether egress can be denied, who stores tokens, and what happens when the sandbox is unavailable.

A managed vendor client or cloud agent receives new models and features faster, while the provider assumes part of the isolation and operations burden. In exchange, the organization accepts the provider’s contract for data retention, updates, telemetry, availability, and audit export. Even with a local client, inference and auxiliary checks may remain networked.

Axis 2. Model

“Our model” splits into at least four classes.

  • Open weights in the organization’s own environment. The organization controls inference, versions, and telemetry, but pays for GPUs, spare capacity, serving, upgrades, and quality validation. Open weights guarantee neither a small model nor good tool use.
  • A managed model in a selected cloud or region. Data and compute can remain in an agreed jurisdiction without operating inference directly. Weights, roadmap, and often the control plane still belong to the provider.
  • An external proprietary API. This offers fast access to new capabilities and elastic capacity. The cost is dependency on the API, pricing, limits, data policy, and model behavior.
  • A hybrid router or cascade. It selects a model by task type, cost, and data class. This is not free portability but a separate platform with classification, evals, and safe-fallback rules.

API compatibility means matching request formats, not matching behavior. Two models behind OpenAI-compatible endpoints may interpret system prompts differently, call tools differently, recover differently after errors, and react differently to context compaction. Real portability is proven against the organization’s own task and failure suite.

Axis 3. Tools

Every tool needs two coordinates at once: its origin and its actual execution location.

Origin
Local
Possible execution location
laptop, devcontainer, remote sandbox
Example risk
the command inherits the user’s permissions, SSH agent, files, and network routes
Origin
Internal enterprise
Possible execution location
service environment, CI, IDP, production API
Example risk
a shared service account turns a small mistake into a major incident
Origin
External SaaS/MCP
Possible execution location
provider infrastructure or a local MCP client calling outside
Example risk
OAuth token, tool results, and external instructions cross additional trust boundaries

The label “internal tool” says nothing about execution location. A local MCP server from npm may run on a corporate laptop with the user’s permissions, while an external SaaS tool may accept only a narrow one-time operation through a proxy. The required artifact is a map of actual data and authority flows, not a catalog label.

04

What specific products demonstrate

Every property below was checked against official documentation on July 16, 2026. This is not a model-quality comparison and does not declare one product a replacement for another. It separates what follows from the documentation from what does not.

OpenCode

Verified: the repository is published under MIT; the client supports many providers and a configurable baseURL, plus built-in, custom, and MCP tools. In the current tool documentation, tools are enabled by default, while permissions support allow, ask, and deny.

What does not follow: an open and portable client does not make the model local; rules do not prove the presence of an OS-enforced sandbox; without an enterprise profile, safe defaults remain the responsibility of the user or platform team.

Codex CLI

Verified: the client is open under Apache-2.0; configuration supports custom model providers, including an internal proxy, Ollama, and LM Studio; in CLI/IDE, sandbox and approvals are separate, and the sandbox relies on operating-system mechanisms.

What does not follow: an open client does not make OpenAI models open or local; connecting a different endpoint does not guarantee equal agent-loop quality or tool use.

Claude Code

Verified: official documentation covers the Claude API and Claude delivery through Amazon Bedrock, Google Vertex AI, Microsoft Foundry, and Claude Platform on AWS; the product provides centrally managed permissions and an OS-level sandbox.

What does not follow: these are several delivery paths for Claude, not stated support for an arbitrary self-hosted model. A local client does not imply local inference; data path and retention depend on account type and provider.

GLM-5

Verified: the model card publishes weights under MIT and serving recipes—the card lists 754 billion parameters—while Z.AI offers a managed API.

What does not follow: open weights do not mean “runs on any laptop” and do not remove serving cost. Self-hosted GLM and GLM through an API are different configurations in data path, operations, and failure modes.

GigaChat

Verified: this is a managed API with partial OpenAI API compatibility and custom functions. On the product page, Sber states that data is stored on servers in Russia and that prompts and responses are not used for training by default.

What does not follow: a regional API is not a model under the customer’s operational control. A marketing statement about data must be backed by contract, plan settings, and the organization’s own flow map. API compatibility is not behavioral portability.

Practical conclusion: OpenCode and Codex show that an open harness can work with different endpoints. GLM-5 shows that one model can exist both as open weights and as a service. GigaChat demonstrates the separate class of a regionally managed model. Claude Code shows how one vendor client can offer several infrastructure paths to one model family. None of these examples collapses openness, model ownership, locality, and policy control into one property.

05

Control lives at two gateways

diagram 04 · two independent gateways in the agent stack
Two independent gateways in the agent stackDATA PATHUSERHARNESScontext + routeMODEL GATEWAYself-hosted · external APIAUTHORITY PATHAGENT IDENTITYHARNESSintent + tool callTOOL GATEWAYsandbox · systems · SaaSOne gateway governs data. The other governs authority and actual effect.

Model and tool gateways are logical roles, not necessarily separate microservices. They may be services, client libraries, or parts of a managed platform. The important capability is independent enforcement of routing, identity, audit, and emergency shutdown. The first gateway controls which data goes where; the second controls who may change what, and on whose behalf.

This architecture has a price. The gateway that carries every prompt, argument, and token is the most valuable attack target in the stack: its log becomes a sensitive-data store of its own, and compromising it yields the authority of every agent at once. It is also an organizational bottleneck: the change queue, on-call duty, and adapter compatibility land on the platform team, and without one the two control points degrade into two points of failure. Owning the gateways is an operating commitment, not a line in an architecture diagram.

06

Eight practical configurations

These are not product rankings but eight repeatable configurations. Each is described by its data flow, ownership, strengths and constraints, economics, lock-in, suitable scenarios, characteristic failures, and mandatory controls. The mandatory baseline is the same for all eight — an OS-enforced sandbox, deny-by-default egress with no unsafe fallback, pinned versions, OBO, an end-to-end trace, and a kill switch; its operational form lives in the checklist, so “Mandatory controls” below lists only what is specific to each configuration.

Why exactly eight

Formally, the tuple “harness × model × tools” yields twenty-seven combinations, but most of them differ only in logos. The list below keeps the operational archetypes — options that fail differently and require different boundaries. Configurations 1–5 are grid points of “harness × model,” from a fully owned stack to a fully external one. Configuration 6 is not a grid point but a strategy on the model axis: routing turns model choice into policy. Configuration 7 is a different topology: the model is removed from the execution chain and kept only for planning. Configuration 8 is a governance anti-pattern, included because it already lives inside organizations whether they know it or not. If two options fail the same way and are protected the same way, this analysis treats them as one configuration.

diagram 05 · map of eight configurations
Map of the eight agent stack configurationsAUTONOMOUSair-gap · fully owned1HARNESS + APIowned loop · frontier2CLIENT + LOCALlocal exp · evals3AGENT + GATEWAYcorporate default4FULL SAASfast pilot · lock-in5ROUTERscale · owned evals6PLANNER + EXECplan out · authority in7PERSONAL STACKlow-risk · test tenant8Eight repeatable configurations · not a ranking but eight combinations of the data and authority paths

1 · Fully autonomous or isolated stack

user → own/forked harness → self-hosted model → local or internal tool gateway → internal systems; no egress during normal operation

Ownership. The organization owns the entire stack: model artifacts, inference, harness, sandbox, tool registry, upgrades, observability, and user support.

Strengths. Maximum control over data location and versions; air-gap operation; independence from external availability and sudden API changes; reproducible behavior on a pinned artifact set.

Constraints. Quality and speed depend on available models and compute. New capabilities arrive only after internal upgrade and validation. Every difficult harness function becomes a product responsibility, while isolation slows the delivery of fixes.

Economics and lock-in. High fixed cost: GPUs, a platform team, spare capacity, and a safe upgrade process — “no API bill” does not mean “no inference cost.” External dependency is minimal, while lock-in remains in the serving stack, weight format, and the client fork.

Best fit. Restricted and defense environments, data that cannot leave the perimeter, and sites with unreliable connectivity.

Characteristic failures. An outdated model or vulnerable dependency remains inside for a long time; the local agent gets broad permissions because “the perimeter is already safe”; an external fallback appears unnoticed; insufficient GPU capacity becomes total unavailability.

Mandatory controls. A private artifact registry; offline fix delivery; regular network tests of the air gap — the absence of egress must be a verified property, not a property of the diagram. Plus the common baseline of boundaries.

2 · Own harness with an external frontier model

user → own harness → enterprise model gateway → external API → own tool gateway → systems

Ownership. The provider owns the model and contractual availability. The organization owns context, the agent loop, routing, tools, permissions, result validation, and user experience.

Strengths. Access to rapidly improving strong models without operating GPUs; full control over domain logic, task state, and the tool layer; the model can be changed behind an isolated adapter.

Constraints. A production-quality harness still has to be built, including context compaction, retries, and loop prevention. Some data leaves the perimeter. A model-behavior change can break the process without any API schema change.

Economics and lock-in. Development cost plus variable API spend; at high agent traffic, cache behavior, step limits, and retry cost become critical. Lock-in is moderate at the protocol level and high in behavior, prompts, and evals tuned to one model.

Best fit. Domain agents whose advantage lies in process and tools, where classified context may be sent outside.

Characteristic failures. A secret enters a prompt or tool result; a rate limit causes a retry storm; context is sent to the wrong region; a provider changes a model alias; the model-gateway log becomes a sensitive-data store.

Mandatory controls. Pre-call context classification and filtering; provider and region allowlists with contractual retention terms; redaction of the gateway’s own logs. Plus the common baseline of boundaries.

3 · Off-the-shelf client with a local or self-hosted model

user → OpenCode/Codex or another configurable client → Ollama / LM Studio / vLLM / internal endpoint → local and internal tools

Ownership. The client developer maintains the base agent loop. The organization owns the model endpoint, compatibility, secure client configuration, sandbox, and enterprise tools.

Strengths. Fast path to a local experiment; ready-made UX, context management, and tool loop without building a client from scratch; code and prompts can remain in a controlled environment.

Constraints. A compatible endpoint does not guarantee correct tool use. The harness may be optimized for another model family. Context compaction and error recovery are difficult to assess on a happy path. A client upgrade can change prompts and model expectations.

Economics and lock-in. The client license may be free, but GPUs, adapters, and workstation support remain — underutilized hardware is often more expensive than an API. The main lock-in is the hidden contract between client and model; a fork reduces surprise-upgrade risk at higher maintenance cost.

Best fit. Open-weight model research, sensitive local code, and temporary offline work.

Characteristic failures. The model emits a syntactically valid but semantically wrong tool call; a local endpoint listens externally without authentication; the client silently fails over outside; a command runs outside the sandbox; laptops produce inconsistent results.

Mandatory controls. A matrix of capabilities proven to work; tests for tool calling, cancellation, compaction, and error recovery; local endpoints bound to loopback or behind authentication; a centrally distributed secure configuration. Plus the common baseline of boundaries.

4 · Vendor coding agent with an internal tool gateway

developer → Claude Code / Codex or another vendor agent → provider model → internal MCP/API gateway → IDP, repositories, CI/CD, and production

Ownership. The provider develops the client and model. The organization owns the tool catalog, action policy, agent identity, audit, and system integrations.

Strengths. Rapid access to strong developer UX and model updates; internal authority can be centralized independently of the client; several clients can share one secure tool contract.

Constraints. Code and context may go to an external provider. Critical client changes arrive on the provider’s schedule. The gateway must be designed as a product, not as a mechanical MCP adapter over low-level APIs.

Economics and lock-in. Seat or API cost plus a shared tool platform; reusable IAM, policy, and audit make each subsequent agent cheaper to onboard. Lock-in is meaningful at the client and model layers and lower for enterprise actions while their contract, identity, and logs belong to the organization.

Best fit. Enterprise development: external models are approved, access to internal systems stays centralized.

Characteristic failures. Every call uses one shared service account; tool output from an issue or repository carries prompt injection; the MCP server exposes low-level commands; client approval does not match the gateway’s actual action.

Mandatory controls. High-level tools with narrow schemas; policy as code and reauthorization at the gateway itself; independent dry run and diff for dangerous actions; a kill switch across all the dimensions listed in the checklist. Plus the common baseline of boundaries.

5 · Fully managed SaaS stack

user → cloud harness → provider model → cloud sandbox/connectors → repositories and SaaS

Ownership. The provider owns most execution, upgrades, and baseline isolation. The customer owns tenant configuration, connected repositories, OAuth scopes, retention settings, review process, and acceptance of results.

Strengths. Minimum time to pilot; almost no internal model or client operations; fast upgrades; cloud jobs can be isolated from a developer workstation.

Constraints. A large trust commitment to the provider; limits around regions, network, custom policy, and telemetry export; availability and roadmap remain outside the organization; old behavior is difficult to reproduce after an upgrade.

Economics and lock-in. Low entry cost, while variable spend grows with seats, tasks, and connectors. Lock-in is high: client, model, execution environment, task state, and connectors belong to one control plane.

Best fit. A constrained pilot, noncritical repositories, and asynchronous tasks with mandatory review.

Characteristic failures. A repository or secret believed to be local reaches the cloud; an OAuth connector has permissions broader than the task; default retention violates policy; an upgrade changes effectiveness; audit cannot be exported to the internal SIEM.

Mandatory controls. Enterprise tenant and contractual data modes; allowlists for repositories and task types; minimum connector scopes; branch protection and independent review; export of available logs with regular retention and region checks; a shutdown and data-export plan. Plus the common baseline of boundaries.

6 · Multi-model platform with routing and fallback

client/agent → model gateway → policy classifier → local, regional, or external model → tool gateway; fallback depends on data and task class

Ownership. Providers own their models. The platform team owns routing, adapters, evals, budgets, tracing, and safe behavior under failure.

Strengths. Quality, cost, latency, region, and availability can be combined. The organization gains real negotiation and migration leverage. A small model can handle a simple step and a strong model a difficult one.

Constraints. This is one of the most behaviorally complex configurations. A universal API hides differences only until the first nontrivial tool call. The router adds latency, failure points, and a permanent need for evals.

Economics and lock-in. High platform cost justified by scale, resilience requirements, or route-cost differences; token savings are easily consumed by retries. Lock-in to one provider falls, replaced by dependency on the organization’s own gateway and eval suite.

Best fit. A large platform with several data classes and a need to survive provider outages.

Characteristic failures. During an outage, a sensitive request automatically goes to an external API; a cheap model misclassifies an action; a cascade multiplies cost; models leave incompatible state; an alias changes without regression testing.

Mandatory controls. Data classification before route selection and explicitly approved “data class × region × model” pairs; for restricted classes, fail closed instead of an asymmetric fallback; the routing reason recorded in the trace; evals for every route and transition. Plus the common baseline of boundaries.

7 · External planner with an internal deterministic executor

user → internal controller → sanitized context to external model → typed plan → internal policy engine/executor → systems; the external model receives no working credentials and calls no system directly

Ownership. The provider supplies reasoning. The organization defines the intent language, validates the plan, executes operations, controls transactions, and decides which results return to the model.

Strengths. A strong external model can be used while authority and sensitive data stay inside. Blast radius is limited to deterministic commands. Every action can be validated before execution.

Constraints. A useful but sufficiently narrow command language is difficult to design. Sanitization loses context. Long interactive loops are slower. A model can still propose a dangerous but formally valid plan.

Economics and lock-in. Integration cost pays off where an incorrect action is expensive. The model is relatively easy to replace while the typed contract and evals belong to the organization; most lock-in moves, intentionally, into the internal executor.

Best fit. Operations with a high cost of error: infrastructure, finance, HR, and regulated environments with planning over de-identified data.

Characteristic failures. A malicious instruction hides in a plan string; a validator checks JSON Schema but not business invariants; dry run differs from commit; an overly detailed error leaks a secret; a retry executes an operation twice.

Mandatory controls. A closed typed intent language with no arbitrary shell or SQL; semantic plan validation, idempotency, and transaction limits; filtered results and errors; credential-free model context; a log connecting intent, policy decision, and actual action. Plus the common baseline of boundaries.

8 · User agent with external MCP/SaaS tools

personal or local client → selected model → user-installed MCP/plugin → external SaaS, often with user-delegated OAuth

Ownership. The user chooses client, servers, and scopes. Client, model, MCP, and SaaS vendors divide technical ownership. The organization often discovers the stack only after data and tokens are already present.

Strengths. A personal workflow can be assembled very quickly; integrations are plentiful; users retain a familiar interface and combine services without waiting for the platform team.

Constraints. Fragmented identity, an opaque vendor chain, and weak common audit. A local MCP inherits the user environment. Approvals quickly become ritual. A package update may change tools and behavior.

Economics and lock-in. Low entry cost but a poorly visible total cost: subscriptions, duplicate integrations, incident investigation, and later centralization. Lock-in is distributed across the client, OAuth connections, SaaS data, and specific MCP servers: replacing one component is easy, reproducing the complete process is difficult.

Best fit. Personal productivity on low-risk data; experiments in a separate test tenant.

Characteristic failures. A malicious or compromised MCP package receives files and tokens; OAuth requests excessive scopes; a localhost server is vulnerable to DNS rebinding; a token is forwarded without audience validation; prompt injection from an email makes the agent send data; the user automatically approves a sequence of similar requests.

Mandatory controls. An enterprise registry of approved MCP servers and versions with provenance checks; OAuth with PKCE, audience validation, and short-lived tokens; keyring secret storage; separate personal and work tenants; no high-risk write tools; centralized access revocation. Plus the common baseline of boundaries.

07

Threat model: attackers target the authority chain

A NIST CAISI technical blog describes agent hijacking as a form of indirect prompt injection: an attacker places an instruction in data—an email, website, file, or repository—that an agent reads while performing a legitimate task. In NIST experiments, repeated attempts materially changed measured risk, and scenarios included remote code execution, bulk exfiltration, and phishing. A sentence in the system prompt cannot fix this. Controls must sit at data, identity, and execution boundaries.

diagram 06 · path from untrusted data to action
The data and authority chain from user to systemsUSERgoalHARNESScontextMODELtool callTOOL GATEWAYtokenSYSTEMSissue · email · README · logtool resultreturns an external instructionback into contextPrompt injection becomes an incident only through an available actionNIST agent hijacking · OWASP Agentic Security · original framework
Boundary
User → harness
What breaks
goal substitution, unsafe repository, malicious configuration
Typical scenario
a user opens a third-party project that changes agent or MCP instructions
Where the control belongs
trust on first use, pinned configuration, repository verification, separation of trusted and untrusted workspaces
Boundary
Harness → model
What breaks
code, secret, or personal-data leakage; hidden route change
Typical scenario
context or logs go to the wrong provider or region
Where the control belongs
model gateway, pre-send classification, redaction, route allowlist, and no fallback for restricted data
Boundary
Model → tool gateway
What breaks
prompt injection becomes an action; arguments conceal intent
Typical scenario
the model reads a web instruction and invokes file transfer
Where the control belongs
typed narrow tools, policy enforcement outside the model, read/write separation, dry run, and limits
Boundary
Gateway → systems
What breaks
confused deputy, excessive permissions, token passthrough
Typical scenario
the agent uses a shared admin token or forwards a client token downstream
Where the control belongs
OBO, audience validation, short-lived scopes, separate downstream tokens, continuous authorization
Boundary
Result → harness/model
What breaks
tool output becomes a new control channel
Typical scenario
an issue, email, log, or README says “send the secret”
Where the control belongs
mark untrusted data, filter it, restrict subsequent capabilities, run adversarial evals
Boundary
Package/binary/MCP → entire chain
What breaks
supply-chain compromise
Typical scenario
a client or MCP update gains new commands, egress, and keychain access
Where the control belongs
signatures, provenance, pinned versions, SBOM/AIBOM, sandbox, staged rollout, and kill switch

Prompt injection and agent hijacking. The agent mixes developer instructions and external data in one context. A model may know that a site is untrusted and still follow a hidden instruction; more tools and repeated attempts increase the attack surface. The denial therefore belongs in policy and IAM. A model may propose an action but must not decide whether it has permission to perform it.

Code and secret leakage. Leakage is not limited to the prompt sent to a model. Tool arguments and results, traces, crash reports, telemetry, caches, shell history, and external fetches all become channels. A secret removed from the original request may return to context after a tool reads .env. The same controls must cover input, the tool loop, and logs.

Excessive permissions and confused deputy. An internal gateway using one service account is more dangerous than an external API with a narrow user scope. The agent becomes a confused deputy when it acts with gateway authority rather than the initiator’s. The MCP security guidance explicitly treats token passthrough as an antipattern: the server must accept only tokens issued for it, validate audience, and obtain a separate downstream token. The MCP authorization specification requires resource-bound tokens and recommends minimum scopes.

SSRF and DNS rebinding. OAuth discovery, dynamic callback URLs, and arbitrary-URL tools expose SSRF paths to metadata endpoints and internal addresses. A local HTTP MCP without Origin validation, authentication, and correct binding can be reached through browser DNS rebinding. The MCP transport specification requires Origin validation and recommends that local servers bind only to loopback.

Supply chain of binaries and MCP servers. A signed binary proves the publisher, not safe behavior. An open repository permits audit but does not prove that the installed package was built from it. An MCP server or skill is executable code and a source of model instructions at once. Version it, review it like an application dependency, and run it with minimum permissions. A presentation to ISPAB hosted by NIST list signed manifests, pinned versions, and sandboxing for third-party MCP servers among the mitigations.

Unsafe fallback routes. “If the local model is unavailable, send it outside” is a policy change, not an availability feature. A fallback must be at least as permissible for the current data class. In a restricted environment, the safe outage response is to stop the task rather than disclose context.

Approval fatigue. Confirming every command does not create informed consent. Users learn to press Allow, and an agent may split one dangerous action into apparently harmless steps. Approval must show the final effect: which data leaves, on whose behalf, which resource changes, and whether it is reversible. The gateway must independently revalidate a dangerous action.

A sandbox that exists only in a prompt or container. Asking a model not to use the network is not network policy, and a proxy environment variable does not block direct connections. The OS, hypervisor, or isolated environment must physically restrict filesystem, processes, and egress. OpenAI describes sandbox and approvals in Codex as complementary controls, not substitutes. A container is useful, but privileged mode, a mounted Docker socket, or broad credentials make its boundary fictitious.

Audit without event provenance. A log entry saying “agent invoked deploy” is insufficient. An investigation needs the user and agent identity, original intent, model and version, route, configuration hash, tool name and version, policy decision, issued scopes, arguments with controlled redaction, actual effect, and approval result. The log itself must be protected as sensitive data.

08

Minimum technical boundaries

The operational form of the twelve boundaries in the diagram — concrete, verifiable items — lives in the pre-launch checklist, so the list exists in exactly one place. Three boundaries skipped most often deserve their own explanation:

  • Policy as code. The gateway validates resource, action, data, subject, and execution environment; the system prompt only explains the rule to the model — it does not enforce it.
  • Evals and red teaming. Test not only answers but refusal, injection through tool output, repeated attacks, RCE, and exfiltration; the NIST CAISI technical blog emphasizes that defenses and evaluations must adapt to new attacks.
  • Independent effect validation. Schema validation is insufficient: a dangerous action is confirmed by a policy engine, dry run, business invariant, or a human not involved in generating the plan.
diagram 07 · twelve technical boundaries
Twelve technical boundaries for the agent stackEXECUTIONOS sandboxdeny-by-default egresskill switch01IDENTITYleast privilege + OBOshort-lived credentialsread / propose / commit02POLICYtool allowlistpolicy-as-codepinning + signatures03EVIDENCEunified traceadversarial evalseffect verification04Enforced, not prompted · permission to execute is checked outside the model

“Internal” does not mean safe, and “external” does not mean unsafe. What matters is actual authority, the data path, revocability, and boundaries enforced by the system. This aligns with the OWASP Top 10 for Agentic Applications and the separate OWASP MCP Top 10: the attack surface spans reasoning, memory, tools, identity, protocol, and human control.

09

Comparison matrix

There are no scores here. The same characteristic changes with scale, model, contract, and team maturity. No configuration is labeled “high security” because security is an outcome of implemented boundaries, not a property of a name.

The Cost structure column deliberately does not count money: budgets, contracts, FinOps, and vendor negotiations are covered in the longread on the economics of AI development, while this article keeps configuration and boundaries.

Quality, operations, and economics

No.
1
Configuration
Autonomous stack
Quality ceiling
limited by internal models and evals
Latency
predictable internally; GPU-dependent
Availability
independent of external network, dependent on own capacity
Cost structure
high fixed cost
Upgrade speed
controlled but slow
Operations cost
maximum: the entire stack is owned
No.
2
Configuration
Own harness + external API
Quality ceiling
tracks strong external models quickly
Latency
network + API + own loop
Availability
depends on provider and own gateway
Cost structure
development + variable inference
Upgrade speed
high for model, controlled for harness
Operations cost
high for agent platform, low for inference
No.
3
Configuration
Off-the-shelf client + local model
Quality ceiling
depends on model–harness fit
Latency
good with sufficient local hardware
Availability
no external network; workstation/cluster remains a failure point
Cost structure
hardware + adaptation + support
Upgrade speed
fast client cycle, independent model cycle
Operations cost
medium; grows substantially at scale
No.
4
Configuration
Vendor agent + internal gateway
Quality ceiling
tracks the selected vendor
Latency
external model + internal tools
Availability
two dependencies: vendor and gateway
Cost structure
seats/API + shared platform
Upgrade speed
high for client and model
Operations cost
medium; gateway is reusable
No.
5
Configuration
Full SaaS
Quality ceiling
tracks the service
Latency
depends on network and cloud queue
Availability
defined by SLA and external dependencies
Cost structure
low entry cost, growing variable cost
Upgrade speed
maximum but uncontrolled
Operations cost
minimal internal cost
No.
6
Configuration
Multi-model router
Quality ceiling
can select an appropriate validated route
Latency
classification + one or more calls
Availability
higher with safe failover
Cost structure
high platform cost, optimizable unit cost
Upgrade speed
high; requires continuous evals
Operations cost
high: routes and adapters
No.
7
Configuration
Planner + executor
Quality ceiling
strong planning constrained by a narrow contract
Latency
higher because of plan/validate/execute
Availability
planner can be stopped without losing systems
Cost structure
integration + API
Upgrade speed
fast model, conservative contract
Operations cost
medium/high for the executor
No.
8
Configuration
User agent + SaaS/MCP
Quality ceiling
depends on the personal tool set
Latency
unpredictable service chain
Availability
sum of every component’s availability
Cost structure
low visible cost, high hidden cost
Upgrade speed
fast and fragmented
Operations cost
shifted to the user and vendors

Portability, data, and control

No.
1
Configuration
Autonomous stack
Portability
potentially high, low with a deep fork
Observability
fully internal, so it still must be built
Data residency
maximum control
Air gap
yes
Main security challenge
do not confuse perimeter with least privilege; update the supply chain safely
No.
2
Configuration
Own harness + external API
Portability
good at the API layer, difficult behaviorally
Observability
high through own gateways
Data residency
external path governed by contract and route
Air gap
no
Main security challenge
prevent secret leakage and keep policy outside the model
No.
3
Configuration
Off-the-shelf client + local model
Portability
formally high, proven only through evals
Observability
mixed: client + own inference
Data residency
controlled
Air gap
possible
Main security challenge
prove compatibility and isolate local execution
No.
4
Configuration
Vendor agent + internal gateway
Portability
low for UX/model, high for internal capabilities
Observability
good with end-to-end trace
Data residency
model context outside, systems inside
Air gap
no
Main security challenge
OBO, prompt injection from internal data, approval must match effect
No.
5
Configuration
Full SaaS
Portability
low
Observability
within the provider’s export capability
Data residency
depends on available regions and contract
Air gap
no
Main security challenge
tenant, connectors, retention, review, and service exit
No.
6
Configuration
Multi-model router
Portability
an explicit goal, but expensive
Observability
potentially most complete through one gateway
Data residency
per-route policy
Air gap
partial for approved tasks
Main security challenge
prevent unsafe fallback and loss of provenance
No.
7
Configuration
Planner + executor
Portability
model replaceable, executor intentionally owned
Observability
high at the plan-to-effect boundary
Data residency
only approved context leaves the perimeter
Air gap
partial; external planner can be disabled
Main security challenge
validate the plan semantically and never give credentials to the model
No.
8
Configuration
User agent + SaaS/MCP
Portability
components replaceable, process hard to reproduce
Observability
weak and fragmented
Data residency
distributed across vendors
Air gap
no
Main security challenge
supply chain, OAuth scopes, local permissions, and shadow AI
10

Decision tree

diagram 08 · from constraints to products
Configuration decision tree from constraints to productsCAN DATA LEAVETHE TRUST ZONE?01no → {1, 3}plan only → {7}yes → {2, 4, 5}ARE INTERNALWRITE ACTIONS NEEDED?02no writes → base 5gateway writes → base 4owned workflow → base 2ADD ROUTING TOTHE BASE ROUTE?03no → keep {2 | 4 | 5}yes + evals → add 6outside the tree: 8 in a test tenantNarrow to one base route first; add multi-model routing only as a measured capability.

The tree intentionally does not start with a product: first define the permitted data path, the cost of action, and operational responsibility — only then select client and model. The detailed routes by implementation type are in the recommendations below.

11

Recommendations by implementation type

Pilot. Start with configuration 4 or 5, but narrow the task more than feels comfortable: one repository, one data class, read-only access or a pull request instead of direct writes, and no production credentials. The pilot should measure accepted work, refusal, and review load—not prove that an agent can call many tools. Even a pilot needs one trace and a prompt-injection scenario.

Enterprise platform. Approve several clients while owning the points where data and authority pass: model gateway, tool gateway, capability registry, agent identity, policy, and audit. Configuration 4 is the baseline. Move to 6 only after an internal eval suite and sufficient scale exist; a router before measurement adds complexity, not portability.

Regulated environment. If data cannot leave the perimeter, select 1 and technically block external fallback. If a de-identified objective without credentials or system data may leave, consider 7. In either case, internal tools still require OBO, narrow scopes, and OS/network sandboxing. The word “closed” does not fix confused deputy.

Individual development. Configuration 3 fits sensitive local code when model quality and sandboxing are explicitly validated. Configuration 8 can serve low-risk personal automation, but work and personal tenants, tokens, and MCP servers must remain separate. Once a user scenario requires production write permissions, it is no longer a personal tool and should move through configuration 4 or 7.

12

Pre-launch checklist

Architecture and data

  • The full tuple “harness × model × tools × identity × boundaries” is documented.
  • Data-flow maps cover prompts, tool arguments, tool results, logs, caches, and telemetry.
  • Data classes and their approved models, regions, and fallback routes are defined.
  • External fallback for restricted data is technically disabled.
  • The task-state location and its deletion/export process are known.

Identity and tools

  • There are no shared long-lived production tokens.
  • OBO, audience-bound, and short-lived credentials are used.
  • Read, propose, write, and commit are separate capabilities.
  • Tools are high-level and typed; arbitrary shell/SQL requires a separate controlled mode.
  • MCP servers and skills are registered with owner, version, scopes, and review date.

Execution and network

  • The sandbox is enforced by the OS, VM, or isolated environment and verified with negative tests.
  • Egress is denied by default; DNS, direct IPs, redirects, and metadata endpoints are covered.
  • Local HTTP MCP servers validate Origin, require authentication, and bind to loopback.
  • Secrets are available only to the phase and process that need them and never return to model context.
  • Approval shows the actual effect, subject, destination data, and reversibility.

Supply chain, observability, and failure

  • Client, model, prompt, policy, MCP, and container versions are pinned and have provenance.
  • Updates pass evals and staged rollout first.
  • A trace connects user, model/version/route, tool/version, policy decision, and actual effect.
  • Prompt injection through websites, issues, README files, logs, and tool output is tested across multiple attempts.
  • Budgets cover steps, time, retries, tokens, and bulk operations.
  • A kill switch independently disables a model route, an MCP server, a client, a tool, a user, a write-action class, or a specific agent identity.
  • The team can investigate an incident without writing secrets into the log itself.
13

Choosing the baseline architecture

For most large companies, the practical center of gravity is neither a total fork nor one SaaS for every case. It is several approved clients and models around two owned choke points — model and tool gateways — with a common identity, policy, trace, and eval layer between them.

diagram 09 · baseline enterprise architecture
Enterprise baseline architecture with two choke pointsAPPROVED CLIENTSMODEL GATEWAYMODELS AND REGIONSAGENT IDENTITYTOOL GATEWAYIDP · CI/CD · PRODPOLICYOBOTRACEEVALSCorporate default · owned model gateway + tool gateway

Fork the harness when the agent loop itself is a product advantage or an off-the-shelf client cannot technically enforce a required boundary. Use a self-hosted model when the data path, economics at proven utilization, or autonomy demands it—not for the symbolic word “ours.” Separate high-risk execution from probabilistic planning even when planner and executor formally belong to the same vendor.

The central conclusion: sovereignty and security are properties of the complete chain, not an individual component. Own the points where data, authority, and irreversible actions intersect.

Takeaways

What to remember

  1. 01Describe a configuration as the complete tuple “harness × model × tools × identity × boundaries,” not by product name: a logo on the data path guarantees nothing.
  2. 02Ownership has four independent meanings: code, operations, data, and policy. None implies another, and each must be verified separately.
  3. 03For a large company, the practical center of gravity is several approved clients and models around two owned choke points: model and tool gateways.
  4. 04The target is not the model but the authority chain. Controls belong at data, identity, and execution boundaries and must be technical, not merely prompt-based.
  5. 05Selection starts with the permitted data path, cost of action, and operational responsibility. Product names come last.
Sources

Documentation, specifications, and industry guidance

OpenCode

  1. repositoryvendor documentation, reviewed in July 2026
  2. providersvendor documentation, reviewed in July 2026
  3. toolsvendor documentation, reviewed in July 2026
  4. permissionsvendor documentation, reviewed in July 2026

OpenAI Codex

  1. repositoryvendor documentation, reviewed in July 2026
  2. custom providersvendor documentation, reviewed in July 2026
  3. sandbox and approvalsvendor documentation, reviewed in July 2026
  4. Running Codex safelyvendor documentation, reviewed in July 2026

Claude Code

  1. model configurationvendor documentation, reviewed in July 2026
  2. permissionsvendor documentation, reviewed in July 2026
  3. sandboxingvendor documentation, reviewed in July 2026
  4. data usagevendor documentation, reviewed in July 2026

GLM-5 · Z.AI

  1. Z.AI model cardvendor documentation, reviewed in July 2026
  2. managed APIvendor documentation, reviewed in July 2026

GigaChat

  1. product pagevendor documentation, reviewed in July 2026
  2. OpenAI API compatibilityvendor documentation, reviewed in July 2026
  3. custom functionsvendor documentation, reviewed in July 2026

MCP specification

  1. security best practicesvendor documentation, reviewed in July 2026
  2. authorizationvendor documentation, reviewed in July 2026
  3. transportvendor documentation, reviewed in July 2026

NIST CAISI

  1. Strengthening AI Agent Hijacking Evaluationsupdated December 19, 2025; a CAISI technical blog, not a NIST standard

NIST ISPAB

  1. Agentic AI: Emerging Threats, Mitigations, and ChallengesJanuary 21, 2026; a guest-expert presentation hosted by NIST, not a NIST standard

OWASP

  1. Top 10 for Agentic Applications 2026vendor documentation, reviewed in July 2026
  2. MCP Top 10industry community guidance, not regulatory requirements
Share