第22章 Zed Agent Profiles 配置详解
Agent profiles 用于控制 Zed Agent 在会话中的行为。Profile 可以设置默认模型,并选择哪些内置工具和 MCP 工具可用。
Profile 不会自动决定工具调用是否被允许。请使用 Tool Permissions 来控制允许、拒绝或确认的行为。
内置 Profile {#built-in-profiles}
Zed 包含三个内置 Profile:
Write:启用读取、编辑和运行命令的工具。Ask:专注于只读代码库查询。Minimal:不使用任何项目工具。
配置 Profile {#configure-profiles}
在 Agent Panel 中打开 Profile 选择器,然后单击 Configure。
你也可以通过命令面板运行 {#action agent::ManageProfiles}。
在 Profile 对话框中,你可以:
- 创建自定义 Profile
- 分叉现有 Profile
- 配置 Profile 的默认模型
- 配置内置工具
- 配置 MCP 工具
- 删除自定义 Profile
Profile 与设置 {#settings}
Profile 存储在你的设置的 agent.profiles 字段下。
json [settings]
{
"agent": {
"profiles": {
"ask": {
"name": "Ask",
"tools": {
"read_file": true,
"grep": true,
"terminal": false,
"edit_file": false
},
"enable_all_context_servers": false,
"context_servers": {},
"default_model": {
"provider": "zed.dev",
"model": "claude-sonnet-4-5"
}
}
}
}
}
具体的模型 ID 和提供程序 ID 取决于你配置的 LLM Providers。
Profile 与 Tool Permissions {#profiles-vs-tool-permissions}
| 设置项 | 控制内容 | 示例 |
|---|---|---|
| Agent Profile | 工具在 Profile 中是否可用 | 在只读 Profile 中禁用 terminal |
| Tool Permissions | 受权限控制工具调用是被允许、拒绝还是确认 | 始终确认 terminal 命令
|
若工具未在当前配置文件中启用,则 Zed Agent 无法调用该工具。即使工具已启用且受权限控制,工具权限 仍会决定调用该工具时是否需要审批。
Agent 路径边界 {#agent-path-boundaries}
Agent 配置文件仅适用于 Zed Agent。外部 Agent 和 Terminal Threads 不会使用 Zed Agent 的配置文件,除非其集成明确支持类似行为。