agentapi

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package agentapi defines the shared interfaces and types used across the agent, tools, orchestrator, gateway, and cron packages. Centralising them here eliminates interface duplication and the adapter shims that were previously needed to bridge identical-but-separate type definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Announcer

type Announcer interface {
	AnnounceToSession(sessionKey, text string)
}

Announcer delivers async subagent results back to a session's channel.

type Chatter

type Chatter interface {
	Chat(ctx context.Context, sessionKey, message string) (Response, error)
}

Chatter is the minimal interface required to participate in delegation and orchestration. Both *Agent and *CLIAgent satisfy it.

type ConfirmRequest

type ConfirmRequest struct {
	SessionKey string
	Command    string
	Pattern    string // the matched dangerous pattern
	ResultCh   chan bool
}

ConfirmRequest describes a dangerous command that needs user approval.

type Confirmer

type Confirmer interface {
	// RequestConfirm sends a confirmation prompt to the user on the active channel.
	// Returns true if the user confirms, false if denied or timed out.
	RequestConfirm(ctx context.Context, req ConfirmRequest) (bool, error)
}

Confirmer can present a confirmation prompt to the user and return the result.

type Deliverer

type Deliverer interface {
	SendToAllPaired(text string)
}

Deliverer delivers messages to paired users across channels.

type Describer

type Describer interface {
	Description() string
}

Describer is an optional interface that tools can implement to provide a human-readable description. The description is passed to the LLM in the function definition so it can make better tool-selection decisions.

type Response

type Response struct {
	Text    string
	Stopped bool // true if max iterations reached
	Usage   ResponseUsage
}

Response holds the final result of a conversation turn.

type ResponseUsage

type ResponseUsage struct {
	InputTokens  int
	OutputTokens int
}

ResponseUsage holds token usage for a response.

type SessionKeyContextKey

type SessionKeyContextKey struct{}

SessionKeyContextKey is the context key for passing the active session key to tools at execution time.

type Tool

type Tool interface {
	Name() string
	Schema() json.RawMessage
	Run(ctx context.Context, argsJSON string) string
}

Tool is the interface each tool must satisfy.

Jump to

Keyboard shortcuts

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