Choosing between an open-source agent framework and a managed agent platform is mostly a decision about who runs the security controls, yet teams usually make it on developer convenience alone. With a framework you own the whole stack: the process the agent runs in, the credentials it holds, the sandbox for generated code, the logs and every dependency. With a managed platform the provider runs the runtime, isolation and much of the identity plumbing, but you still own permissions, tool design, data exposure and how the agent behaves. This guide sets out that split control by control, the threat model and failure modes of each option, how platform features can lock your controls in, and decision criteria by team maturity and data sensitivity, with a worked scenario. It is for security architects, AI platform owners and engineering leads deciding where agents should run.
Key takeaways
- A framework is a library, a platform is a service. A framework runs inside your process with your identity and your defaults; a managed platform hosts the agent loop and offers identity, isolation, policy and tracing as configurable services.
- Managed does not mean secured for you. Microsoft's AI shared responsibility guidance states that security responsibilities generally sit with the party that performs the task, and providers often expose controls as configuration options that you must turn on.
- Frameworks concentrate supply chain risk in your build. Every framework release, integration package and community tool lands in your dependency tree and your patch queue.
- Platforms concentrate control in the provider's model. Agent identities, tool policies and traces written in a provider's format do not move easily, so keep the authoritative policy and evidence in places you control.
- Decide per agent, not per organisation. Data sensitivity, autonomy and your team's ability to run sandboxes and patch dependencies should pick the option, and many estates will run both.
The short answer
Use a managed agent platform when you want the provider to operate runtime isolation, session separation, credential brokering and telemetry, and you can accept its identity model and regions. Use a framework on your own infrastructure when you need control the platform does not give you (custom isolation, on-premises data, specific network paths) and you have the engineering capacity to run the controls a platform would otherwise supply. In both cases the agent's permissions, the design of its tools and the data it can reach remain yours. The two are not exclusive: the platforms covered below host agents written in open-source frameworks, so the real choice is often "framework on our runtime" versus "framework on a provider runtime".
Frameworks and managed platforms side by side
| Dimension | Open-source agent framework (self-hosted) | Managed agent platform |
|---|---|---|
| What you deploy | Your application code plus framework packages, running on containers, VMs or serverless you operate | An agent definition or container hosted by the provider's runtime |
| Agent loop | Framework code in your process decides when to call the model and tools | Provider runtime runs the loop, or hosts your framework code in its sandbox |
| Identity | Whatever your workload identity is (service account, workload identity federation, or a static key you inject) | Platform-issued agent identity or managed identity bound to the provider's IAM |
| Secrets for tools | Your secrets manager and injection pattern | Platform credential providers, connections or on-behalf-of flows, plus your own store |
| Code execution | You build and harden the sandbox | Provider sandbox service or per-session isolated VM |
| Tool policy | In tool code or a policy engine you run | Platform gateway or policy service, where offered |
| Telemetry | You instrument (often OpenTelemetry) and ship to your stack | Built-in tracing into the provider's monitoring, often exportable |
| Patching | You track framework, integration and model SDK releases | Provider patches the runtime; you still patch the code you upload |
| Data location | Wherever you run it | Provider regions and the residency options the provider documents |
Low-code agent builders sit at the far managed end and are covered in the Low-Code Agent Platforms Guide and not repeated here.
Who owns which control
"Shared" means the provider supplies a mechanism and you must configure and verify it.
| Control | Framework on your infrastructure | Managed platform | What you must still do on a platform |
|---|---|---|---|
| Agent identity issuance | You | Shared | Give each agent its own identity, not one per project; record an owner |
| Permissions of that identity | You | You | Least privilege on every downstream resource; the platform cannot know what the agent needs |
| Credential custody for tools | You | Shared | Prefer brokered or on-behalf-of tokens over keys stored in agent configuration |
| Runtime and session isolation | You | Provider | Confirm the isolation unit (per session, per agent, per project) in the documentation |
| Code execution sandbox | You | Provider (if used) | Keep credentials out of the sandbox; restrict its network egress |
| Tool authorisation at call time | You | Shared | Write and test the policies; keep high-impact tools behind approval |
| Prompt injection screening | You | Shared | Treat filters as one layer; design so injected text cannot reach privileged tools |
| Memory and session data | You | Shared | Set retention, encryption keys and per-user scoping; review what is written to long-term memory |
| Logging and tracing | You | Shared | Turn tracing on, export to your SIEM, redact secrets and personal data |
| Framework and SDK patching | You | Provider for the runtime, you for uploaded code | Scan the container or package you deploy |
| Network exposure | You | Shared | Use private networking options and service perimeters where documented |
Microsoft's shared responsibility guidance for AI describes the same pattern in three layers (AI platform, AI application and AI usage) and notes that responsibilities change with SaaS, PaaS and IaaS delivery. A managed agent platform is a PaaS: the provider takes the platform layer, while the application layer, including tools, grounding data and plugins, stays with you.
Threat model for each option
Framework on your own infrastructure
Architecture in words: a container or function runs your code; your code imports the framework, calls a model API with a key or federated token, executes tools in-process or over MCP, and writes state to a database you run. Everything the agent can reach is decided by that workload's identity and network position.
- Dependency compromise: a malicious or vulnerable framework, integration or tool package executes with the agent's privileges. OWASP LLM03:2025 Supply Chain and the OWASP Top 10 for Agentic Applications entry ASI04 Agentic Supply Chain Vulnerabilities both cover this.
- Unsafe defaults and state: local code executors and deserialised checkpoints turn model output or stored data into code paths. The Securing Agent Frameworks Guide lists the specific settings and CVEs.
- Secrets in the process: model and tool keys in environment variables are readable by any code the agent runs.
- Exposed builder or admin surfaces: self-hosted visual builders and tracing UIs are internet-facing applications in their own right.
Managed platform
Architecture in words: you register an agent definition or push a container; the provider runtime starts an isolated session per conversation, issues or assumes an identity, calls tools through its gateway or connectors, stores sessions and memory in its services and emits traces to its monitoring. You configure, the provider operates.
- Over-broad platform identity: a project-level managed identity shared by every agent means one hijacked agent has every agent's reach. This maps to ASI03 Identity and Privilege Abuse.
- Configuration drift and unused controls: policy services, private networking, customer-managed keys and tracing usually need to be switched on; defaults may favour getting started.
- Provider-side incidents: credentials and infrastructure the provider runs are outside your view. Your mitigation is contractual assurance, short-lived credentials and blast radius limits, not configuration.
- Shared memory and sessions: memory stores shared across agents or users can leak or be poisoned across boundaries. See the AI Agent Memory Security Guide.
Both options share one root threat: untrusted text steering an agent with real permissions. Hosting does not change that; permission design does.
What the major managed platforms document
Platforms are listed alphabetically; the order is not a ranking. Each row gives the provider's own feature names from its documentation as checked in November 2026. Deep configuration for each sits in its own NHI Mgmt Group guide.
| Control area | Amazon Bedrock AgentCore | Google Cloud Agent Runtime (Gemini Enterprise Agent Platform) | Microsoft Foundry Agent Service |
|---|---|---|---|
| Isolation | Runtime session isolation; Harness runs each session in an isolated microVM; Code Interpreter sandbox | Managed Agent Runtime; VPC Service Controls perimeter | Hosted agents run each session in a VM-isolated sandbox; private networking and BYO VNet |
| Identity | AgentCore Identity with existing identity providers and credential providers | Agent identity, service accounts and OAuth clients under IAM | Dedicated Microsoft Entra agent identity; managed identity; on-behalf-of authentication |
| Tool control | Gateway exposes tools over MCP; Policy intercepts every tool call through Gateway, with rules in natural language or a Cedar-compatible language | IAM Conditions on Sessions; access managed per agent identity | Add Tools catalog to select permitted tools; MCP authentication options |
| Data protection | Memory with short and long-term stores | Customer-managed encryption keys (CMEK) for Agent Runtime, Sessions and Memory Bank | Bring your own storage, search and database resources |
| Telemetry | Observability in OpenTelemetry format | Cloud Trace, Cloud Logging and monitoring | Agent tracing with Application Insights |
| Frameworks hosted | CrewAI, Google ADK, LangGraph, LlamaIndex, OpenAI Agents SDK, Strands Agents and custom code | ADK, AG2, LangChain, LangGraph, LlamaIndex and custom agents | Agent Framework, LangGraph and custom code (hosted agents) |
Availability: Amazon Bedrock AgentCore documents its services by Region. Google Cloud documents CMEK for deployed agents on single-region endpoints, not the multi-regional endpoints. Microsoft marks hosted agents and workflow agents as preview, and documents private networking for prompt and workflow agents. Confirm current status before you design around a feature.
See the AWS Bedrock AgentCore Security Guide, the Vertex AI Agent Engine security guide and the Microsoft Foundry Agent Service Security Guide.
Supply chain exposure of frameworks
A framework is rarely one package. A typical agent pulls a core library, a graph or orchestration runtime, provider integrations, vector store clients, document loaders, MCP adapters and community tools, each with its own release cadence. Controls:
- Pin and lock: lock files with hashes for every transitive dependency, built in CI from a private mirror; no unpinned installs at container start.
- Minimise integrations: install only the provider and tool packages the agent uses. Each extra loader or tool is code that runs with the agent's credentials.
- Track advisories per package: subscribe to the framework's security advisories and its vulnerability disclosure channel; LangChain, for example, documents a vulnerability disclosure programme and a security contact.
- Review community tools as code: treat prompt hubs, shared tools and MCP servers as third-party software with an owner and a review.
- Produce an AI-BOM: record framework versions, models and tools per agent. See the AI Supply Chain and AI-BOM Guide.
Moving to a platform does not remove this risk when you deploy your own framework code as a hosted agent: the provider patches its runtime, but your container still carries your dependency tree.
Platform lock-in of controls
For security, lock-in matters because controls written in one provider's model must be rebuilt to move, and rebuilt controls are often weaker.
- Identity: platform agent identities are bound to that provider's IAM. Keep the agent register (owner, purpose, data classes, autonomy level) in your own inventory and treat the platform identity as one attribute. See the AI agent registry.
- Policy: tool policies in a provider's policy service are enforced only for traffic through that provider's gateway. Write policies in a portable language where the platform supports it, keep them in version control, and enforce critical checks again inside the tool or API.
- Telemetry: prefer OpenTelemetry export to your own SIEM or data lake so evidence survives a migration and meets your retention rules.
- Protocols: exposing tools through MCP and agent-to-agent traffic through A2A, which several platforms support, keeps tool and agent interfaces portable.
- Memory: long-term memory in a provider store may not export cleanly; decide early what is retained and where.
Failure modes compared
| Failure mode | How it shows up with a framework | How it shows up on a platform | Control |
|---|---|---|---|
| Shared identity | One service account for every agent in a cluster | Project-level managed identity used by all agents | One identity per agent, scoped per tool |
| Code runs where secrets live | Local executor on the application host | Sandbox given network egress and a token | Credential-free sandbox, deny-by-default egress |
| Missing evidence | Tracing never instrumented | Tracing available but not enabled or not exported | Tracing on by policy, exported, retention set |
| Policy bypass | Approval enforced in the prompt only | Tool reachable directly, not through the gateway | Tools accept calls only from the enforcement point |
| Cross-tenant data | Client-supplied thread IDs | Shared memory store across users | Server-side scoping to the authenticated user |
Decision criteria by team maturity and data sensitivity
| Situation | Lean towards | Why |
|---|---|---|
| Small team, no platform engineering, moderate data sensitivity | Managed platform | Isolation, identity and tracing are operated for you; your effort goes into permissions and tools |
| Mature platform team already running workload identity, sandboxes and SIEM pipelines | Either; framework if control matters | You can run the controls a platform supplies and keep them portable |
| Regulated or highly sensitive data with strict residency | Platform only where residency, customer-managed keys and private networking are documented for the features you need; otherwise self-hosted | Feature availability varies by region and preview status |
| Data that must not leave your network | Framework on your infrastructure with self-hosted or private model endpoints | Managed runtimes run in provider infrastructure |
| High-autonomy agents that act without per-action approval | Whichever option gives you enforceable tool policy and a tested kill switch | Autonomy, not hosting, sets the control bar; see the AI Agent Autonomy Levels Framework |
| Many teams building agents independently | A managed platform as the default paved road, framework by exception | Central identity, policy and telemetry are easier to enforce on one platform |
Small versus large organisations: smaller organisations usually gain more security from a platform because the controls they would otherwise build are the ones they are least likely to run well. Large organisations often need both, with a platform as the default and a reviewed framework pattern for cases with special data or network needs, and the same identity, registry and logging standards across both.
Worked scenario: an invoice reconciliation agent
A finance team wants an agent that reads supplier invoices from a shared mailbox, matches them to purchase orders in the ERP and drafts payment batches for approval. Data is commercially sensitive; payments are high impact.
- Threat model: invoices are untrusted input and can carry injected instructions. The highest-impact tool is "create payment batch".
- Option A, framework on own infrastructure: the team must build a credential-free parsing step, issue a workload identity scoped to read purchase orders and write draft batches only, instrument tracing, and maintain the framework and mail integration packages. Approval is a graph interrupt before the batch tool.
- Option B, managed platform: the team registers the agent with its own platform identity, connects the ERP through the platform gateway with a policy that allows only draft creation, enables tracing and exports it, and uses the platform's isolated session for document parsing.
- What does not change: in both options the ERP role allows drafts only, a human approves payment release in the ERP itself, and the mailbox reader cannot reach the payment tool in the same context.
- Decision: with no platform engineering team and residency met by the provider's region, the team chooses the platform, keeps the policy in version control and exports traces to its SIEM to limit lock-in.
Where identity fits
Whichever option you choose, each production agent is a non-human identity with an owner, a purpose and a lifecycle. On a framework that identity is your workload identity; prefer federation over static keys, as set out in the Workload Identity Federation Guide. On a platform it is the provider-issued agent identity. In both cases separate the agent's own identity from any user it acts for, and use on-behalf-of tokens where it acts for a user. See the Agentic AI Identity Guide.
Detection and measurement
Monitor the same signals regardless of hosting: tool calls by agent identity, denied policy decisions, new tools or MCP servers attached, changes to agent definitions and identities, sandbox egress attempts, and token use outside the agent's normal pattern. On a platform, also alert on disabling of tracing, policy or private networking settings through the provider's control-plane audit log.
- Identity coverage: percentage of production agents with a dedicated identity and named owner (target 100%).
- Evidence coverage: percentage of agents whose traces reach your SIEM with defined retention.
- Policy coverage: percentage of high-impact tools behind an enforced policy or approval step.
- Patch latency: days from a framework or SDK security release to redeployment of affected agents.
- Static secret count: number of long-lived keys held in agent configuration or environment variables (trend to zero).
- Portability check: share of tool policies stored in version control outside the platform.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | GV.SC-05 | Supply chain requirements in contracts with platform providers |
| NIST CSF 2.0 | PR.AA-05 | Least privilege for agent identities in both options |
| NIST CSF 2.0 | DE.CM-09 | Monitoring runtime environments and their data |
| NIST SP 800-53 Rev. 5 | SA-9 External System Services | Managed platform as an external service with defined controls |
| NIST SP 800-53 Rev. 5 | SR-3 Supply Chain Controls and Processes | Framework and integration package governance |
| NIST SP 800-53 Rev. 5 | AC-6, SC-39, AU-12 | Least privilege, process isolation for code execution, audit record generation |
| OWASP Top 10 for LLM Applications 2025 | LLM03 Supply Chain, LLM06 Excessive Agency | Dependency risk and over-broad tools and permissions |
| OWASP Top 10 for Agentic Applications 2026 | ASI03, ASI04, ASI05 | Identity and privilege abuse, agentic supply chain, unexpected code execution |
| MITRE ATLAS | AML.T0010 Supply Chain Compromise, AML.T0053 AI Agent Tool Invocation | Compromised components and misuse of tools |
Common failure patterns
- Treating a self-hosted builder as an internal tool: agent builders hold provider keys and connection strings. In the Langflow CVE-2025-3248 exploitation 2025, unpatched internet-facing servers had their environment variables dumped; owning the stack means owning its patching and exposure.
- Assuming the provider's credentials are your control: in the CrewAI "Uncrew" flaw 2025, an error from a hosted provisioning check exposed an internal token, and the provider fixed it within hours of the report. Customers cannot configure that away; they can ask about secret handling in due diligence and keep the credentials they hand a platform short-lived and narrow.
- One managed identity for every agent: convenient at setup, it removes attribution and multiplies blast radius.
- Leaving platform controls off: tracing, policy and private networking that are documented but never enabled give a false sense of coverage.
Practitioner checklist
- Fill in the control ownership table for each production agent and get the platform or engineering owner to sign it.
- Give every agent its own identity and owner, on either option, and record it in your agent register.
- Remove static keys from agent configuration; use federation, credential providers or on-behalf-of tokens.
- Run generated code only in a credential-free sandbox with egress restricted.
- Enforce tool policy at an enforcement point, store policies in version control, and check high-impact actions again in the target system.
- Turn on tracing, export it to your SIEM, and set redaction and retention.
- Lock and scan framework dependencies, including those inside containers you deploy to a platform.
- Confirm region, preview status and customer-managed key support for every platform feature you depend on.
Standards and references
- Microsoft Learn: Artificial intelligence (AI) shared responsibility model
- NCSC: Guidelines for secure AI system development
- OWASP: Top 10 for LLM Applications 2025
- OWASP: Top 10 for Agentic Applications for 2026
- AWS: What is Amazon Bedrock AgentCore
- Google Cloud: Gemini Enterprise Agent Platform, Agent Runtime
- Microsoft Learn: Foundry Agent Service overview
- LangChain: Security policy
Related NHI Mgmt Group resources: Securing Agent Frameworks Guide · Low-Code Agent Platforms Guide · Agent Frameworks vs Workflow Orchestration · AI Agent Sandboxing and Code Execution Guide · Agent platform RFP template