aitools

package
v0.7.1 Latest Latest
Warning

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

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

Documentation

Overview

Package aitools exposes AgentProvenance's read surface, the inline policy gate, and the context-write surface as AI-callable tools. It is the single source the provider adapters (Anthropic tool-use, OpenAI function-calling, generic/MCP) are generated from, plus a dispatcher that executes a tool against the local store / policy engine.

Trust boundary (see docs/ai-access.md §0): these tools let a model QUERY the verifiable graph, pre-flight a proposed action, and ASSERT its own app-side context (bind_scope / record_tool_call). They never let the model fabricate system events or signatures: context-write rows are recorded as ai_asserted and execute nothing, and the gate's verdict is computed by the trusted policy engine, not the model. Tool.Writes marks the mutating context-write tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnthropicTools

func AnthropicTools() []map[string]any

AnthropicTools renders the catalog as Anthropic tool-use definitions.

func Dispatch

func Dispatch(db *sql.DB, name string, input map[string]any) (any, error)

Dispatch executes a named tool with the given input.

func GenericTools

func GenericTools() []map[string]any

GenericTools renders a provider-neutral catalog.

func OpenAITools

func OpenAITools() []map[string]any

OpenAITools renders the catalog as OpenAI function-calling definitions.

Types

type Tool

type Tool struct {
	Name        string
	Description string
	InputSchema map[string]any
	// Writes is true for tools that mutate the local store (the context-write
	// surface). Read tools and the no-side-effect gate leave it false. Adapters
	// use this to advertise read-only-ness (e.g. the MCP readOnlyHint).
	Writes bool
	Run    func(db *sql.DB, input map[string]any) (any, error)
}

Tool is one AI-callable operation.

func Catalog

func Catalog() []Tool

Catalog is the canonical AI tool set. Read tools query the verifiable graph; evaluate_action is the inline pre-flight gate.

Jump to

Keyboard shortcuts

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