agent

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ToolRulesPrompt = `` /* 224-byte string literal not displayed */

Variables

This section is empty.

Functions

func BuildSystemPrompt

func BuildSystemPrompt(systemMD, globalMD, localMD, systemPrefix string) string

Types

type AgentSession

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

func NewAgentSession

func NewAgentSession(store *session.Store, sess *session.Session, client provider.ChatClient, registry *tools.Registry, systemPrompt string, maxRounds int, cwd string) *AgentSession

func (*AgentSession) AncestryMessages

func (s *AgentSession) AncestryMessages(turnID string) []message.Message

func (*AgentSession) ContextTokens

func (s *AgentSession) ContextTokens() int

func (*AgentSession) ContextWindow

func (s *AgentSession) ContextWindow() int

func (*AgentSession) Model

func (s *AgentSession) Model() string

func (*AgentSession) Prompt

func (s *AgentSession) Prompt(ctx context.Context, userText string) (<-chan Event, error)

func (*AgentSession) RestoreMessages

func (s *AgentSession) RestoreMessages(turnID string) ([]message.Message, map[string][]message.Message)

func (*AgentSession) Sess

func (s *AgentSession) Sess() *session.Session

func (*AgentSession) SetSubagents

func (s *AgentSession) SetSubagents(defs map[string]*SubagentDef)

func (*AgentSession) SwitchTo

func (s *AgentSession) SwitchTo(turnID string)

func (*AgentSession) SystemPrompt

func (s *AgentSession) SystemPrompt() string

func (*AgentSession) ToolDefs

func (s *AgentSession) ToolDefs() []message.ToolDef

func (*AgentSession) TurnIndex

func (s *AgentSession) TurnIndex() []session.TurnMeta

type Event

type Event struct {
	Type         string          `json:"type"`
	Delta        string          `json:"delta,omitempty"`
	ToolCallID   string          `json:"toolCallId,omitempty"`
	ToolCallName string          `json:"toolCallName,omitempty"`
	ToolCallArgs string          `json:"toolCallArgs,omitempty"`
	ToolResult   string          `json:"toolResult,omitempty"`
	ToolError    string          `json:"toolError,omitempty"`
	ToolDuration string          `json:"toolDuration,omitempty"`
	Error        string          `json:"error,omitempty"`
	FinishReason string          `json:"finishReason,omitempty"`
	Usage        *provider.Usage `json:"usage,omitempty"`
	Subagent     string          `json:"subagent,omitempty"`
	SubagentID   string          `json:"subagentId,omitempty"`
}

type SubagentDef

type SubagentDef struct {
	ID           string
	Description  string
	Client       provider.ChatClient
	Registry     *tools.Registry
	SystemPrompt string
	ModelName    string
}

Jump to

Keyboard shortcuts

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