agentsessionsd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Overview

Package agentsessionsd is the agentsessionsd server: it serves the Sessions API over TCP. cmd/agentsessionsd calls Main; an in-tree daemon build that hosts more than the stock daemon (tool executors, for one) calls it with Options. The package is internal to this module and is not an API for programs outside it. With -registry-addr it also serves HarnessRegistry on a separate literal-loopback operator listener. The admin API is never registered on the Sessions port; neither listener provides authentication or TLS.

This binary serves the reference echo harness by default and adds the conversational chat harness when -model is set, each on its own filesystem-only local backend. -harness name=address registers a STATELESS_REPLAY harness running elsewhere without rebuilding; it requires -model, so a remote harness's model calls never fall through to the built-in echo stub. A REQUIRES_MEMORY_SNAPSHOT harness needs a backend that owns its sandbox, which means building a server around such a backend. Unknown harnesses are refused rather than substituted.

With -model set it drives a real OpenAI-compatible endpoint; without one it uses the built-in echo model, so the quickstart runs with no key. The API key comes from the environment rather than a flag, because a flag would put the credential in the process list and shell history.

Both listeners are plaintext and unauthenticated; project is a filter, not a tenancy boundary. A local or same-pod process can administer the operator listener. Do not expose it to an untrusted network. See docs/security.md.

Index

Constants

This section is empty.

Variables

View Source
var ErrUsage = errors.New("usage")

ErrUsage wraps a command-line error. Run has already printed the error and the usage, so a main reports it with exit status 2, as flag.ExitOnError would.

Functions

func Main

func Main(opts ...Option)

Main runs the server with os.Args and exits with the conventional status: 0 on success or -h, 2 when a flag cannot be parsed (see Run's ErrUsage), and 1 otherwise, including a configuration error in flags that parsed.

func Run

func Run(args []string, opts ...Option) error

Run parses args (without the program name) and serves until SIGINT or SIGTERM. -h returns flag.ErrHelp. A flag that does not parse wraps ErrUsage. A configuration check after parsing (a -harness with no -model, a -registry-addr that is not a literal loopback address, and the like) returns a plain error, which Main prints and reports with status 1.

Types

type Option

type Option func(*options)

Option configures Run.

func WithToolExecutors

func WithToolExecutors(f ToolExecutorFunc) Option

WithToolExecutors installs host tool executors for CONTROLLER_MEDIATED and approved REQUIRES_APPROVAL tool calls. Without it or -tool-executors no harness has one, and such a call fails the turn. Combining the option and flag is a startup configuration error. Only -harness entries are asked: the built-in harnesses and those registered through HarnessRegistry get no executor.

The executor runs only after the controller's own gate: a REQUIRES_APPROVAL call still parks the turn until an Approve decision, and a denied call never reaches it.

type ToolExecutorFunc

type ToolExecutorFunc func(harness string, sessions *client.Client) (controller.ToolFunc, error)

ToolExecutorFunc returns the host tool executor for the named -harness, or nil for none. sessions is a client of this daemon's own Sessions listener, for an executor that drives other sessions (a tool that runs a turn in a child session, say); it connects on first use. sessions is not usable until Run serves; do not call it while building the executor.

Run asks for every -harness once, at startup, before it opens the journal. An error stops Run with that error, so an executor that cannot be built (bad configuration, say) fails the start instead of failing later on a call that may already have been approved.

Jump to

Keyboard shortcuts

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