Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type Error
- type SessionActParams
- type SessionActResponse
- type SessionEndParams
- type SessionEndResponse
- type SessionExecuteAgentParams
- type SessionExecuteAgentResponse
- type SessionExtractParams
- type SessionExtractResponse
- type SessionNavigateParams
- type SessionNavigateResponse
- type SessionObserveParams
- type SessionObserveResponse
- type SessionService
- func (r *SessionService) Act(ctx context.Context, id any, params SessionActParams, ...) (res *SessionActResponse, err error)
- func (r *SessionService) End(ctx context.Context, id any, body SessionEndParams, ...) (res *SessionEndResponse, err error)
- func (r *SessionService) ExecuteAgent(ctx context.Context, id any, params SessionExecuteAgentParams, ...) (res *SessionExecuteAgentResponse, err error)
- func (r *SessionService) Extract(ctx context.Context, id any, params SessionExtractParams, ...) (res *SessionExtractResponse, err error)
- func (r *SessionService) Navigate(ctx context.Context, id any, params SessionNavigateParams, ...) (res *SessionNavigateResponse, err error)
- func (r *SessionService) Observe(ctx context.Context, id any, params SessionObserveParams, ...) (res *SessionObserveResponse, err error)
- func (r *SessionService) Start(ctx context.Context, params SessionStartParams, opts ...option.RequestOption) (res *SessionStartResponse, err error)
- type SessionStartParams
- type SessionStartResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (BROWSERBASE_API_KEY, MODEL_API_KEY, BROWSERBASE_PROJECT_ID, STAGEHAND_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type Client ¶
type Client struct {
Options []option.RequestOption
Sessions SessionService
}
Client creates a struct with services and top level methods that help with interacting with the stagehand API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (BROWSERBASE_API_KEY, MODEL_API_KEY, BROWSERBASE_PROJECT_ID, STAGEHAND_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned [url.Values] will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type SessionActParams ¶
type SessionActParams struct {
Body any
XLanguage any `header:"x-language,omitzero" json:"-"`
XSDKVersion any `header:"x-sdk-version,omitzero" json:"-"`
XSentAt any `header:"x-sent-at,omitzero" json:"-"`
XStreamResponse any `header:"x-stream-response,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (SessionActParams) MarshalJSON ¶
func (r SessionActParams) MarshalJSON() (data []byte, err error)
func (*SessionActParams) UnmarshalJSON ¶
func (r *SessionActParams) UnmarshalJSON(data []byte) error
type SessionActResponse ¶
type SessionActResponse = any
type SessionEndParams ¶ added in v0.5.0
type SessionEndParams struct {
XLanguage any `header:"x-language,omitzero" json:"-"`
XSDKVersion any `header:"x-sdk-version,omitzero" json:"-"`
XSentAt any `header:"x-sent-at,omitzero" json:"-"`
XStreamResponse any `header:"x-stream-response,omitzero" json:"-"`
// contains filtered or unexported fields
}
type SessionEndResponse ¶
type SessionEndResponse = any
type SessionExecuteAgentParams ¶
type SessionExecuteAgentParams struct {
Body any
XLanguage any `header:"x-language,omitzero" json:"-"`
XSDKVersion any `header:"x-sdk-version,omitzero" json:"-"`
XSentAt any `header:"x-sent-at,omitzero" json:"-"`
XStreamResponse any `header:"x-stream-response,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (SessionExecuteAgentParams) MarshalJSON ¶
func (r SessionExecuteAgentParams) MarshalJSON() (data []byte, err error)
func (*SessionExecuteAgentParams) UnmarshalJSON ¶
func (r *SessionExecuteAgentParams) UnmarshalJSON(data []byte) error
type SessionExecuteAgentResponse ¶
type SessionExecuteAgentResponse = any
type SessionExtractParams ¶
type SessionExtractParams struct {
Body any
XLanguage any `header:"x-language,omitzero" json:"-"`
XSDKVersion any `header:"x-sdk-version,omitzero" json:"-"`
XSentAt any `header:"x-sent-at,omitzero" json:"-"`
XStreamResponse any `header:"x-stream-response,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (SessionExtractParams) MarshalJSON ¶
func (r SessionExtractParams) MarshalJSON() (data []byte, err error)
func (*SessionExtractParams) UnmarshalJSON ¶
func (r *SessionExtractParams) UnmarshalJSON(data []byte) error
type SessionExtractResponse ¶ added in v0.5.0
type SessionExtractResponse = any
type SessionNavigateParams ¶
type SessionNavigateParams struct {
// contains filtered or unexported fields
}
func (SessionNavigateParams) MarshalJSON ¶
func (r SessionNavigateParams) MarshalJSON() (data []byte, err error)
func (*SessionNavigateParams) UnmarshalJSON ¶
func (r *SessionNavigateParams) UnmarshalJSON(data []byte) error
type SessionNavigateResponse ¶
type SessionNavigateResponse = any
type SessionObserveParams ¶
type SessionObserveParams struct {
Body any
XLanguage any `header:"x-language,omitzero" json:"-"`
XSDKVersion any `header:"x-sdk-version,omitzero" json:"-"`
XSentAt any `header:"x-sent-at,omitzero" json:"-"`
XStreamResponse any `header:"x-stream-response,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (SessionObserveParams) MarshalJSON ¶
func (r SessionObserveParams) MarshalJSON() (data []byte, err error)
func (*SessionObserveParams) UnmarshalJSON ¶
func (r *SessionObserveParams) UnmarshalJSON(data []byte) error
type SessionObserveResponse ¶ added in v0.5.0
type SessionObserveResponse = any
type SessionService ¶
type SessionService struct {
Options []option.RequestOption
}
SessionService contains methods and other services that help with interacting with the stagehand API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSessionService method instead.
func NewSessionService ¶
func NewSessionService(opts ...option.RequestOption) (r SessionService)
NewSessionService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*SessionService) Act ¶
func (r *SessionService) Act(ctx context.Context, id any, params SessionActParams, opts ...option.RequestOption) (res *SessionActResponse, err error)
Executes a browser action using natural language instructions or a predefined Action object.
func (*SessionService) End ¶
func (r *SessionService) End(ctx context.Context, id any, body SessionEndParams, opts ...option.RequestOption) (res *SessionEndResponse, err error)
Terminates the browser session and releases all associated resources.
func (*SessionService) ExecuteAgent ¶
func (r *SessionService) ExecuteAgent(ctx context.Context, id any, params SessionExecuteAgentParams, opts ...option.RequestOption) (res *SessionExecuteAgentResponse, err error)
Runs an autonomous AI agent that can perform complex multi-step browser tasks.
func (*SessionService) Extract ¶
func (r *SessionService) Extract(ctx context.Context, id any, params SessionExtractParams, opts ...option.RequestOption) (res *SessionExtractResponse, err error)
Extracts structured data from the current page using AI-powered analysis.
func (*SessionService) Navigate ¶
func (r *SessionService) Navigate(ctx context.Context, id any, params SessionNavigateParams, opts ...option.RequestOption) (res *SessionNavigateResponse, err error)
Navigates the browser to the specified URL.
func (*SessionService) Observe ¶
func (r *SessionService) Observe(ctx context.Context, id any, params SessionObserveParams, opts ...option.RequestOption) (res *SessionObserveResponse, err error)
Identifies and returns available actions on the current page that match the given instruction.
func (*SessionService) Start ¶
func (r *SessionService) Start(ctx context.Context, params SessionStartParams, opts ...option.RequestOption) (res *SessionStartResponse, err error)
Creates a new browser session with the specified configuration. Returns a session ID used for all subsequent operations.
type SessionStartParams ¶
type SessionStartParams struct {
Body any
XLanguage any `header:"x-language,omitzero" json:"-"`
XSDKVersion any `header:"x-sdk-version,omitzero" json:"-"`
XSentAt any `header:"x-sent-at,omitzero" json:"-"`
XStreamResponse any `header:"x-stream-response,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (SessionStartParams) MarshalJSON ¶
func (r SessionStartParams) MarshalJSON() (data []byte, err error)
func (*SessionStartParams) UnmarshalJSON ¶
func (r *SessionStartParams) UnmarshalJSON(data []byte) error
type SessionStartResponse ¶
type SessionStartResponse = any
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|
|
shared
|
|