Skip to content
IOmergent

AI Security Reference ArchitecturesTrack B: Agent runtimes

B3 Agents You Build

B3 is for agents and AI workflows your company builds and runs. Low-code workflow engines such as n8n are buy plus glue: the free editions lack SSO, a credential vault and log streaming, so you add them. Custom agents route every tool call through an MCP gateway that checks policy, swaps in short-lived tokens and pauses risky actions for a human. You buy the gateway, identity and sandbox, and still write the policy rules, the approval screen and the result-scanning hookup.

Buy + glue Owner: Platform eng + builders Control: Med to High Stand up: Days to 6 mos

Who it fits: Companies building agents or AI workflows that take actions, from an ops team's n8n flows to product engineering's custom agents. You run the runtime, so you can put the toolshed in front of every tool call. Two variants: low-code workflows, where the credential store is the risk, and custom agents, where identity and tool scoping are the hard part.

Frameworks: AWS GenAI scope 3AWS agentic scope Prescribed to supervisedOWASP ASI01 Agent Goal Hijack, ASI02 Tool Misuse and Exploitation, ASI03 Identity and Privilege Abuse

Last reviewed October 2026. Vendor tiers and features change often. Spot something out of date? Tell us.

FlowsPrompt / responseTool callIdentity / credentialTelemetryUnsafe pathBlocked
BoundariesYour boundaryThird party
2 variants
B3.1

Low-code workflow

You host the engine, so its credential store holds the keys to everything it touches.
Self-hosted instance123456ACTORTriggerswebhooks, schedules, formsACTORWorkflow buildersops, RevOps, SecOpsIDENTITYSSO / private accesseditor never publicKEEPWORKLOADWorkflow enginen8n, Dify, LangflowTELEMETRYExecution historyforward to SIEMSIMPLIFYSECRETSCredential storeOAuth tokens for all appsKEEPMODELModel accessTrack A, via AI gatewaySIMPLIFYTOOLSCRM, email, SlackTOOLSCloud & ticket APIs

Data flow

  1. 1Workflows start from webhooks, schedules or forms. Those paths must be public and the input is untrusted, so patch within days and put a WAF in front.
  2. 2Builders reach the editor only through SSO (paid tiers) or a private-access proxy. Never expose it to the internet.
  3. 3LLM nodes call a Track A model, ideally the AI gateway for keys and logs.
  4. 4The same workflow then acts on CRM, email, Slack, cloud and ticketing APIs.
  5. 5Every connected app's OAuth token sits in one credential store. In n8n, a vault integration is Enterprise-only, so protect the encryption key and database.
  6. 6Execution history holds prompts and data. In n8n, native log streaming is Enterprise-only, so export it on a schedule.

Low-code workflow: build or buy

Buy + glue

What you can buy for each box in the diagram, the open source option, and the part you still build yourself.

ComponentBuyOpen sourceYou buildMaturity
Triggers (webhooks, forms)Cloudflare WAF or another WAF on public trigger paths.Caddy, nginx path routingSplit public webhook and form paths from the editor.GA
SSO or private accessn8n Business or Enterprise for native SSO. Dify Enterprise. Cloudflare Access, Tailscale.oauth2-proxy, PomeriumReverse proxy in front of the editor on free editions.GA
Workflow enginen8n Business or Enterprise, Dify Enterprise.n8n Community, Dify, Langflow, FlowisePatch pipeline with a short SLA for critical fixes.GA
Execution historyn8n Enterprise log streaming.n8n public API, Postgres exportScheduled export to a bucket or SIEM, plus pruning and retention.GA
Credential storen8n Enterprise external secrets with Vault, AWS Secrets Manager or Infisical.HashiCorp Vault, InfisicalProtect the n8n encryption key, encrypt and lock down the database.GA
Model accessProvider keys with spend caps, or your AI gateway.LiteLLMPer-instance or per-workflow keys.GA
CRM, email, Slack, cloud and ticket APIsAlready owned.·Least-privilege service accounts per integration, not builders' personal admin accounts.GA

Rollout steps

#StepWhoEffort
1Deploy on a private host with Postgres, editor behind private access, only webhook and form paths public behind a WAFPlatform engineer3-5 days
2Pin the version, subscribe to security advisories and set a patch SLA of days, not weeksPlatform engineer1 day, then ongoing
3Move integrations to dedicated service accounts and protect the encryption key and databasePlatform or security engineer1 week
4Export execution and audit logs daily to a bucket or SIEM and set pruningSecurity engineer3-5 days
5Issue a capped model key, then move to the AI gateway laterPlatform engineer1 day
6Onboard builders with a connector review checklistSecurity engineer2-3 days

What you still build

  • Reverse-proxy split of the editor from public webhook and form routes
  • Execution log export job on non-Enterprise tiers
  • Encryption key handling and database hardening on non-Enterprise tiers
  • Per-integration service accounts and a scope review checklist

Gotchas

  • Webhook and form endpoints have to be public. The 2026 critical n8n flaws, including the unauthenticated Ni8mare bug, were in that code.
  • External secrets and log streaming are n8n Enterprise only. On lower tiers, credentials sit in the n8n database, and the key sits on the host.
  • Native SSO needs n8n Business or above, or Dify Enterprise. Free editions need a proxy.
  • Langflow had an unauthenticated code execution flaw in CISA's known exploited list. Never expose it to the internet.
  • Owning the instance means owning every connected app's token.
B3.2

Custom agents

Agent platformSystems of record12345678910ACTOREnd userchat, Slack, ticketIDENTITYIdPuser + agent identityKEEPCONTROLRed team & evalsCI gate before releaseSIMPLIFYMODELModel accessTrack A, via AI gatewayWORKLOADAgent runtimeplanner + LLM loopWORKLOADCode sandboxephemeral, no networkSIMPLIFYACTORHuman approvalexternal or destructiveKEEPCONTROLMCP gatewayregistry, OBO, scansCONTROLPolicy engineOPA / CedarSIMPLIFYTOOLSInternal APIsTOOLSSaaS (CRM, ticketing)TOOLSCloud APIsTELEMETRYTool audit to SIEMcall, args, resultSIMPLIFYCONTROLKill switchrevoke now, monitor laterKEEP

Data flow

  1. 1A signed-in user asks the agent to do something. The user's identity travels with the request.
  2. 2The agent plans with a Track A model, reached through the AI gateway.
  3. 3Generated code runs in an ephemeral sandbox with no network and no secrets.
  4. 4Every tool call goes to the MCP gateway, never directly to a system.
  5. 5The policy engine allows or denies per user, agent, tool and action.
  6. 6External, financial, destructive and regulated-data actions pause for human approval. Internal writes run on their own and are logged.
  7. 7The gateway gets a short-lived, narrowly scoped token for the user (on-behalf-of for internal APIs, stored per-user tokens for most SaaS, STS for cloud), calls the tool, and flags likely injected instructions in the result.
  8. 8Every call, argument and result is logged to the SIEM.
  9. 9Before each release, automated red teaming and evals test the agent for injection, data leaks and unsafe actions.
  10. 10A kill switch revokes the agent's tokens at once. A runtime monitor that flags anomalies can come later.

Custom agents: build or buy

Buy + glue

What you can buy for each box in the diagram, the open source option, and the part you still build yourself.

ComponentBuyOpen sourceYou buildMaturity
IdP (user + agent identity)Okta Agent SSO (core Okta SSO), Okta for AI Agents, Microsoft Entra Agent ID, Auth0 for AI Agents add-on, AembitKeycloakGive each agent a named owner and an allowed tool setGA
Red team and evalsPromptfoo Enterprise, Mindgard, Straiker AscendPromptfoo, garak, PyRITTest cases for your own tools, data and destructive actionsGA
Code sandboxE2B Pro or Enterprise, Daytona, Modal TeamE2B self-hosted, gVisor, FirecrackerBlock egress, keep secrets out of the image, clean up after runsGA
Human approvalAuth0 asynchronous authorization (CIBA), AI Agents add-on or Enterprise·Per-action approval card showing exact arguments, deny on timeout, decision loggedGA
MCP gatewayRunlayer, Obot Enterprise, Prisma AIRS AI Gateway (ex-Portkey), Kong AI Gateway Enterprise (MCP plugin in Tech Preview)agentgateway, Obot, Portkey gateway, Docker MCP Gateway, ToolHiveApproved-server registry, pinned tool descriptions, per-agent allowlist, kill-switch flagGA
On-behalf-of tokensAuth0 Auth for MCP (token exchange), Entra Agent ID agent OBO flow, Okta Cross App Access, AembitKeycloak token exchange, agentgatewayMap each tool to scopes, broker per-user SaaS tokens in a vaultGA
Policy engineAmazon Verified Permissions (Cedar)OPA, CedarThe rules: user, agent, tool, action and data class, with testsGA
Tool result scanningPrisma AIRS, Check Point AI Guardrails (formerly Lakera), Zenity, NomaLLM Guard, mcp-scanWire it into the response path, scan nested JSON, tune false positivesGA
Tool audit to SIEMYour existing SIEM plus gateway logsOpenTelemetryRedact secrets and regulated fields, link user, agent and run IDGA
Kill switchGateway deny rule plus IdP agent disable·One flag that blocks an agent's tool calls and revokes its tokensGA
Runtime anomaly monitorZenity, Noma, Straiker, Geordie (all quote only)·Connect monitor alerts to automatic token revocationPreview

Rollout steps

#StepWhoEffort
1Classify every tool action as read, internal write, external, destructive, financial or regulatedSecurity engineer1 week
2Register the agent in your existing IdP with a named ownerPlatform engineer1 week
3Put all tools behind an MCP gateway, remove the agent's direct credentials and add a kill switchPlatform engineer2-4 weeks
4Set up token exchange for internal APIs, a vault for SaaS tokens and STS roles for cloud APIsIdentity or platform engineer2-4 weeks
5Start with a static tool allowlist per agent, then move to OPA or Cedar rules with testsSecurity engineer3-4 weeks
6Build approval for external and destructive actions, denied by default on timeoutApplication engineer2-3 weeks
7Run generated code in an ephemeral sandbox with no network and no secretsApplication engineer1 week
8Log redacted calls to a bucket, then forward to the SIEM with alertsSecurity engineer1-2 weeks
9Add a red-team suite to CI that includes injection through tool resultsSecurity engineer2 weeks
10Add a tool result scanner that flags likely injectionPlatform engineer1-2 weeks
11Later, add a runtime anomaly monitor that can revoke tokensSecurity engineer2-4 weeks

What you still build

  • Policy rules covering user, agent, tool, action and data class, with unit tests
  • An approval screen that shows the exact action and arguments and records who approved
  • A classification of every tool action by risk
  • Per-user token brokering for SaaS apps that won't accept your IdP's tokens
  • Result-scanner integration and what happens on a hit
  • Kill-switch wiring across the gateway and the IdP
  • Red-team test cases written for your own tools

Gotchas

  • True on-behalf-of exchange works for your internal APIs and apps that support Cross App Access. Most SaaS needs stored per-user OAuth tokens, scoped only as narrowly as the SaaS allows.
  • Result scanning flags likely injection but misses plenty. Treat narrow scopes and human approval as the real controls.
  • Cloudflare MCP Server Portals expect a human browser login and don't support device auth, so they don't fit headless agents.
  • Kong's MCP OAuth2 plugin is Enterprise-only and still in Tech Preview.
  • Build the kill switch now. It takes days. Defer only the anomaly monitor.
  • Too many approval prompts train people to click yes. Only ask for external, destructive, financial or regulated actions.
  • Logging full tool results can copy regulated data into your SIEM. Decide on redaction first.

Common use cases

  • Lead enrichment and alert triage workflows
  • Onboarding and scheduled reporting
  • Customer-facing support agents
  • Ops and SRE runbook automation

Key risks

  • One credential store holding tokens for everything
  • Internet-exposed, under-patched workflow editors
  • Excessive agency from broad tool scopes
  • Confused deputy when the agent uses its own credentials
  • Prompt injection via tool results
  • No way to stop an agent that goes wrong

Fast path

  • KEEPSSO or private access in front of every workflow editor
  • KEEPPatch within days, WAF on public trigger paths
  • SIMPLIFYStatic tool allowlist per agent before OPA
  • KEEPHuman approval on external and destructive actions
  • KEEPShort-lived, scoped tokens per user
  • KEEPKill switch that revokes agent tokens
  • SIMPLIFYRedacted audit to a bucket first

Sources

Vendor documentation and announcements we checked for this page. Products are examples of a category, not endorsements.

Not sure which pieces to buy and which to build?

Bring the AI tools your teams use today and the data they touch. In a 30-minute call we map you to these models and name the controls to add first. No sales pitch.

Talk to a CISO