mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
feat(subturn): support stateful iteration for evaluator-optimizer pattern
Add ActualSystemPrompt and InitialMessages fields to SubTurnConfig to enable stateful worker context passing across multiple evaluation iterations. Changes: - Add ActualSystemPrompt field to separate system role from user task description - Add InitialMessages field to preload ephemeral session history before agent loop starts - Add Messages field to ToolResult for carrying session history (internal use, not serialized) - Update runTurn to inject system prompt and preload history from InitialMessages - Update AgentLoopSpawner to map new fields from tools.SubTurnConfig to agent.SubTurnConfig This enables the evaluator-optimizer execution strategy in team tool to maintain worker context across iterations while keeping SubTurn isolation intact.
This commit is contained in:
+10
-1
@@ -1,6 +1,10 @@
|
||||
package tools
|
||||
|
||||
import "encoding/json"
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/sipeed/picoclaw/pkg/providers"
|
||||
)
|
||||
|
||||
// ToolResult represents the structured return value from tool execution.
|
||||
// It provides clear semantics for different types of results and supports
|
||||
@@ -34,6 +38,11 @@ type ToolResult struct {
|
||||
// Media contains media store refs produced by this tool.
|
||||
// When non-empty, the agent will publish these as OutboundMediaMessage.
|
||||
Media []string `json:"media,omitempty"`
|
||||
|
||||
// Messages holds the ephemeral session history after execution.
|
||||
// Only populated by SubTurn executions; used by evaluator_optimizer
|
||||
// to carry stateful worker context across evaluation iterations.
|
||||
Messages []providers.Message `json:"-"`
|
||||
}
|
||||
|
||||
// NewToolResult creates a basic ToolResult with content for the LLM.
|
||||
|
||||
Reference in New Issue
Block a user