agent

package
v0.3.16 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ACPCommand added in v0.2.0

func ACPCommand(agents []agentkit.Agent, store agentkit.SessionStore) agentkit.Command

ACPCommand exposes ACP session config control for agent/acp-remote agents.

func Command added in v0.1.6

func Command(agents []agentkit.Agent, store agentkit.SessionStore, defaultAgent agentkit.AgentID, ws workspace.Service) agentkit.Command

Command exposes the agent catalog and session or global agent switching.

func EncodeEventData

func EncodeEventData(v any) json.RawMessage

func HelpCommand added in v0.1.2

func HelpCommand(agents []agentkit.Agent) agentkit.Command

HelpCommand exposes the agent catalog help slash command for built agent instances.

func ModelCommand added in v0.3.16

func ModelCommand(agents []agentkit.Agent, store agentkit.SessionStore, defaultAgent agentkit.AgentID, ws workspace.Service) agentkit.Command

ModelCommand shows or sets the session or global LLM model override for coding agents.

func New

func New(cfg Config, deps Deps) (agentkit.Agent, error)

New registers agent/coding: Default coding agent: runs one turn against session, LLM, tools and prompt.

Best practices:

  • budget.maxContinuations defaults to 0, i.e. one segment: an agent stays request/response until you raise it.
  • budget.softRatio (default 0.8) marks the point where a turn-stopping hook should wrap up rather than start new work.
  • An interrupted turn is repaired on the next turn, so a crash mid-tool-call does not leave the session unusable.

func NewCatalogCommands added in v0.3.1

NewCatalogCommands registers agent/catalog-commands: /agent and /acp slash commands for the loop catalog.

Types

type BudgetConfig

type BudgetConfig struct {
	MaxTotalSteps    int     `json:"maxTotalSteps"`
	MaxContinuations int     `json:"maxContinuations"`
	WallClockSeconds int     `json:"wallClockSeconds"`
	MaxTotalTokens   int     `json:"maxTotalTokens"`
	SoftRatio        float64 `json:"softRatio"`
}

BudgetConfig bounds one autonomous turn. Every dimension is optional; zero means unlimited for that dimension. MaxContinuations defaults to 0, so an agent without explicit budget config behaves exactly as before: one segment, capped by MaxSteps.

type CatalogCommandsConfig added in v0.3.1

type CatalogCommandsConfig struct{}

type CatalogCommandsDeps added in v0.3.1

type CatalogCommandsDeps struct {
	Loop         agentkit.AgentCatalogLoop `json:"loop"`
	SessionStore agentkit.SessionStore     `json:"sessionStore"`
	Workspace    workspace.Service         `json:"workspace"`
}

type Config

type Config struct {
	// ID is agent id, referenced by loop.defaultAgent.
	ID agentkit.AgentID `json:"id"`
	// Model is model name passed to the LLM provider.
	Model string `json:"model"`
	// MaxSteps is steps allowed in one segment.
	MaxSteps int `json:"maxSteps"`
	// Retry is per-step retry for transient provider failures.
	Retry *RetryConfig `json:"retry,omitempty"`
	// Budget is hard bounds for a whole turn including its continuations. No hook can extend a turn past these.
	Budget *BudgetConfig `json:"budget,omitempty"`
}

type Deps

type Deps struct {
	SessionStore agentkit.SessionStore    `json:"sessionStore"`
	LLM          agentkit.LLMProvider     `json:"llm"`
	Tools        agentkit.ToolRuntime     `json:"tools"`
	Prompt       agentkit.PromptAssembler `json:"prompt"`
	Policies     []agentkit.Policy        `json:"policies,omitempty"`
	Hooks        agentkit.HookRuntime     `json:"hooks,omitempty"`
	Compaction   []compaction.Service     `json:"compaction,omitempty"`
	Workspace    workspace.Service        `json:"workspace,omitempty"`
}

type RetryConfig

type RetryConfig struct {
	Enabled     *bool `json:"enabled"`
	MaxRetries  int   `json:"maxRetries"`
	BaseDelayMs int   `json:"baseDelayMs"`
}

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

func (*Runtime) AgentCatalogEntry added in v0.1.5

func (a *Runtime) AgentCatalogEntry() string

func (*Runtime) ConfiguredModel added in v0.3.16

func (a *Runtime) ConfiguredModel() string

ConfiguredModel returns the model from agent config (before session override).

func (*Runtime) ID

func (a *Runtime) ID() agentkit.AgentID

func (*Runtime) RunTurn

func (a *Runtime) RunTurn(ctx context.Context, input agentkit.TurnInput) (runErr error)

func (*Runtime) SessionStore added in v0.1.6

func (a *Runtime) SessionStore() agentkit.SessionStore

SessionStore returns the durable session backend used for turn history.

Jump to

Keyboard shortcuts

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