Documentation
¶
Index ¶
- func EncodeEventData(v any) json.RawMessage
- func IsStepLimitError(err error) bool
- func New(cfg Config, deps Deps) (agentkit.Agent, error)
- func StepLimitUserMessage(cap int) string
- type Config
- type Deps
- type RetryConfig
- type Runtime
- func (a *Runtime) AgentCatalogEntry() string
- func (a *Runtime) ConfiguredModel() string
- func (a *Runtime) EffectiveModel(ctx context.Context) string
- func (a *Runtime) ID() agentkit.AgentID
- func (a *Runtime) RunTurn(ctx context.Context, input agentkit.TurnInput) (runErr error)
- func (a *Runtime) SessionStore() agentkit.SessionStore
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
IsStepLimitError reports whether err ends a turn due to maxSteps.
func New ¶
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
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"`
// MaxPromptTokens is the pre-send guard: when the assembled prompt (system
// prompt + hydrated history, inline media counted at real size) exceeds it,
// force-run compaction once before the LLM call; if it still exceeds, fail
// the step instead of sending a request the provider will reject. 0 disables.
MaxPromptTokens int `json:"maxPromptTokens,omitempty"`
// ToolExecution is how multiple tool calls in one assistant step run together.
// Omitted defaults to parallel (pi agent-loop default).
ToolExecution agentkit.ToolExecutionMode `json:"toolExecution,omitempty"`
}
func (*Config) SetDefaults ¶ added in v0.3.48
func (c *Config) SetDefaults()
SetDefaults implements pluginkit.Defaulter.
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 Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) AgentCatalogEntry ¶ added in v0.1.5
AgentCatalogEntry describes this agent for the /agent catalog command.
func (*Runtime) ConfiguredModel ¶ added in v0.3.16
ConfiguredModel returns the model from agent config (before session override).
func (*Runtime) EffectiveModel ¶ added in v0.3.58
EffectiveModel resolves the model for the session in ctx (session override, then global override, then agent default). Falls back to ConfiguredModel when session id is missing or resolution fails. Used by the loop for trace metadata.
func (*Runtime) SessionStore ¶ added in v0.1.6
func (a *Runtime) SessionStore() agentkit.SessionStore
SessionStore returns the durable session backend used for turn history.