http

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package http provides an explicitly installed, allowlisted HTTP Tool.

Index

Constants

View Source
const (
	Key = "http_request"
)

Variables

This section is empty.

Functions

func NewModule

func NewModule(config Config) (agentslot.Module, error)

NewModule contributes the Tool explicitly; standard applications do not gain network access merely by importing this package.

Types

type Config

type Config struct {
	AllowedHosts     []string
	AllowedMethods   []string
	AllowHTTP        bool
	FixedHeaders     map[string]string
	Timeout          time.Duration
	MaxRequestBytes  int
	MaxResponseBytes int
	Transport        nethttp.RoundTripper
}

Config fixes the network authority available to the model. Hosts include an explicit port when one is required (for example, api.example.com:8443).

type HTTP

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

func New

func New(config Config) (*HTTP, error)

New validates and constructs one HTTP Tool. It never reads proxy or credential settings from the process environment.

func (*HTTP) Definition

func (h *HTTP) Definition() tool.Definition

func (*HTTP) Invoke

func (h *HTTP) Invoke(ctx context.Context, invocation tool.ToolInvocation) tool.ToolResult

func (*HTTP) ParallelSafety

func (*HTTP) ParallelSafety() tool.ParallelSafety

type Output

type Output struct {
	StatusCode  int    `json:"status_code"`
	ContentType string `json:"content_type,omitempty"`
	Body        string `json:"body"`
	Truncated   bool   `json:"truncated"`
}

Output is the bounded HTTP response returned to the model. A non-2xx status is still a successfully observed HTTP outcome.

Jump to

Keyboard shortcuts

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