agent

package
v0.3.30 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeEventData

func EncodeEventData(v any) json.RawMessage

func IsStepLimitError added in v0.3.30

func IsStepLimitError(err error) bool

IsStepLimitError reports whether err ends a turn due to maxSteps.

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:

  • An interrupted turn is repaired on the next turn, so a crash mid-tool-call does not leave the session unusable.
  • Autonomous continuation belongs in TurnStopping hooks (e.g. hook/turn-continue); per-turn step caps use maxSteps.

func StepLimitUserMessage added in v0.3.30

func StepLimitUserMessage(cap int) string

StepLimitUserMessage is the user-visible notice when maxSteps is reached.

Types

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"`
	// Modalities overrides provider input modalities when set (e.g. vision subagent with modalities: [image]).
	Modalities []string `json:"modalities,omitempty"`
	// Retry is per-step retry for transient provider failures.
	Retry *RetryConfig `json:"retry,omitempty"`
	// MaxSteps caps model steps per turn (all segments). Omitted defaults to 200;
	// explicit 0 disables the cap.
	MaxSteps *int `json:"maxSteps,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

AgentCatalogEntry describes this agent for the /agent catalog command.

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