agent

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command added in v0.1.6

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

Command exposes the agent catalog and session 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 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.

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 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) ID

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

func (*Runtime) RunTurn

func (a *Runtime) RunTurn(ctx context.Context, input agentkit.TurnInput) 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