From bb3eb33e6e24a3392b4d503bb4a8595472e82b14 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Mon, 21 Apr 2025 22:51:30 +0200 Subject: [PATCH] feat: add history metadata of agent browser Signed-off-by: Ettore Di Giacinto --- pkg/localoperator/client.go | 2 ++ services/actions/browseragentrunner.go | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/localoperator/client.go b/pkg/localoperator/client.go index f7df16e..c38b8e0 100644 --- a/pkg/localoperator/client.go +++ b/pkg/localoperator/client.go @@ -33,6 +33,8 @@ type StateDescription struct { CurrentURL string `json:"current_url"` PageTitle string `json:"page_title"` PageContentDescription string `json:"page_content_description"` + Screenshot string `json:"screenshot"` + ScreenshotMimeType string `json:"screenshot_mime_type"` // MIME type of the screenshot (e.g., "image/png") } // StateHistory represents the complete history of states during agent execution diff --git a/services/actions/browseragentrunner.go b/services/actions/browseragentrunner.go index 160b5d5..879c966 100644 --- a/services/actions/browseragentrunner.go +++ b/services/actions/browseragentrunner.go @@ -61,7 +61,8 @@ func (b *BrowserAgentRunner) Run(ctx context.Context, params types.ActionParams) historyStr += fmt.Sprintf(" Description: %s\n\n", stateHistory.States[len(stateHistory.States)-1].PageContentDescription) return types.ActionResult{ - Result: fmt.Sprintf("Browser agent completed successfully. History:\n%s", historyStr), + Result: fmt.Sprintf("Browser agent completed successfully. History:\n%s", historyStr), + Metadata: map[string]interface{}{"browser_agent_history": stateHistory}, }, nil }