keenable

package
v0.2.90 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package keenable provides a web search tool backed by the Keenable Search API.

Search queries are sent to Keenable, a third-party service. The tool works without an API key: requests then go to Keenable's keyless public endpoint, which allows 1,000 requests per hour per IP address, shared by everything calling from that IP. Pass a key (for example from KEENABLE_API_KEY) to use the keyed endpoint, which lifts the hourly cap and is billed in Keenable credits.

It is a drop-in alternative to the Google Custom Search based websearch tool: it uses the same tool name ("web_search"), the same parameters (query, num_results) and the same plain-text result format, so register one or the other.

Index

Constants

View Source
const (
	// DefaultBaseURL is the Keenable API base URL.
	DefaultBaseURL = "https://api.keenable.ai"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Tool)

Option configures the tool.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the API base URL (useful for tests or proxies).

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient sets the HTTP client used for requests.

func WithName

func WithName(name string) Option

WithName overrides the tool name. The default is "web_search".

func WithTitle

func WithTitle(title string) Option

WithTitle sets the X-Keenable-Title header that identifies the calling app on keyless requests. The default is "agent-sdk-go".

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

Tool implements a web search tool using Keenable.

func New

func New(apiKey string, options ...Option) *Tool

New creates a Keenable search tool. apiKey may be empty to use the keyless public endpoint.

func (*Tool) Description

func (t *Tool) Description() string

Description returns a description of what the tool does.

func (*Tool) DisplayName

func (t *Tool) DisplayName() string

DisplayName implements interfaces.ToolWithDisplayName.

func (*Tool) Execute

func (t *Tool) Execute(ctx context.Context, args string) (string, error)

Execute runs the tool with JSON arguments.

func (*Tool) Internal

func (t *Tool) Internal() bool

Internal implements interfaces.InternalTool.

func (*Tool) Name

func (t *Tool) Name() string

Name returns the name of the tool.

func (*Tool) Parameters

func (t *Tool) Parameters() map[string]interfaces.ParameterSpec

Parameters returns the parameters that the tool accepts.

func (*Tool) Run

func (t *Tool) Run(ctx context.Context, input string) (string, error)

Run executes a search. input is either JSON ({"query": ..., "num_results": N}) or a plain query string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL