Documentation
¶
Overview ¶
Package agents is the single source of truth for the agent CLIs PANDA can delegate to. It maps each agent's registry key to its adapter script, the binary names to probe on PATH, install/update guidance (download link + install command), and the agent's credential manifest (which env vars and config files prove the agent brings its own model, and how PANDA's model config maps onto the agent's env contract). The CLI (`panda agents`), the capability-card generator (`panda detect`), the web settings API (webui/panel), the commander's availability probe, and the commander's credential probe/injection all read from here instead of each hardcoding their own table, so adding an agent (with credentials) is a single-entry change.
Index ¶
Constants ¶
const TierAutoApproved = defense.TierReversible
TierAutoApproved is the tier a generated capability card declares for an agent. It equals defense.TierReversible on purpose: delegating to an agent is the product's purpose, so a detected node runs unattended. An operator who wants an agent to ask before it acts declares `tier: 2` on that agent in capabilities.yaml, and commander.Route lets that declaration win.
It is bound to the defense constant rather than written as 1 so the two cannot drift: carddetect used to write a literal 2 here, which silently contradicted commander.Route's documented "undeclared defaults to 1" and parked every agent task in review on every detected node.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶ added in v0.0.7
type Capabilities struct {
// SupportsSkills means the agent has a native skill/library concept
// reachable when the tool whitelist is lifted (extended policy).
SupportsSkills bool
// SupportsMCP means the agent auto-discovers project-level MCP
// servers (.mcp.json in its cwd) when the extended policy writes one.
SupportsMCP bool
// SupportsSubagents means the agent can spawn its own child agents
// (e.g. Claude's Task tool); the orchestration layer records the
// delegation events when the extended policy lifts the whitelist.
SupportsSubagents bool
}
Capabilities describes the native feature surface one agent CLI exposes. Each flag is true when the agent's documented CLI surface includes the corresponding feature; `panda agents` displays them today, and the routing layer / prompt builder are planned to read them instead of hard-coding per-adapter knowledge.
type Known ¶
type Known struct {
// Name is the registry key (also the capability-card agent key), e.g.
// "grok_build". It is stable and used for routing.
Name string
// Adapter is the adapter script under adapters/, e.g. "grok_build.py".
Adapter string
// Binaries are the CLI binary names to probe, in preference order. The
// first one is the canonical probe binary (also the availability probe
// fallback when a card declares no install_check).
Binaries []string
// DisplayName is the human-readable label shown in the CLI/Web UI.
DisplayName string
// InstallHint is a one-line shell command to install/update the CLI.
// Empty when the agent has no public installer (self-hosted/custom CLIs).
InstallHint string
// InstallURL is the documentation or download page. Empty when unknown.
InstallURL string
// InitHint is a one-line command to initialize an installed-but-unconfigured
// agent CLI (e.g. accepting terms, generating project files). Empty when the
// agent needs no initialization beyond installation. `panda agents` and
// `panda detect` surface this when the binary is present but credentials
// or state files are missing, so the operator can distinguish "not installed"
// from "installed but not initialized".
InitHint string
// CredentialEnvVars is the probe side of the agent's credential
// manifest: env var names that prove the agent carries model
// credentials of its own (e.g. claude's ANTHROPIC_API_KEY /
// ANTHROPIC_AUTH_TOKEN). When one is set, the commander leaves the
// agent's native model alone and only forwards these vars through the
// sandbox. Empty means "unknown" — probes fall back to the union of
// common provider keys.
CredentialEnvVars []string
// CredentialFiles lists home-relative files whose presence (non-empty)
// proves the agent is logged in / configured with its own provider —
// e.g. codex stores its auth and provider sections in ~/.codex.
CredentialFiles []string
// CredentialFileFields narrows selected CredentialFiles to the JSON
// fields whose (non-empty) presence marks real credentials. A file
// listed here counts only when at least one named field is set — some
// agents keep a state file that exists long before any login (Claude
// Code writes ~/.claude.json on first run), and treating its mere
// existence as credentials would wrongly disable model injection.
CredentialFileFields map[string][]string
// ModelEnv is the injection side of the credential manifest: the env
// vars the agent CLI reads for its model endpoint. Nil means model
// injection is not safely supported for this agent (its env contract
// is ambiguous or it always brings its own key), so PANDA never
// overrides its endpoint.
ModelEnv *ModelEnvMapping
// Capabilities declares what the agent's CLI natively supports.
// `panda agents` displays these flags today; the routing layer and
// prompt builder are planned to read them instead of each hard-coding
// per-adapter knowledge. An agent that supports Skills can reach its
// native skill library when the tools policy is extended; an agent
// that supports MCP can discover project .mcp.json servers; an agent
// that supports Subagents can delegate work to its own child agents.
Capabilities Capabilities
// SelfContainedModel is true when the agent ships with its own built-in
// free or local model provider (e.g. OpenCode's opencode/deepseek-v4-flash-free),
// requiring no external API keys or configuration to be viable.
SelfContainedModel bool
// DefaultCapabilities are the task capabilities this agent provides when
// generating capability cards (panda detect).
DefaultCapabilities []string
// DefaultBestAt are the specialized task tags this agent excels at.
DefaultBestAt []string
// DefaultCostTier is the routing cost tier ("low", "low_medium", "medium", "medium_high", "high").
DefaultCostTier string
// DefaultTier is the capability tier written into a generated card.
// It is TierAutoApproved: delegating to an agent is what the product is
// for, so a detected node must run unattended. An operator who wants an
// agent to ask first sets `tier: 2` on it in capabilities.yaml, and that
// declaration still wins in commander.Route.
DefaultTier int
}
Known describes one agent CLI PANDA recognises. It is deliberately static data with no I/O: probes, adapter names and guidance are derived from it by the consumers that need them.
func ByAdapter ¶
ByAdapter returns the agent whose adapter script is adapter, or ok=false. Used by the commander to derive a probe binary when a card declares no install_check.
func Registry ¶
func Registry() []Known
Registry returns every known agent in deterministic (name-sorted) order. The slice is a copy, so callers may reorder or filter freely.
func (Known) PrimaryBinary ¶
PrimaryBinary returns the canonical CLI binary to probe, or "" if none.
type ModelEnvMapping ¶ added in v0.0.4
type ModelEnvMapping struct {
APIType string // protocol required: "anthropic" | "openai" (empty matches any)
BaseURL string // env var carrying the provider base URL, e.g. ANTHROPIC_BASE_URL / OPENAI_BASE_URL
APIKey string // env var carrying the API key, e.g. ANTHROPIC_API_KEY / OPENAI_API_KEY
Model string // env var carrying the model name, e.g. ANTHROPIC_MODEL / OPENAI_MODEL
}
ModelEnvMapping names the env vars one agent CLI reads for its model endpoint. It is data, not code: the commander translates its model config through the mapping, so a new agent in the registry gets credential probing and (when a mapping is declared) injection without any commander change.