企業部署 AI 智能體所需的七項基礎設施要求
Infrastructure Required to Deploy AI Agents in the Enterprise
文章列出企業 AI 智能體部署至生產環境所需的七項基礎設施要求,並提供 YAML manifest 和 Python 預檢腳本供 CI 執行。檢查涵蓋身份、工具與模型閘道、出口白名單、持久化狀態、成本上限、遙測及回滾;規則不符時,腳本會以非零代碼結束,讓 CI 阻止合併。
Most agent demos run on a laptop with one API key and a lucky prompt. Production is different. An enterprise agent needs an identity, a controlled path to its tools, a model it can swap, a network boundary, saved state and a spending cap.
Together these form the AI agent infrastructure requirements that decide whether a release survives its first week.
This post turns those seven requirements into a short YAML manifest and a Python preflight script. You can run the script in CI and block any agent that misses one. The code is small, but each rule maps to a failure that platform teams really hit.
What are the AI agent infrastructure requirements for production?
Every agent that reaches production needs the same seven things, whatever framework it uses. These AI agent infrastructure requirements are boring on purpose. Each one answers a question that your security and operations teams will ask before launch.
- Identity: a per-agent principal with short-lived credentials.
- Tool gateway: one controlled path to every tool, with audience-bound tokens.
- Model gateway: a single endpoint with fallback routing between models.
- Egress allowlist: a short list of hosts the agent may reach.
- Durable state: checkpoints written after every step.
- Cost budget: a per-run cap that pauses the agent.
- Telemetry and rollback: traces plus a pinned previous release.
Notice that none of these items mention prompts or model quality. The infrastructure around the agent decides whether it is safe to run, and a manifest can describe all of it.
Quick check: Which requirement stops an agent from reaching a host nobody approved?
the egress allowlist.
How do you write AI agent infrastructure requirements as a manifest?
A manifest turns your AI agent infrastructure requirements into something a machine can read. Keep it in the same repository as the agent, so every change goes through code review. The file below describes a hypothetical invoice-triage agent. Hosts and names are placeholders, so swap in your own.
agent: invoice-triage
owner: finance-platform-team
environment: production
identity:
principal: spiffe://corp.example/agents/invoice-triage
credential_ttl_minutes: 15
shared_credentials: false
tools:
gateway: https://tools.corp.example/mcp
token_audience: https://tools.corp.example/mcp
allowed:
- name: erp.read_invoice
scopes: [invoices:read]
- name: erp.update_status
scopes: [invoices:write]
models:
gateway: https://models.corp.example
primary: model-a
fallback: model-b
network:
egress_allowlist:
- tools.corp.example
- models.corp.example
- otel.corp.example
state:
store: postgres
checkpoint_every_step: true
budget:
max_usd_per_run: 2.50
max_usd_per_day: 150
on_exceed: pause
observability:
trace_endpoint: https://otel.corp.example:4318
rollback:
previous_release: invoice-triage@1.4.2
Each block maps to one requirement. The identity block names the owner and sets a fifteen-minute credential lifetime.
The tools block pins a gateway and lists only two tools, each with explicit scopes. The network block names three hosts, and nothing else is reachable.
The budget block caps each run at $2.50 and pauses the agent when it overflows. A reviewer can read this file in two minutes. That speed is the point.
How does a preflight script block weak releases?
A manifest only helps if something enforces it. The script below loads the file and checks every rule. It prints one FAIL line per problem and exits with code 1, so any CI system can treat it as a failed gate. It needs only PyYAML. Think of it as a unit test for your AI agent infrastructure requirements.
#!/usr/bin/env python3
"""Fail the merge when an agent manifest misses an infrastructure requirement.
Usage: python preflight.py agent-infra.yaml
Needs: pip install pyyaml
"""
import sys
from urllib.parse import urlparse
import yaml
def host(url):
return urlparse(url).hostname or ""
def check(m):
errors = []
def need(ok, msg):
if not ok:
errors.append(msg)
ident = m.get("identity", {})
need(m.get("owner"), "identity: owner team is missing")
need(ident.get("principal"), "identity: no per-agent principal")
need(ident.get("shared_credentials") is False, "identity: shared credentials are not allowed")
need(0 < ident.get("credential_ttl_minutes", 0) <= 60, "identity: credential TTL must be 1-60 minutes")
tools = m.get("tools", {})
gateway = tools.get("gateway", "")
need(gateway.startswith("https://"), "tools: gateway must be an https URL")
need(tools.get("token_audience") == gateway, "tools: token audience must equal the gateway URL")
allowed = tools.get("allowed", [])
need(allowed, "tools: allow-list is empty")
for t in allowed:
scopes = t.get("scopes", [])
need(scopes and "*" not in scopes, f"tools: {t.get('name')} needs explicit, non-wildcard scopes")
models = m.get("models", {})
need(models.get("gateway"), "models: no model gateway")
need(models.get("fallback") and models.get("fallback") != models.get("primary"),
"models: fallback must exist and differ from primary")
allow = m.get("network", {}).get("egress_allowlist", [])
need(allow and "*" not in allow, "network: egress allow-list missing or wildcard")
for url in (gateway, models.get("gateway", ""), m.get("observability", {}).get("trace_endpoint", "")):
need(host(url) in allow, f"network: {host(url) or 'endpoint'} is not on the egress allow-list")
state = m.get("state", {})
need(state.get("store"), "state: no durable store")
need(state.get("checkpoint_every_step") is True, "state: checkpoint every step")
budget = m.get("budget", {})
need(budget.get("max_usd_per_run", 0) > 0, "budget: per-run cap missing")
need(budget.get("on_exceed") in ("pause", "stop"), "budget: on_exceed must be pause or stop")
need(m.get("observability", {}).get("trace_endpoint"), "observability: no trace endpoint")
need(m.get("rollback", {}).get("previous_release"), "rollback: previous release not pinned")
return errors
if __name__ == "__main__":
with open(sys.argv[1]) as f:
problems = check(yaml.safe_load(f))
for p in problems:
print("FAIL", p)
print("preflight:", "blocked" if problems else "passed")
sys.exit(1 if problems else 0)
Run it against the manifest above and it passes. Break a few rules on purpose and it blocks the merge:
$ python preflight.py agent-infra.yaml
preflight: passed
$ python preflight.py bad.yaml
FAIL identity: shared credentials are not allowed
FAIL tools: token audience must equal the gateway URL
FAIL models: fallback must exist and differ from primary
FAIL network: models.corp.example is not on the egress allow-list
FAIL budget: on_exceed must be pause or stop
preflight: blocked
Add the script as a required check on your main branch. After that, no agent reaches production with a wildcard scope or a missing fallback.
Quick check: Which exit code makes CI block the merge?
any non-zero code. The script returns 1 when a rule fails.
What do the AI agent infrastructure requirements check, and why?
The table below pairs every requirement with the probe in the script and the failure it prevents. Read it as a short risk register for your agent platform.
| Requirement | Preflight probe | Failure it prevents |
|---|---|---|
| Identity | Per-agent principal, no shared credentials, TTL of 60 minutes or less | A leaked key that works everywhere |
| Tool gateway | HTTPS gateway, token audience equals gateway, no wildcard scopes | One agent token replayed against other services |
| Model gateway | Gateway set, fallback differs from primary | A provider outage that halts every workflow |
| Egress allowlist | No wildcard, every gateway host listed | Data leaving through an unreviewed host |
| Durable state | Store set, checkpoint on every step | A crash that restarts a long task from zero |
| Cost budget | Per-run cap, pause or stop on overflow | A retry loop that burns the monthly budget overnight |
| Telemetry and rollback | Trace endpoint set, previous release pinned | A bad release nobody can see or undo |
Why does the tool gateway bind tokens to an audience?
In a well-built agentic AI architecture, every tool call passes through one gateway. The MCP authorization spec dated 2026-07-28 sets clear rules for that path.
Clients must send a resource parameter, defined by RFC 8707, in both authorization and token requests. Servers must check that each token was issued for them, and they must refuse tokens meant for anyone else.
That blocks token passthrough, where one stolen token opens several systems. The preflight rule mirrors this: the token audience must equal the gateway URL.
Quick check: Which manifest value must equal the gateway URL?
The token audience.
Why does a model gateway need a fallback?
VentureBeat's October 2026 VB Pulse survey reached 100 qualified respondents.
Among those who had swapped the AI model in a production app, 69% said it took weeks of engineering.
A model gateway shrinks that cost.
Agents call one endpoint, and routing rules decide which model answers. The fallback entry in the manifest means a provider outage degrades service instead of stopping it.
Treat the fallback like any other release, and test it before you need it.
What should a budget do when the money runs out?
Retry loops are the classic cost bug. An agent that calls a failing tool and retries forever can spend a month of budget overnight. Count cost after each model call. When the per-run total crosses the cap, pause the run and save its checkpoint.
A human can then raise the cap or stop the task. Pausing beats killing, because durable state lets the run resume without repeating finished steps. Export one trace per run through the OpenTelemetry GenAI conventions, and attach the cost figure to it.
Quick check: What should an agent do when it crosses its per-run budget?
Pause and keep its checkpoint, so a human can decide.
What does a boring first release look like?
Start with one low-risk agent, such as a read-mostly triage helper. Write its manifest before you write its prompt.
Make the preflight script a required check, then treat every FAIL line as a ticket instead of a suggestion.
Expect the first run to fail, because that is the script doing its job. Once one agent passes, copy the manifest for the next one and change only the names and scopes.
Review the rules each quarter, since specs and providers keep changing.
The authorization text you read today may gain new requirements in the next revision, and your checks should follow.
Finally, keep your AI agent infrastructure requirements in version control, not in a wiki.
If an agent needs a new tool or a wider scope, change the file in the same pull request, so the record always matches reality. Small, boring releases build the trust that bigger agents will need later.
來源:DEV Community · dev.to



