networking

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package networking provides agent-callable tools for making HTTP requests (GET, POST, etc.) to arbitrary URLs with configurable headers, body, and timeout. It enables the agent to fetch APIs and web content when web_search or webfetch are insufficient or when a specific endpoint is needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTool

func NewTool(cfg ...Config) tool.CallableTool

NewTool creates a new http_request tool.

Types

type Config

type Config struct {
	// MaxResponseBytes caps the response body read size. Default 512KB.
	MaxResponseBytes int64 `yaml:"max_response_bytes" toml:"max_response_bytes"`
	// DefaultTimeout in seconds when not specified per-request. Default 30.
	DefaultTimeout int `yaml:"default_timeout" toml:"default_timeout"`
}

Config holds optional configuration for the HTTP tool.

type HTTPRequest

type HTTPRequest struct {
	URL     string            `json:"url"     jsonschema:"description=The URL to send the request to,required"`
	Method  string            `json:"method"  jsonschema:"description=HTTP method: GET POST PUT PATCH DELETE HEAD OPTIONS. Defaults to GET if omitted"`
	Headers map[string]string `json:"headers" jsonschema:"description=Optional HTTP headers as key-value pairs"`
	Body    string            `` /* 129-byte string literal not displayed */
	Timeout int               `json:"timeout" jsonschema:"description=Request timeout in seconds. Defaults to 30. Max 120"`
}

HTTPRequest is the input schema for the http_request tool.

type ToolProvider

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

ToolProvider satisfies the tools.ToolProviders interface for the HTTP networking tool. Without this, the networking tool would need to be constructed inline inside the registry.

func NewToolProvider

func NewToolProvider(cfg ...Config) *ToolProvider

NewToolProvider creates a ToolProvider for the HTTP request tool.

func (*ToolProvider) GetTools

func (p *ToolProvider) GetTools() []tool.Tool

GetTools returns the HTTP networking tool.

Jump to

Keyboard shortcuts

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