Documentation
¶
Index ¶
- type Action
- type Agent
- func (c *Agent) AgentState() api.AgentState
- func (c *Agent) CancelCurrentOperation() bool
- func (c *Agent) Close() error
- func (a *Agent) CloseMCPClient() error
- func (c *Agent) DispatchToolCalls(ctx context.Context) error
- func (a *Agent) GetMCPStatusText() string
- func (s *Agent) GetSession() *api.Session
- func (s *Agent) Init(ctx context.Context) error
- func (a *Agent) InitializeMCPClient(ctx context.Context) error
- func (c *Agent) LastErr() error
- func (c *Agent) LoadSession(sessionID string) error
- func (c *Agent) NewSession() (string, error)
- func (c *Agent) Run(ctx context.Context, initialQuery string) error
- func (c *Agent) SaveSession() (string, error)
- func (a *Agent) UpdateMCPStatus(ctx context.Context, mcpClientEnabled bool) error
- type AgentManager
- func (sm *AgentManager) Close() error
- func (sm *AgentManager) DeleteSession(id string) error
- func (sm *AgentManager) FindSessionByID(id string) (*api.Session, error)
- func (sm *AgentManager) GetAgent(ctx context.Context, sessionID string) (*Agent, error)
- func (sm *AgentManager) ListSessions() ([]*api.Session, error)
- func (sm *AgentManager) SetAgentCreatedCallback(cb func(*Agent))
- func (sm *AgentManager) UpdateLastAccessed(session *api.Session) error
- type Factory
- type PromptData
- type ReActResponse
- type ShimCandidate
- type ShimPart
- type ShimResponse
- type ToolCallAnalysis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Agent ¶
type Agent struct {
// Input is the channel to receive user input.
Input chan any
// Output is the channel to send messages to the UI.
Output chan any
// RunOnce indicates if the agent should run only once.
// If true, the agent will run only once and then exit.
// If false, the agent will run in a loop until the context is done.
RunOnce bool
// CloseOutputOnDone closes Output and exits the agent loop when the agent reaches Done.
// This is useful for "one prompt -> multi-step -> stream -> end" workflows that still
// need interactive permission prompts (WaitingForInput).
CloseOutputOnDone bool
// InitialQuery is the initial query to the agent.
// If provided, the agent will run only once and then exit.
InitialQuery string
// HostInfo is an optional, short host/environment summary injected into the
// system prompt (e.g. OS distro, package manager). It MUST NOT contain secrets.
HostInfo string
LLM gollm.Client
// PromptTemplateFile allows specifying a custom template file
PromptTemplateFile string
// ExtraPromptPaths allows specifying additional prompt templates
// to be combined with PromptTemplateFile
ExtraPromptPaths []string
Model string
Provider string
RemoveWorkDir bool
MaxIterations int
// Kubeconfig is the path to the kubeconfig file.
Kubeconfig string
// Sandbox indicates whether to execute tools in a sandbox environment
Sandbox string
// SandboxImage is the container image to use for the sandbox
SandboxImage string
SkipPermissions bool
Tools tools.Tools
EnableToolUseShim bool
// MCPClientEnabled indicates whether MCP client mode is enabled
MCPClientEnabled bool
// Recorder captures events for diagnostics
Recorder journal.Recorder
// Session optionally provides a session to use.
// This is used by the UI to track the state of the agent and the conversation.
Session *api.Session
// ChatMessageStore is the underlying session persistence layer.
ChatMessageStore api.ChatMessageStore
// SessionBackend is the configured backend for session persistence (e.g., memory, filesystem).
SessionBackend string
// contains filtered or unexported fields
}
func (*Agent) AgentState ¶
func (c *Agent) AgentState() api.AgentState
func (*Agent) CancelCurrentOperation ¶ added in v1.1.1
CancelCurrentOperation requests cancellation of the currently running LLM/tool operation. It returns true if there was an in-flight operation to cancel.
func (*Agent) CloseMCPClient ¶
CloseMCPClient closes the MCP client connections
func (*Agent) GetMCPStatusText ¶
GetMCPStatusText returns a formatted text representation of the MCP status This can be used by UIs that want to display the status as text
func (*Agent) InitializeMCPClient ¶
InitializeMCPClient initializes MCP client functionality for the agent. It connects to servers and registers discovered tools with the kubectl-qyai tool system.
func (*Agent) LoadSession ¶
LoadSession loads a session by ID (or latest), updates the agent's state, and re-initializes the chat.
type AgentManager ¶
type AgentManager struct {
// contains filtered or unexported fields
}
AgentManager manages the lifecycle of agents and their sessions.
func NewAgentManager ¶
func NewAgentManager(factory Factory, sessionManager *sessions.SessionManager) *AgentManager
NewAgentManager creates a new Manager.
func (*AgentManager) DeleteSession ¶
func (sm *AgentManager) DeleteSession(id string) error
DeleteSession delegates to the underlying store and closes the active agent if any.
func (*AgentManager) FindSessionByID ¶
func (sm *AgentManager) FindSessionByID(id string) (*api.Session, error)
FindSessionByID delegates to the underlying store.
func (*AgentManager) GetAgent ¶
GetAgent returns the agent for the given session ID, loading it if necessary.
func (*AgentManager) ListSessions ¶
func (sm *AgentManager) ListSessions() ([]*api.Session, error)
ListSessions delegates to the underlying store.
func (*AgentManager) SetAgentCreatedCallback ¶
func (sm *AgentManager) SetAgentCreatedCallback(cb func(*Agent))
SetAgentCreatedCallback sets the callback to be called when a new agent is created. It also calls the callback immediately for all currently active agents.
func (*AgentManager) UpdateLastAccessed ¶
func (sm *AgentManager) UpdateLastAccessed(session *api.Session) error
UpdateLastAccessed delegates to the underlying store.
type Factory ¶
Factory is a function that creates a new Agent instance.
type PromptData ¶
type PromptData struct {
Query string
Tools tools.Tools
EnableToolUseShim bool
SessionIsInteractive bool
HostInfo string
}
PromptData represents the structure of the data to be filled into the template.
func (*PromptData) ToolNames ¶
func (a *PromptData) ToolNames() string
func (*PromptData) ToolsAsJSON ¶
func (a *PromptData) ToolsAsJSON() string
type ReActResponse ¶
type ShimCandidate ¶
type ShimCandidate struct {
// contains filtered or unexported fields
}
func (*ShimCandidate) Parts ¶
func (c *ShimCandidate) Parts() []gollm.Part
func (*ShimCandidate) String ¶
func (c *ShimCandidate) String() string
type ShimPart ¶
type ShimPart struct {
// contains filtered or unexported fields
}
func (*ShimPart) AsFunctionCalls ¶
func (p *ShimPart) AsFunctionCalls() ([]gollm.FunctionCall, bool)
type ShimResponse ¶
type ShimResponse struct {
// contains filtered or unexported fields
}
func (*ShimResponse) Candidates ¶
func (r *ShimResponse) Candidates() []gollm.Candidate
func (*ShimResponse) UsageMetadata ¶
func (r *ShimResponse) UsageMetadata() any
Source Files
¶
- conversation.go
- manager.go
- mcp_client.go