From 3dd7da0b159d55009b56b91d58a2eb3024a215e1 Mon Sep 17 00:00:00 2001 From: elipitc Date: Fri, 5 Jun 2026 00:18:21 +0800 Subject: [PATCH] Document agent access token envs in templates --- template_manager.py | 9 ++++++++- tests/test_template_agent_contract.py | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/template_manager.py b/template_manager.py index 4f72c8a..6df24dd 100644 --- a/template_manager.py +++ b/template_manager.py @@ -132,7 +132,12 @@ DEFAULT_TEMPLATES = { "image": "agnettaiji.azurecr.io/ai-agents/a2a-litellm-agent:latest", "port": 8000, "agent_framework": "a2a", - "env_requirements": {}, + "env_requirements": { + "optional": { + "AGENT_ACCESS_TOKEN": "客户端访问令牌;若设置,A2A 请求必须携带 X-Agent-Access-Token", + "HEICODE_AGENT_ID": "上层系统分配的 agent_id,用于 health / agent card 暴露与联调排查", + } + }, }, "coding_a2a_agent": { "display_name": "Coding A2A Agent", @@ -153,6 +158,8 @@ DEFAULT_TEMPLATES = { "AGENT_ROLE_NAME": "启动时指定角色名称,例如 backend / reviewer / planner", "AGENT_INSTRUCTION_TEXT": "启动时注入的角色/行为说明文本,支持类似 AGENTS.md / claude.md 内容", "AGENT_INSTRUCTION_FILE": "启动时读取的角色说明文件路径,内容会并入系统提示词", + "AGENT_ACCESS_TOKEN": "客户端访问令牌;若设置,A2A 请求必须携带 X-Agent-Access-Token", + "HEICODE_AGENT_ID": "上层系统分配的 agent_id,用于 health / agent card 暴露与联调排查", "SERVICE_PORT": "服务端口,默认 8000", }, }, diff --git a/tests/test_template_agent_contract.py b/tests/test_template_agent_contract.py index c9afa3f..a5e9bf4 100644 --- a/tests/test_template_agent_contract.py +++ b/tests/test_template_agent_contract.py @@ -106,3 +106,13 @@ def test_dedicated_template_agent_contract_doc_exists(): assert "POST /agents/{agent_name}/stop" in doc_source assert "DELETE /agents/{agent_name}" in doc_source assert "X-Agent-Access-Token" in doc_source + + +def test_template_manager_exposes_agent_access_token_envs(): + """Template definitions should advertise the HM access-token envs explicitly.""" + template_source = _read("template_manager.py") + + assert '"a2a_litellm_agent": {' in template_source + assert '"coding_a2a_agent": {' in template_source + assert '"AGENT_ACCESS_TOKEN": "客户端访问令牌;若设置,A2A 请求必须携带 X-Agent-Access-Token"' in template_source + assert '"HEICODE_AGENT_ID": "上层系统分配的 agent_id,用于 health / agent card 暴露与联调排查"' in template_source