From b1794527939ace2236f40a9c9f439341127c156f Mon Sep 17 00:00:00 2001 From: weichen Date: Wed, 7 Oct 2026 14:09:46 +0000 Subject: [PATCH] Add the Background field to subagent requests (N2 WP5) Why: the host factory decides sync vs background spawning; the request must carry the declaration (AgentSpec.Background consumption point, mirroring the product delegate tool's background parameter). Evidence: GOWORK=off go vet + go test green; the delegate_task schema gains the background property. Impact: none for hosts that do not set the field. Refs: Agent-System-Documents#42 (N2 plan WP5) --- runtime/subagent/subagent.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/subagent/subagent.go b/runtime/subagent/subagent.go index 3da9297..0cfe8b1 100644 --- a/runtime/subagent/subagent.go +++ b/runtime/subagent/subagent.go @@ -30,6 +30,9 @@ type Request struct { // Deadline / MaxToolCalls 是宿主注入的预算余量(模型不可自行扩权)。 Deadline time.Time `json:"-"` MaxToolCalls int `json:"-"` + // Background 为真时宿主以后台方式派生(语义同产品 delegate 的 + // background 参数;AgentSpec.Background 声明经宿主写入本字段消费)。 + Background bool `json:"background,omitempty"` } // Result 是子代理的回传:至少包含结论文本;文件由宿主按写范围物化。 @@ -73,7 +76,8 @@ func (t *delegateTool) Parameters() json.RawMessage { "write_scope":{"type":"string"}, "non_goals":{"type":"string"}, "done_criteria":{"type":"string"}, - "deliverables":{"type":"array","items":{"type":"string"}} + "deliverables":{"type":"array","items":{"type":"string"}}, + "background":{"type":"boolean"} }}`) } -- 2.54.0