@@ -10,7 +10,6 @@ import (
1010 "github.com/cloudwego/eino-ext/adk/backend/local"
1111 "github.com/cloudwego/eino/adk"
1212 fsmw "github.com/cloudwego/eino/adk/middlewares/filesystem"
13- "github.com/cloudwego/eino/callbacks"
1413 "github.com/go-errors/errors"
1514 einoacp "github.com/strrl/eino-acp"
1615 "github.com/strrl/lapp/pkg/tape"
@@ -107,12 +106,6 @@ func RunAgentWithPrompt(ctx context.Context, config Config, workDir, question, s
107106 attribute .String ("model" , config .Model ),
108107 )
109108
110- if config .TapePath != "" {
111- jsonlStore := tape .NewJSONLStore (config .TapePath )
112- callbacks .AppendGlobalHandlers (tape .NewHandler (jsonlStore ))
113- slog .Info ("Tape recording enabled" , "path" , config .TapePath )
114- }
115-
116109 slog .Info ("Analyzing with ACP provider" , "provider" , provider , "model" , config .Model )
117110
118111 chatModel , err := einoacp .NewChatModel (ctx , & einoacp.Config {
@@ -160,7 +153,13 @@ func RunAgentWithPrompt(ctx context.Context, config Config, workDir, question, s
160153 }
161154
162155 runner := adk .NewRunner (ctx , adk.RunnerConfig {Agent : agent })
163- iter := runner .Query (ctx , userMessage )
156+ var runOptions []adk.AgentRunOption
157+ if config .TapePath != "" {
158+ jsonlStore := tape .NewJSONLStore (config .TapePath )
159+ runOptions = append (runOptions , adk .WithCallbacks (tape .NewHandler (jsonlStore )))
160+ slog .Info ("Tape recording enabled" , "path" , config .TapePath )
161+ }
162+ iter := runner .Query (ctx , userMessage , runOptions ... )
164163
165164 var result strings.Builder
166165 for {
0 commit comments