> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qoder.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取 Effective Config

> 获取 Identity + Template 编译后的最终运行时配置。

`GET /api/v1/forward/identities/{identity_id}/templates/{template_id}/effective`

返回 Template 基线叠加 Identity Config 后的有效配置。响应面向运行时执行，不返回 `enabled` 或 `op` 等 Forward DSL 字段。

## 请求头

| Header        | 是否必填 | 说明             |
| ------------- | ---- | -------------- |
| Authorization | 是    | `Bearer <PAT>` |

## 路径参数

| 参数           | 类型     | 是否必填 | 说明                   |
| ------------ | ------ | ---- | -------------------- |
| identity\_id | string | 是    | Forward Identity ID。 |
| template\_id | string | 是    | Forward Template ID。 |

## 示例请求

```bash theme={null}
curl -s -X GET 'https://api.qoder.com/api/v1/forward/identities/idn_019eabc123/templates/tmpl_support/effective' \
  -H "Authorization: Bearer $QODER_PAT"
```

## 示例响应

**HTTP 200 OK**

```json theme={null}
{
  "type": "effective_spec",
  "id": "config_123",
  "identity_id": "idn_019eabc123",
  "template_id": "tmpl_support",
  "agent_effective_hash": "sha256:...",
  "session_effective_hash": "sha256:...",
  "effective_hash": "sha256:...",
  "agent": {
    "model": "ultimate",
    "system": "You are a support assistant.\nPrefer CRM data when answering.",
    "tools": [
      {
        "type": "agent_toolset_20260401",
        "configs": [
          {
            "name": "Read",
            "enabled": true
          },
          {
            "name": "Grep",
            "enabled": true
          },
          {
            "name": "WebSearch",
            "enabled": false
          }
        ]
      }
    ],
    "mcp_servers": [],
    "skills": []
  },
  "session": {
    "environment_id": "env_support",
    "vault_ids": [
      "vault_crm"
    ],
    "resources": [
      {
        "type": "file",
        "file_id": "file_019eXXXX",
        "mount_path": "/data/policy.md"
      }
    ]
  }
}
```

## 响应字段

| 字段                       | 类型     | 说明                    |
| ------------------------ | ------ | --------------------- |
| type                     | string | 固定为 `effective_spec`。 |
| agent\_effective\_hash   | string | Agent 部分编译结果 hash。    |
| session\_effective\_hash | string | Session 部分编译结果 hash。  |
| effective\_hash          | string | 完整有效配置 hash。          |
| agent                    | object | 编译后的 Agent 配置。        |
| session                  | object | 编译后的 Session 默认配置。    |

## 错误

| HTTP | Type                    | Code                      | 触发条件                     |
| ---- | ----------------------- | ------------------------- | ------------------------ |
| 400  | `invalid_request_error` | -                         | Effective Config 无法编译。   |
| 404  | `not_found_error`       | -                         | Identity 或 Template 不存在。 |
| 422  | `invalid_request_error` | -                         | 运行时配置校验失败。               |
| 401  | `authentication_error`  | `authentication_required` | PAT 无效或已过期。              |

## 注意事项

* Identity Config 按字段级合并规则覆盖 Template 基线。
* 没有 Identity Config 时按空覆盖层处理。
* 默认 Memory Store 注入由创建 Session 流程处理。

## 相关

<CardGroup cols={2}>
  <Card title="获取 Identity Config" icon="file-lines" href="/cloud-agents/api/forward/identities/get-config" />

  <Card title="创建 Session" icon="comment" href="/cloud-agents/api/forward/sessions/create" />
</CardGroup>
