从写代码,到创作下一幕

探索 字节跳动 - 火山方舟 的 AI 编程与视频创作活动。

Agent Plan & Coding Plan

一站体验多款热门模型,为 AI 编程与智能体开发提供更多选择。新用户可联系(微信: goo_lvyouyou)免费体验 9.9 agent plan。

Seedance 2.5

让创意,跃然成片。探索 30 秒视频、多模态参考与局部编辑,把脑海中的画面变成下一支作品。

中文

Bedrock GovCloud 配置

配置 AWS GovCloud 中使用 Amazon Bedrock 的本地 Codex 工作流

本指南介绍如何配置 Codex,通过 GovCloud 中的 Amazon Bedrock 执行推理。内容涵盖 AWS 访问权限、受管设备设置和网络控制。

Codex 配置参考

共同责任

请查阅 AWS 责任共担模型及所选服务的文档,了解 AWS 提供哪些控制措施。你所在机构负责批准使用这些服务。

在受支持的部署中,Codex 使用 AWS 身份验证向配置的 Bedrock 端点发送推理请求。你的组织负责保障运行 Codex 的设备安全,包括凭证、代码仓库、本地记录以及已启用的第三方服务。使用 GovCloud 进行推理并不意味着整个工作流满足你所在机构的要求。

验证清单 · 功能设置

开始之前

请使用 26.1002.51308 或更高版本 的桌面应用,版本号可在 关于 中查看。

准备事项 所需条件
AWS 访问权限 一个 AWS GovCloud 账户,具有访问将要使用的 Bedrock 模型的权限。
配置 经过审核的 requirements.toml、获批的网络目标地址和回滚说明。
设备管理 系统配置或 MDM 访问权限,以及应用、设备和智能体命令的网络策略。

1. 部署设备要求

在启动应用之前,通过系统配置或 MDM 部署 requirements.toml。有关文件位置和 MDM 分发方式,请参阅托管配置。保护托管策略,并在第 3 步中,在运行 Codex 的计算机上验证其设置。

建议的 requirements.toml

下面的默认 requirements.toml 有意采用严格限制。如果管理员接受额外功能带来的风险,可以启用这些功能。请参阅功能文档和网络控制文档。

requirements.toml

# Disable ChatGPT sign-in.
allowed_login_methods = ["api"]

# https://learn.chatgpt.com/docs/agent-approvals-security#common-sandbox-and-approval-combinations
allowed_sandbox_modes = ["read-only", "workspace-write"]

# Approval prompts are reviewed by the user.
allowed_approvals_reviewers = ["user"]
allowed_approval_policies = [
  { granular = { sandbox_approval = false, rules = true, mcp_elicitations = false, request_permissions = false, skill_approval = true } },
]

# Allow cached search only if your AWS GovCloud Region supports web search.
allowed_web_search_modes = ["disabled", "cached"]

# Block agent browser use and native-app control.
allow_browser_and_computer_use = false

# Appshots: https://learn.chatgpt.com/docs/appshots
allow_appshots = false

# Remote control: https://learn.chatgpt.com/docs/remote-connections#pick-up-work-from-another-device
allow_remote_control = false

# Managed hooks: https://learn.chatgpt.com/docs/enterprise/managed-configuration#enforce-managed-hooks-from-requirements
allow_managed_hooks_only = true

check_for_update_on_startup = false

# MCP servers, apps, and plugins are disabled by default.
# Admins can enable supported integrations after accepting the risks
# for their use case and configuring access and network controls.
# https://learn.chatgpt.com/docs/enterprise/managed-configuration
mcp_servers = {}

[features]
apps = false
enable_mcp_apps = false
plugins = false

# Enable the network proxy for sandboxed commands.
# https://learn.chatgpt.com/docs/agent-approvals-security#network-isolation
network_proxy = true

in_app_dictation = false
realtime_conversation = false

# Browser controls: https://learn.chatgpt.com/docs/enterprise/managed-configuration#disable-codex-feature-surfaces
# Note that both browser use and computer use are up to your organization's risk appetite.
# An agent using your browser or computer may navigate to any websites or applications that the
# computer has access to. OpenAI does not currently provide additional protections restricting
# the network paths that browser use and computer use may exercise.
in_app_browser = false
browser_use = false
browser_use_external = false
browser_use_full_cdp_access = false

# Computer Use: https://learn.chatgpt.com/docs/computer-use
# Enable after accepting the risks and configuring app and network access.
computer_use = false

# Set to true to let users update through the app.
# App-store, package-manager, and MDM updates are controlled separately.
# https://learn.chatgpt.com/docs/enterprise/manage-app-updates#turn-off-in-app-updates
in_app_updates = false

image_generation = false

# Memories: https://learn.chatgpt.com/docs/customization/memories
memories = false

# Computer History: https://learn.chatgpt.com/docs/customization/computer-history
chronicle = false

external_agent_memory_import = false

# We recommend that users review approval requests themselves.
# Admins can enable automatic review after accepting the risks for their use case.
# https://learn.chatgpt.com/docs/agent-approvals-security#automatic-approval-reviews
guardian_approval = false
guardianv2 = false

# Disable background skill-search experiments.
skill_search = false

# Hooks: https://learn.chatgpt.com/docs/hooks
hooks = false

# If you enable web search, use cached search through Bedrock Mantle
# where supported by your AWS GovCloud Region.
standalone_web_search = false

# Disable feedback submissions to OpenAI.
[feedback]
enabled = false

# Network controls for agent commands:
# https://learn.chatgpt.com/docs/enterprise/managed-configuration#configure-network-access-requirements
[experimental_network]
enabled = true
managed_allowed_domains_only = true

# No domains allowed by default. Add destinations approved for your use case.
domains = {}

# Add approved Unix socket paths here.
unix_sockets = {}

# Set to true when using an organization-approved upstream proxy.
allow_upstream_proxy = false

# Keep the command proxy bound to localhost.
dangerously_allow_non_loopback_proxy = false
dangerously_allow_all_unix_sockets = false

# Local/private networking: https://learn.chatgpt.com/docs/agent-approvals-security#local-and-private-destinations
allow_local_binding = false

# App network controls: https://learn.chatgpt.com/docs/enterprise/managed-configuration#control-desktop-app-network-destinations
[application.network]
enabled = true

# Example: Bedrock Mantle in us-gov-west-1.
# Replace this hostname with the Bedrock endpoint configured in config.toml.
[application.network.domains]
"bedrock-mantle.us-gov-west-1.api.aws" = "allow"

# OpenAI and ChatGPT endpoints.
# We recommend denying these endpoints to avoid any risk that user data is sent to commercial OpenAI infrastructure.
"api.openai.com" = "deny"
"chat.openai.com" = "deny"
"chatgpt.com" = "deny"
"ab.chatgpt.com" = "deny"
"platform.openai.com" = "deny"
"auth.openai.com" = "deny"
"gov.api.openai.com" = "deny"
"gov.chatgpt.com" = "deny"
"sdfedpreastus2.oaiusercontent.com" = "deny"
"o33249.ingest.us.sentry.io" = "deny"
"persistent.oaistatic.com" = "deny"
"oaisidekickupdates.blob.core.windows.net" = "deny"

# Windows only: https://learn.chatgpt.com/docs/config-file/config-reference#requirementstoml
[windows]
allowed_sandbox_implementations = ["elevated"]

2. 配置提供商路由和网络控制

在 config.toml 或托管默认设置中设置提供商、模型、区域和端点。用户可以在 requirements.toml 设定的限制范围内更改这些默认设置。

建议的 config.toml

以下示例使用 us-gov-west-1 区域中的 Mantle。请将模型 ID 和 AWS 配置档案替换为你的部署所用的值。如果使用其他受支持的区域或端点,请同时更新 URL、区域和网络策略。

此示例关闭了可选的诊断和数据共享功能。请勿将 AWS 凭证存放在 TOML 文件中。请将 AWS 配置档案、凭证和凭证辅助脚本存放在 Codex 无法修改的文件夹中。

config.toml

# Replace with your approved Bedrock model ID.
model = "openai.gpt-5.6-terra"
model_provider = "amazon-bedrock"
approval_policy = { granular = { sandbox_approval = false, rules = true, mcp_elicitations = false, request_permissions = false, skill_approval = true } }
sandbox_mode = "workspace-write"

# Set to "cached" only when supported by your model and GovCloud Region
# and approved for your deployment.
# https://docs.aws.amazon.com/bedrock/latest/userguide/web-search.html
web_search = "disabled"

# Example: Bedrock Mantle in us-gov-west-1.
[model_providers.amazon-bedrock]
base_url = "https://bedrock-mantle.us-gov-west-1.api.aws/openai/v1"
wire_api = "responses"
requires_openai_auth = false

[model_providers.amazon-bedrock.aws]
region = "us-gov-west-1"

# Replace with your AWS profile name.
profile = "codex-govcloud"

[sandbox_workspace_write]
# Command destinations are controlled by requirements.toml.
network_access = true

# Disable sending Codex usage analytics to OpenAI.
[analytics]
enabled = false

# OpenTelemetry exports are off by default.
# Admins can configure an approved collector for logs, traces, and metrics.
# https://learn.chatgpt.com/docs/config-file/config-advanced#observability-and-telemetry
[otel]
exporter = "none"
trace_exporter = "none"
metrics_exporter = "none"
log_user_prompt = false

此示例使用 AWS 凭证访问 Bedrock Mantle。如果使用 Bedrock Runtime 或网关,请按照提供商设置说明操作。

应用网络控制

将获批的应用目标地址(包括 Bedrock)添加到 application.network.domains。将获批的命令目标地址添加到 experimental_network.domains。

Codex 的网络设置不能替代设备防火墙。

3. 验证部署

  1. 确认策略已生效,且 Codex 正在使用预期的 AWS 凭证和 Bedrock 设置。
  2. 使用示例数据运行获批的工作流。
  3. 确认用户设置无法覆盖托管限制。
  4. 测试凭证无效或过期以及路由失败的情况。确认内容不会发送到未经批准的目标地址。

常见问题排查

问题 检查内容
不支持的端点 向 OpenAI 确认已安装的桌面应用和 app-server 版本是否支持该端点和模型。
AWS 账户或角色错误 检查当前生效的凭证和所选的 AWS 配置档案。Bedrock API key 的优先级可能高于配置文件。
限制未生效 确认运行 Codex 的计算机已加载预期的 requirements.toml。
功能仍不可用 查看功能文档,了解所需设置和 Bedrock 支持情况,然后检查网络控制。

功能设置

用户无法覆盖由 requirements.toml 强制实施的功能设置。

下表汇总了上述配置。开启 表示在受支持的情况下允许使用;其他权限和网络控制仍然适用。

有关提供商支持情况,请参阅 Bedrock 功能可用性。

功能 默认状态 备注
本地编码、文件、Git 和子智能体 开启 —
本地定时任务 开启 —
浏览器 关闭 包括内置浏览器、已连接的浏览器、智能体浏览器控制和开发者模式。
计算机使用和 Appshots 关闭 —
记忆和计算机历史记录 关闭 —
图像生成 关闭 不会阻止图像输入或读取现有图像文件。
网络搜索 关闭 缓存搜索需要模型和 GovCloud 区域支持。命令网络规则不会限制托管搜索。
应用和插件 关闭 —
已配置的 MCP 服务器 关闭 管理员接受其使用场景的相关风险并配置访问和网络控制后,可以启用获批的服务器。
交互式 MCP 应用 关闭 —
听写 关闭 —
自动审批审核 关闭 —
远程控制 关闭 SSH 连接单独管理。
应用更新 关闭 —

启用智能体浏览器使用或计算机使用功能还需要设置 allow_browser_and_computer_use = true。