Documentation
¶
Index ¶
- type BaseTool
- type HistorySummarizer
- type RunState
- func (s *RunState) ClearPendingTools()
- func (s *RunState) HasToolsAwaitingApproval() bool
- func (s *RunState) IsComplete() bool
- func (s *RunState) IsPaused() bool
- func (s *RunState) NextStep() Step
- func (s *RunState) PromoteAwaitingToApproval()
- func (s *RunState) ToMeta(traceid string) map[string]any
- func (s *RunState) TransitionToAwaitApproval(tools []responses.FunctionCallMessage)
- func (s *RunState) TransitionToComplete()
- func (s *RunState) TransitionToExecuteTools(tools []responses.FunctionCallMessage)
- func (s *RunState) TransitionToLLM()
- type RunStatus
- type Step
- type StreamBroker
- type SummaryResult
- type SystemPromptProvider
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseTool ¶
func (*BaseTool) NeedApproval ¶
type HistorySummarizer ¶
type HistorySummarizer interface {
// Summarize takes a list of messages and returns a summary result.
// If summarization is not needed, returns a result with KeepFromIndex = -1.
Summarize(ctx context.Context, msgIdToRunId map[string]string, messages []responses.InputMessageUnion, usage *responses.Usage) (*SummaryResult, error)
}
type RunState ¶
type RunState struct {
CurrentStep Step `json:"current_step"`
LoopIteration int `json:"loop_iteration"`
Usage responses.Usage `json:"usage"`
PendingToolCalls []responses.FunctionCallMessage `json:"pending_tool_calls,omitempty"`
ToolsAwaitingApproval []responses.FunctionCallMessage `json:"tools_awaiting_approval,omitempty"`
}
RunState encapsulates the execution state of an agent run
func LoadRunStateFromMeta ¶
LoadRunStateFromMeta loads RunState from messages.meta
func (*RunState) ClearPendingTools ¶
func (s *RunState) ClearPendingTools()
ClearPendingTools clears the pending tool calls
func (*RunState) HasToolsAwaitingApproval ¶
HasToolsAwaitingApproval returns true if there are tools waiting for approval
func (*RunState) IsComplete ¶
IsComplete returns true if the state is complete
func (*RunState) PromoteAwaitingToApproval ¶
func (s *RunState) PromoteAwaitingToApproval()
PromoteAwaitingToApproval moves tools awaiting approval to pending and transitions to await state
func (*RunState) TransitionToAwaitApproval ¶
func (s *RunState) TransitionToAwaitApproval(tools []responses.FunctionCallMessage)
TransitionToAwaitApproval moves to await approval step with the given tools
func (*RunState) TransitionToComplete ¶
func (s *RunState) TransitionToComplete()
TransitionToComplete moves to the complete step and clears pending tools
func (*RunState) TransitionToExecuteTools ¶
func (s *RunState) TransitionToExecuteTools(tools []responses.FunctionCallMessage)
TransitionToExecuteTools moves to tool execution step with the given tools
func (*RunState) TransitionToLLM ¶
func (s *RunState) TransitionToLLM()
TransitionToLLM moves to the LLM call step and increments loop iteration
type StreamBroker ¶ added in v0.1.11
type StreamBroker interface {
// Publish sends a response chunk to subscribers of the given channel.
// The channel is typically the run ID or a unique identifier for the execution.
Publish(ctx context.Context, channel string, chunk *responses.ResponseChunk) error
// Subscribe returns a channel that receives response chunks for the given channel.
// The returned channel will be closed when Close is called or the context is cancelled.
Subscribe(ctx context.Context, channel string) (<-chan *responses.ResponseChunk, error)
// Close signals that no more chunks will be published to the channel.
// This should close all subscriber channels for the given channel.
Close(ctx context.Context, channel string) error
}
StreamBroker provides an abstraction for streaming response chunks between activities/workers and clients. This enables streaming support for both Restate and Temporal runtimes.
type SummaryResult ¶
type SummaryResult struct {
Summary *responses.InputMessageUnion // The summary message
MessagesToKeep []responses.InputMessageUnion
LastSummarizedMessageID string // ID of the last message that was summarized
SummaryID string // Unique ID for the summary (generated if empty)
}
SummaryResult contains the result of summarization including metadata needed for saving