agents

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agents is the ACP agents a user can install from ACP's registry and run as a provider (ADR 0015): the registry, read and kept for an hour; what this machine can run; installing one, when the user chose to; and what is installed, and how to start it.

Index

Constants

View Source
const CacheFor = time.Hour

CacheFor is how long a registry read is used before it is read again.

View Source
const RegistryURL = "https://cdn.agentclientprotocol.com/registry/v1/latest/registry.json"

RegistryURL is ACP's registry of agents.

Variables

View Source
var ErrChanged = errors.New("the registry has another version now")

ErrChanged: the registry's version of the agent is not the one the user was shown.

View Source
var ErrUnknown = errors.New("no such agent in the ACP registry")

ErrUnknown: the registry has no such agent.

Functions

func Platform

func Platform() string

Platform is this machine as the registry names it: darwin-aarch64.

Types

type Agent

type Agent struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Version      string `json:"version"`
	Description  string `json:"description"`
	Distribution struct {
		Npx    *Package          `json:"npx,omitempty"`
		Uvx    *Package          `json:"uvx,omitempty"`
		Binary map[string]Binary `json:"binary,omitempty"`
	} `json:"distribution"`
}

Agent is an agent of the registry.

type Binary

type Binary struct {
	Archive string            `json:"archive"`
	Cmd     string            `json:"cmd"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
	SHA256  string            `json:"sha256"`
}

Binary is a binary distribution for one platform.

type Entry

type Entry struct {
	Agent
	// Installed: the version installed, if any.
	Installed string `json:"installed,omitempty"`
	// Usable: it can be installed and run here; else Reason says why not.
	Usable bool   `json:"usable"`
	Reason string `json:"reason,omitempty"`
	// Source is what installing it fetches: a package, or an archive's URL.
	Source string `json:"source,omitempty"`
}

Entry is an agent as /provider lists it.

type Installed

type Installed struct {
	Version string            `json:"version"`
	Command []string          `json:"command"`
	Env     map[string]string `json:"env,omitempty"`
}

Installed is an agent installed here: how to start it.

type Manager

type Manager struct {
	Dir      string
	Registry string // the registry's URL
	HTTP     *http.Client
	// LookPath finds a command (exec.LookPath; tests change it).
	LookPath func(string) (string, error)
	// contains filtered or unexported fields
}

Manager keeps the agents of a data directory (Dir: <data>/agents).

func New

func New(dir, url string) *Manager

New is a manager of dir, reading the registry at url (RegistryURL for ACP's; "" reads none: only what is installed is there).

func (*Manager) Agents

func (m *Manager) Agents(ctx context.Context) ([]Agent, error)

Agents are the registry's agents, read at most once in CacheFor; when it cannot be read, the copy kept is used.

func (*Manager) Cached

func (m *Manager) Cached() ([]Agent, error)

Cached are the registry's agents as last read, however long ago; an error if it was never read.

func (*Manager) Command

func (m *Manager) Command(id string) (Installed, bool)

Command is how to start installed agent id; ok false if it is not.

func (*Manager) Install

func (m *Manager) Install(ctx context.Context, id, version string) (Installed, error)

Install installs agent id's version of the registry here: the user chose to (ADR 0015), seeing version ("" for whatever the registry has). A binary is checked against its sha256 before anything of it is kept.

func (*Manager) List

func (m *Manager) List(ctx context.Context) ([]Entry, error)

List is the registry's agents, with whether each is installed and can run here.

type Package

type Package struct {
	Package string            `json:"package"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
}

Package is an npx or uvx distribution: a package at a version.

Jump to

Keyboard shortcuts

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