Documentation
¶
Overview ¶
Package browser is the browser-use capability: Playwright-driven (or extension-bridged) page automation exposed to the agent as agentdomain.Tool implementations. Playwright is imported only by this package.
Index ¶
- func NewTools(cfg *config.Config, driver browserdomain.BrowserDriver) map[string]agentdomain.Tool
- type BrowserClickTool
- func (t *BrowserClickTool) Definition() sdk.ChatCompletionTool
- func (t *BrowserClickTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
- func (b *BrowserClickTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserClickTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserClickTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
- func (b *BrowserClickTool) IsEnabled() bool
- func (b *BrowserClickTool) ShouldAlwaysExpand() bool
- func (b *BrowserClickTool) ShouldCollapseArg(string) bool
- func (t *BrowserClickTool) Validate(args map[string]any) error
- type BrowserNavigateTool
- func (t *BrowserNavigateTool) Definition() sdk.ChatCompletionTool
- func (t *BrowserNavigateTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
- func (b *BrowserNavigateTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserNavigateTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserNavigateTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
- func (b *BrowserNavigateTool) IsEnabled() bool
- func (b *BrowserNavigateTool) ShouldAlwaysExpand() bool
- func (b *BrowserNavigateTool) ShouldCollapseArg(string) bool
- func (t *BrowserNavigateTool) Validate(args map[string]any) error
- type BrowserReadTool
- func (t *BrowserReadTool) Definition() sdk.ChatCompletionTool
- func (t *BrowserReadTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
- func (b *BrowserReadTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserReadTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserReadTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
- func (b *BrowserReadTool) IsEnabled() bool
- func (b *BrowserReadTool) ShouldAlwaysExpand() bool
- func (b *BrowserReadTool) ShouldCollapseArg(string) bool
- func (t *BrowserReadTool) Validate(args map[string]any) error
- type BrowserScreenshotTool
- func (t *BrowserScreenshotTool) Definition() sdk.ChatCompletionTool
- func (t *BrowserScreenshotTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
- func (b *BrowserScreenshotTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserScreenshotTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserScreenshotTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
- func (b *BrowserScreenshotTool) IsEnabled() bool
- func (b *BrowserScreenshotTool) ShouldAlwaysExpand() bool
- func (b *BrowserScreenshotTool) ShouldCollapseArg(string) bool
- func (t *BrowserScreenshotTool) Validate(map[string]any) error
- type BrowserTabsTool
- func (t *BrowserTabsTool) Definition() sdk.ChatCompletionTool
- func (t *BrowserTabsTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
- func (t *BrowserTabsTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
- func (t *BrowserTabsTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
- func (t *BrowserTabsTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
- func (b *BrowserTabsTool) IsEnabled() bool
- func (b *BrowserTabsTool) ShouldAlwaysExpand() bool
- func (b *BrowserTabsTool) ShouldCollapseArg(string) bool
- func (t *BrowserTabsTool) Validate(map[string]any) error
- type BrowserTypeTool
- func (t *BrowserTypeTool) Definition() sdk.ChatCompletionTool
- func (t *BrowserTypeTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
- func (b *BrowserTypeTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserTypeTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
- func (b *BrowserTypeTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
- func (b *BrowserTypeTool) IsEnabled() bool
- func (b *BrowserTypeTool) ShouldAlwaysExpand() bool
- func (b *BrowserTypeTool) ShouldCollapseArg(string) bool
- func (t *BrowserTypeTool) Validate(args map[string]any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTools ¶
func NewTools(cfg *config.Config, driver browserdomain.BrowserDriver) map[string]agentdomain.Tool
NewTools builds the browser tool set against one shared driver and rate limiter. The caller (the container) owns the driver's lifecycle.
Types ¶
type BrowserClickTool ¶
type BrowserClickTool struct {
// contains filtered or unexported fields
}
BrowserClickTool clicks an element in the shared browser session
func NewBrowserClickTool ¶
func NewBrowserClickTool(cfg *config.Config, rateLimiter rateLimiter, driver browserdomain.BrowserDriver) *BrowserClickTool
NewBrowserClickTool creates a new browser click tool
func (*BrowserClickTool) Definition ¶
func (t *BrowserClickTool) Definition() sdk.ChatCompletionTool
Definition returns the tool definition for the LLM
func (*BrowserClickTool) Execute ¶
func (t *BrowserClickTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
Execute runs the browser click tool with given arguments
func (*BrowserClickTool) FormatForLLM ¶
func (b *BrowserClickTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
FormatForLLM formats the result for LLM consumption
func (*BrowserClickTool) FormatPreview ¶
func (b *BrowserClickTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
FormatPreview returns a short preview of the result for UI display
func (*BrowserClickTool) FormatResult ¶
func (b *BrowserClickTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
FormatResult formats tool execution results for different contexts
func (*BrowserClickTool) IsEnabled ¶
func (b *BrowserClickTool) IsEnabled() bool
IsEnabled returns whether this tool is enabled
func (*BrowserClickTool) ShouldAlwaysExpand ¶
func (b *BrowserClickTool) ShouldAlwaysExpand() bool
ShouldAlwaysExpand determines if tool results should always be expanded in UI
func (*BrowserClickTool) ShouldCollapseArg ¶
ShouldCollapseArg determines if an argument should be collapsed in display
type BrowserNavigateTool ¶
type BrowserNavigateTool struct {
// contains filtered or unexported fields
}
BrowserNavigateTool opens a URL in the shared browser session
func NewBrowserNavigateTool ¶
func NewBrowserNavigateTool(cfg *config.Config, rateLimiter rateLimiter, driver browserdomain.BrowserDriver) *BrowserNavigateTool
NewBrowserNavigateTool creates a new browser navigate tool
func (*BrowserNavigateTool) Definition ¶
func (t *BrowserNavigateTool) Definition() sdk.ChatCompletionTool
Definition returns the tool definition for the LLM
func (*BrowserNavigateTool) Execute ¶
func (t *BrowserNavigateTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
Execute runs the browser navigate tool with given arguments
func (*BrowserNavigateTool) FormatForLLM ¶
func (b *BrowserNavigateTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
FormatForLLM formats the result for LLM consumption
func (*BrowserNavigateTool) FormatPreview ¶
func (b *BrowserNavigateTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
FormatPreview returns a short preview of the result for UI display
func (*BrowserNavigateTool) FormatResult ¶
func (b *BrowserNavigateTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
FormatResult formats tool execution results for different contexts
func (*BrowserNavigateTool) IsEnabled ¶
func (b *BrowserNavigateTool) IsEnabled() bool
IsEnabled returns whether this tool is enabled
func (*BrowserNavigateTool) ShouldAlwaysExpand ¶
func (b *BrowserNavigateTool) ShouldAlwaysExpand() bool
ShouldAlwaysExpand determines if tool results should always be expanded in UI
func (*BrowserNavigateTool) ShouldCollapseArg ¶
ShouldCollapseArg determines if an argument should be collapsed in display
type BrowserReadTool ¶
type BrowserReadTool struct {
// contains filtered or unexported fields
}
BrowserReadTool reads page content from the shared browser session
func NewBrowserReadTool ¶
func NewBrowserReadTool(cfg *config.Config, rateLimiter rateLimiter, driver browserdomain.BrowserDriver) *BrowserReadTool
NewBrowserReadTool creates a new browser read tool
func (*BrowserReadTool) Definition ¶
func (t *BrowserReadTool) Definition() sdk.ChatCompletionTool
Definition returns the tool definition for the LLM
func (*BrowserReadTool) Execute ¶
func (t *BrowserReadTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
Execute runs the browser read tool with given arguments
func (*BrowserReadTool) FormatForLLM ¶
func (b *BrowserReadTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
FormatForLLM formats the result for LLM consumption
func (*BrowserReadTool) FormatPreview ¶
func (b *BrowserReadTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
FormatPreview returns a short preview of the result for UI display
func (*BrowserReadTool) FormatResult ¶
func (b *BrowserReadTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
FormatResult formats tool execution results for different contexts
func (*BrowserReadTool) IsEnabled ¶
func (b *BrowserReadTool) IsEnabled() bool
IsEnabled returns whether this tool is enabled
func (*BrowserReadTool) ShouldAlwaysExpand ¶
func (b *BrowserReadTool) ShouldAlwaysExpand() bool
ShouldAlwaysExpand determines if tool results should always be expanded in UI
func (*BrowserReadTool) ShouldCollapseArg ¶
ShouldCollapseArg determines if an argument should be collapsed in display
type BrowserScreenshotTool ¶
type BrowserScreenshotTool struct {
// contains filtered or unexported fields
}
BrowserScreenshotTool captures the current browser page as an image and attaches it to the conversation (vision models see it inline; others get a file path for ImageDecode).
func NewBrowserScreenshotTool ¶
func NewBrowserScreenshotTool(cfg *config.Config, rateLimiter rateLimiter, driver browserdomain.BrowserDriver) *BrowserScreenshotTool
NewBrowserScreenshotTool creates a new browser screenshot tool
func (*BrowserScreenshotTool) Definition ¶
func (t *BrowserScreenshotTool) Definition() sdk.ChatCompletionTool
Definition returns the tool definition for the LLM
func (*BrowserScreenshotTool) Execute ¶
func (t *BrowserScreenshotTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
Execute captures the screenshot and returns it as an attached image
func (*BrowserScreenshotTool) FormatForLLM ¶
func (b *BrowserScreenshotTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
FormatForLLM formats the result for LLM consumption
func (*BrowserScreenshotTool) FormatPreview ¶
func (b *BrowserScreenshotTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
FormatPreview returns a short preview of the result for UI display
func (*BrowserScreenshotTool) FormatResult ¶
func (b *BrowserScreenshotTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
FormatResult formats tool execution results for different contexts
func (*BrowserScreenshotTool) IsEnabled ¶
func (b *BrowserScreenshotTool) IsEnabled() bool
IsEnabled returns whether this tool is enabled
func (*BrowserScreenshotTool) ShouldAlwaysExpand ¶
func (b *BrowserScreenshotTool) ShouldAlwaysExpand() bool
ShouldAlwaysExpand determines if tool results should always be expanded in UI
func (*BrowserScreenshotTool) ShouldCollapseArg ¶
ShouldCollapseArg determines if an argument should be collapsed in display
type BrowserTabsTool ¶
type BrowserTabsTool struct {
// contains filtered or unexported fields
}
BrowserTabsTool lists the browser's open tabs and marks the active one, so the agent knows what the user is currently looking at.
func NewBrowserTabsTool ¶
func NewBrowserTabsTool(cfg *config.Config, rateLimiter rateLimiter, driver browserdomain.BrowserDriver) *BrowserTabsTool
NewBrowserTabsTool creates a new browser tabs tool
func (*BrowserTabsTool) Definition ¶
func (t *BrowserTabsTool) Definition() sdk.ChatCompletionTool
Definition returns the tool definition for the LLM
func (*BrowserTabsTool) Execute ¶
func (t *BrowserTabsTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
Execute lists the open tabs
func (*BrowserTabsTool) FormatForLLM ¶
func (t *BrowserTabsTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
FormatForLLM formats the tab list for LLM consumption
func (*BrowserTabsTool) FormatPreview ¶
func (t *BrowserTabsTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
FormatPreview returns a short preview of the result for UI display
func (*BrowserTabsTool) FormatResult ¶
func (t *BrowserTabsTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
FormatResult formats tool execution results for different contexts
func (*BrowserTabsTool) IsEnabled ¶
func (b *BrowserTabsTool) IsEnabled() bool
IsEnabled returns whether this tool is enabled
func (*BrowserTabsTool) ShouldAlwaysExpand ¶
func (b *BrowserTabsTool) ShouldAlwaysExpand() bool
ShouldAlwaysExpand determines if tool results should always be expanded in UI
func (*BrowserTabsTool) ShouldCollapseArg ¶
ShouldCollapseArg determines if an argument should be collapsed in display
type BrowserTypeTool ¶
type BrowserTypeTool struct {
// contains filtered or unexported fields
}
BrowserTypeTool types text into an element in the shared browser session
func NewBrowserTypeTool ¶
func NewBrowserTypeTool(cfg *config.Config, rateLimiter rateLimiter, driver browserdomain.BrowserDriver) *BrowserTypeTool
NewBrowserTypeTool creates a new browser type tool
func (*BrowserTypeTool) Definition ¶
func (t *BrowserTypeTool) Definition() sdk.ChatCompletionTool
Definition returns the tool definition for the LLM
func (*BrowserTypeTool) Execute ¶
func (t *BrowserTypeTool) Execute(ctx context.Context, args map[string]any) (*agentdomain.ToolExecutionResult, error)
Execute runs the browser type tool with given arguments
func (*BrowserTypeTool) FormatForLLM ¶
func (b *BrowserTypeTool) FormatForLLM(result *agentdomain.ToolExecutionResult) string
FormatForLLM formats the result for LLM consumption
func (*BrowserTypeTool) FormatPreview ¶
func (b *BrowserTypeTool) FormatPreview(result *agentdomain.ToolExecutionResult) string
FormatPreview returns a short preview of the result for UI display
func (*BrowserTypeTool) FormatResult ¶
func (b *BrowserTypeTool) FormatResult(result *agentdomain.ToolExecutionResult, formatType agentdomain.FormatterType) string
FormatResult formats tool execution results for different contexts
func (*BrowserTypeTool) IsEnabled ¶
func (b *BrowserTypeTool) IsEnabled() bool
IsEnabled returns whether this tool is enabled
func (*BrowserTypeTool) ShouldAlwaysExpand ¶
func (b *BrowserTypeTool) ShouldAlwaysExpand() bool
ShouldAlwaysExpand determines if tool results should always be expanded in UI
func (*BrowserTypeTool) ShouldCollapseArg ¶
ShouldCollapseArg determines if an argument should be collapsed in display
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package domain holds the browser-use bounded context's contracts: the driver interface the tools consume and the wire/result types it produces.
|
Package domain holds the browser-use bounded context's contracts: the driver interface the tools consume and the wire/result types it produces. |