diff --git a/internal/runtime/executor/claude_executor.go b/internal/runtime/executor/claude_executor.go index 3dd4ca5e2d..a87e5ce29b 100644 --- a/internal/runtime/executor/claude_executor.go +++ b/internal/runtime/executor/claude_executor.go @@ -1266,6 +1266,12 @@ func checkSystemInstructionsWithMode(payload []byte, strictMode bool) []byte { } return true }) + } else if system.Type == gjson.String && system.String() != "" { + // The Anthropic API allows "system" to be a plain string as well as an array + // of content blocks. Convert the string into a content block so it is preserved. +partJSON := `{"type":"text","cache_control":{"type":"ephemeral"}}` +partJSON, _ = sjson.Set(partJSON, "text", system.String()) + result += "," + partJSON } result += "]"