Help us shape the future of Go! Take the 2026 Go Developer Survey

engine

package
v0.19.10 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEphemeralAgentEvent

func IsEphemeralAgentEvent(ctx context.Context) bool

IsEphemeralAgentEvent reports whether a terminal event closes recovery scaffolding rather than durable conversation history. A streamed response can emit start/update events before its malformed finish reason is known, so transcript stores must make their persistence decision on MessageEnd.

func MarshalAgentEvent

func MarshalAgentEvent(event AgentEvent) ([]byte, error)

func MessageRole added in v0.19.1

func MessageRole(message AgentMessage) string

MessageRole is the role message carries on the wire, or "" when it has none.

func ToolExecutionModel

func ToolExecutionModel(ctx context.Context) *ai.Model

ToolExecutionModel returns the request model attached by the loop. Tools use it for behavior that depends on model capabilities, matching upstream's per-invocation tool context rather than startup-time configuration.

func WithToolExecutionModel

func WithToolExecutionModel(ctx context.Context, model *ai.Model) context.Context

WithToolExecutionModel supplies the model context for a direct tool invocation. The agent loop applies it automatically during normal runs.

Types

type AfterToolCallContext

type AfterToolCallContext struct {
	AssistantMessage *ai.AssistantMessage
	ToolCall         *ai.ToolCall
	Args             any
	Result           AgentToolResult
	IsError          bool
	Context          *AgentContext
}

type AfterToolCallFunc

type AfterToolCallFunc func(context.Context, AfterToolCallContext) (*AfterToolCallResult, error)

AfterToolCallFunc may be invoked concurrently for parallel tool calls.

type AfterToolCallResult

type AfterToolCallResult struct {
	Content    ai.ToolResultContent
	Details    any
	DetailsSet bool
	// StructuredContent replaces the result's; when Content is replaced
	// without it, the old structured content is dropped as no longer matching.
	StructuredContent any
	IsError           *bool
	Usage             *ai.Usage
	Terminate         *bool
}

type Agent

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

Agent is the stateful wrapper around RunLoop and RunLoopContinue.

func NewAgent

func NewAgent(stream StreamFn, option ...AgentOption) *Agent

func (*Agent) Abort

func (agent *Agent) Abort()

func (*Agent) AppendMessage

func (agent *Agent) AppendMessage(message AgentMessage)

func (*Agent) ClearAllQueues

func (agent *Agent) ClearAllQueues()

func (*Agent) ClearFollowUpQueue

func (agent *Agent) ClearFollowUpQueue()

func (*Agent) ClearSteeringQueue

func (agent *Agent) ClearSteeringQueue()

func (*Agent) Continue

func (agent *Agent) Continue(ctx context.Context) error

func (*Agent) DisplayState

func (agent *Agent) DisplayState() AgentDisplayState

func (*Agent) FollowUp

func (agent *Agent) FollowUp(message AgentMessage)

func (*Agent) FollowUpMode

func (agent *Agent) FollowUpMode() QueueMode

func (*Agent) HasQueuedMessages

func (agent *Agent) HasQueuedMessages() bool

func (*Agent) IsIdle

func (agent *Agent) IsIdle() bool

func (*Agent) Messages added in v0.16.0

func (agent *Agent) Messages() AgentMessages

Messages returns the transcript without copying its messages, which stay shared with the agent and must not be modified.

func (*Agent) Model added in v0.16.0

func (agent *Agent) Model() *ai.Model

Model is the agent's model, for reads that need nothing else of its state. It stays shared with the agent, which only ever replaces it, and must not be modified.

func (*Agent) Observe added in v0.8.0

func (agent *Agent) Observe(initialize func(AgentState), event func(AgentEvent)) func()

func (*Agent) PeekQueuedMessages added in v0.14.0

func (agent *Agent) PeekQueuedMessages() AgentMessages

PeekQueuedMessages returns the batch the next turn would take, steering first and following the queue modes, without consuming it.

func (*Agent) Prompt

func (agent *Agent) Prompt(ctx context.Context, input any, images ...*ai.ImageContent) error

Prompt starts a run from a string, one AgentMessage, or AgentMessages. String prompts accept optional images and are normalized to upstream content blocks.

func (*Agent) ReplaceLastMessage

func (agent *Agent) ReplaceLastMessage(replacement AgentMessage) bool

func (*Agent) Reset

func (agent *Agent) Reset()

func (*Agent) SessionLoopExclusive added in v0.12.0

func (agent *Agent) SessionLoopExclusive() bool

SessionLoopExclusive reports a session loop that runs every model, which a model on Orb's own loop cannot join.

func (*Agent) SetFollowUpMode

func (agent *Agent) SetFollowUpMode(mode QueueMode)

func (*Agent) SetMessages

func (agent *Agent) SetMessages(messages AgentMessages)

func (*Agent) SetModel

func (agent *Agent) SetModel(model *ai.Model)

func (*Agent) SetProviderHooks

func (agent *Agent) SetProviderHooks(payload ai.PayloadHook, headers ai.HeadersHook, response ai.ResponseHook, stream ai.ProviderStreamEventHook)

func (*Agent) SetRequestResolvers

func (agent *Agent) SetRequestResolvers(apiKey GetAPIKeyFunc, auth GetRequestAuthFunc, headers GetModelHeadersFunc)

func (*Agent) SetRequestSystemPromptOverride added in v0.7.0

func (agent *Agent) SetRequestSystemPromptOverride(prompt *string)

SetRequestSystemPromptOverride projects an exact provider-facing prompt for the next run without changing transcript persistence.

func (*Agent) SetSessionLoop added in v0.12.0

func (agent *Agent) SetSessionLoop(claims func(*ai.Model) bool, loop SessionLoop)

SetSessionLoop hands the runs of the models claims accepts to loop; other models keep Orb's own loop, so one conversation can move between them.

func (*Agent) SetSteeringMode

func (agent *Agent) SetSteeringMode(mode QueueMode)

func (*Agent) SetStreamFn

func (agent *Agent) SetStreamFn(stream StreamFn)

func (*Agent) SetStreamSessionID

func (agent *Agent) SetStreamSessionID(sessionID string)

SetStreamSessionID sets the per-request session id providers use for affinity and prompt-cache keys (upstream Agent's constructor sessionId).

func (*Agent) SetThinkingLevel

func (agent *Agent) SetThinkingLevel(level ThinkingLevel)

func (*Agent) SetToolCallHooks

func (agent *Agent) SetToolCallHooks(before BeforeToolCallFunc, after AfterToolCallFunc)

func (*Agent) SetTools

func (agent *Agent) SetTools(tools []AgentTool)

func (*Agent) SetTransformContext

func (agent *Agent) SetTransformContext(transform TransformContextFunc)

func (*Agent) SetTransport

func (agent *Agent) SetTransport(transport ai.Transport)

func (*Agent) Signal

func (agent *Agent) Signal() context.Context

Signal returns the active run context, matching upstream's abort signal exposure to extensions. It is nil while the agent is idle.

func (*Agent) State

func (agent *Agent) State() AgentState

State is a copy of the agent's state. SystemPrompt is replayed from the transcript's system messages; to change it, append a system message.

func (*Agent) StateWithoutMessages added in v0.16.0

func (agent *Agent) StateWithoutMessages() AgentState

StateWithoutMessages is State without the transcript (Messages and StreamingMessage stay empty), for reads that need only the configuration: copying every message made each of them O(history).

func (*Agent) Steer

func (agent *Agent) Steer(message AgentMessage)

func (*Agent) SteeringMode

func (agent *Agent) SteeringMode() QueueMode

func (*Agent) StreamFn

func (agent *Agent) StreamFn() StreamFn

func (*Agent) Subscribe

func (agent *Agent) Subscribe(listener EventSink) func()

Subscribe adds a listener and returns its unsubscribe func. Listeners are awaited in subscription order for each event; overlapping upstream events may invoke the same listener concurrently.

func (*Agent) SwapFinishTurn added in v0.14.0

func (agent *Agent) SwapFinishTurn(hook FinishTurnFunc) FinishTurnFunc

SwapFinishTurn replaces the finish-turn hook and returns its predecessor.

func (*Agent) SwapPrepareNextTurnContext added in v0.6.0

func (agent *Agent) SwapPrepareNextTurnContext(hook PrepareNextTurnFunc) PrepareNextTurnFunc

SwapPrepareNextTurnContext replaces the next-turn hook and returns its predecessor.

func (*Agent) SwapPrepareRequest added in v0.14.0

func (agent *Agent) SwapPrepareRequest(hook PrepareRequestFunc) PrepareRequestFunc

SwapPrepareRequest replaces the before-request hook and returns its predecessor.

func (*Agent) ToolExecution added in v0.14.0

func (agent *Agent) ToolExecution() ToolExecutionMode

ToolExecution is how the agent runs a response's tool calls.

func (*Agent) UsesSessionLoop added in v0.9.0

func (agent *Agent) UsesSessionLoop() bool

UsesSessionLoop reports whether the current model's runs, and so their execution policies, belong to an external session.

func (*Agent) WaitForIdle

func (agent *Agent) WaitForIdle(ctx context.Context) error

type AgentContext

type AgentContext struct {
	SystemPrompt string
	Messages     AgentMessages
	Tools        []AgentTool
}

type AgentDisplayState

type AgentDisplayState struct {
	HasModel      bool
	ModelID       string
	Provider      ai.ProviderID
	ContextWindow float64
	Reasoning     bool
	ThinkingLevel ThinkingLevel
}

type AgentEndEvent

type AgentEndEvent struct {
	Messages AgentMessages
}

func (AgentEndEvent) MarshalJSON

func (event AgentEndEvent) MarshalJSON() ([]byte, error)

func (AgentEndEvent) Type

type AgentEvent

type AgentEvent interface {
	Type() AgentEventType
	// contains filtered or unexported methods
}

type AgentEventType

type AgentEventType string
const (
	EventAgentStart          AgentEventType = "agent_start"
	EventAgentEnd            AgentEventType = "agent_end"
	EventTurnStart           AgentEventType = "turn_start"
	EventTurnEnd             AgentEventType = "turn_end"
	EventMessageStart        AgentEventType = "message_start"
	EventMessageUpdate       AgentEventType = "message_update"
	EventMessageEnd          AgentEventType = "message_end"
	EventToolExecutionStart  AgentEventType = "tool_execution_start"
	EventToolExecutionUpdate AgentEventType = "tool_execution_update"
	EventToolExecutionEnd    AgentEventType = "tool_execution_end"
)

type AgentLoopConfig

type AgentLoopConfig struct {
	ai.SimpleStreamOptions
	Model               *ai.Model
	ConvertToLLM        ConvertToLLMFunc
	TransformContext    TransformContextFunc
	GetAPIKey           GetAPIKeyFunc
	GetRequestAuth      GetRequestAuthFunc
	GetModelHeaders     GetModelHeadersFunc
	FinishTurn          FinishTurnFunc
	PrepareRequest      PrepareRequestFunc
	PrepareNextTurn     PrepareNextTurnFunc
	GetSteeringMessages GetQueuedMessagesFunc
	GetFollowUpMessages GetQueuedMessagesFunc
	ToolExecution       ToolExecutionMode
	BeforeToolCall      BeforeToolCallFunc
	AfterToolCall       AfterToolCallFunc
	Now                 func() int64
	// contains filtered or unexported fields
}

type AgentLoopTurnUpdate

type AgentLoopTurnUpdate struct {
	Context       *AgentContext
	Model         *ai.Model
	ThinkingLevel *ThinkingLevel
}

type AgentMessage

type AgentMessage = any

AgentMessage is an LLM message or an application-defined message. Standard messages are ai.Message values; any JSON-marshalable value may be carried so applications retain upstream's custom-message extension point.

type AgentMessages

type AgentMessages []AgentMessage

func RunLoop

func RunLoop(
	ctx context.Context,
	prompts AgentMessages,
	loopContext AgentContext,
	config AgentLoopConfig,
	sink EventSink,
	streamFn StreamFn,
) (AgentMessages, error)

RunLoop starts a loop with prompt messages and returns only messages created by this invocation. The caller-owned context is copied before it is changed.

func RunLoopContinue

func RunLoopContinue(
	ctx context.Context,
	loopContext *AgentContext,
	config AgentLoopConfig,
	sink EventSink,
	streamFn StreamFn,
) (AgentMessages, error)

RunLoopContinue resumes a non-assistant transcript without adding a prompt.

type AgentOption

type AgentOption func(*agentOptions)

func WithAPIKeyResolver

func WithAPIKeyResolver(resolve GetAPIKeyFunc) AgentOption

func WithAfterToolCall

func WithAfterToolCall(hook AfterToolCallFunc) AgentOption

func WithBeforeToolCall

func WithBeforeToolCall(hook BeforeToolCallFunc) AgentOption

func WithClock

func WithClock(now func() int64) AgentOption

WithClock supplies JavaScript Date.now-compatible milliseconds. It is useful for deterministic fixture runs and applications with an injected clock.

func WithConvertToLLM

func WithConvertToLLM(convert ConvertToLLMFunc) AgentOption

func WithFinishTurn added in v0.14.0

func WithFinishTurn(hook FinishTurnFunc) AgentOption

func WithFollowUpMode

func WithFollowUpMode(mode QueueMode) AgentOption

func WithGetSteeringMessages

func WithGetSteeringMessages(getter GetQueuedMessagesFunc) AgentOption

func WithInitialState

func WithInitialState(state AgentState) AgentOption

func WithModelHeadersResolver

func WithModelHeadersResolver(resolve GetModelHeadersFunc) AgentOption

func WithPrepareNextTurnContext

func WithPrepareNextTurnContext(hook PrepareNextTurnFunc) AgentOption

func WithPrepareRequest added in v0.14.0

func WithPrepareRequest(hook PrepareRequestFunc) AgentOption

func WithRequestAuthResolver

func WithRequestAuthResolver(resolve GetRequestAuthFunc) AgentOption

func WithSessionLoop added in v0.9.0

func WithSessionLoop(loop SessionLoop) AgentOption

func WithSimpleStreamOptions

func WithSimpleStreamOptions(streamOptions ai.SimpleStreamOptions) AgentOption

func WithSteeringMode

func WithSteeringMode(mode QueueMode) AgentOption

func WithToolExecution

func WithToolExecution(mode ToolExecutionMode) AgentOption

type AgentStartEvent

type AgentStartEvent struct{}

func (AgentStartEvent) MarshalJSON

func (AgentStartEvent) MarshalJSON() ([]byte, error)

func (AgentStartEvent) Type

type AgentState

type AgentState struct {
	SystemPrompt     string
	Model            *ai.Model
	ThinkingLevel    ThinkingLevel
	Tools            []AgentTool
	Messages         AgentMessages
	IsStreaming      bool
	StreamingMessage AgentMessage
	PendingToolCalls map[string]struct{}
	ErrorMessage     *string
}

type AgentTool

type AgentTool interface {
	Spec() AgentToolSpec
	Execute(context.Context, string, any, AgentToolUpdateCallback) (AgentToolResult, error)
}

AgentTool is the execution seam shared by built-in, extension, and MCP tools. Spec returns immutable call metadata for a single loop decision.

type AgentToolCallOutcome added in v0.14.0

type AgentToolCallOutcome struct {
	ToolCall *ai.ToolCall
	Result   AgentToolResult
	IsError  bool
}

AgentToolCallOutcome is how one tool call ended.

func RunToolCall added in v0.14.0

func RunToolCall(ctx context.Context, toolCall *ai.ToolCall, options RunToolCallOptions) AgentToolCallOutcome

RunToolCall runs one tool call. Failures (unknown tools, validation errors, blocked calls, tool errors) come back as an error outcome, never an error.

type AgentToolFunc

type AgentToolFunc struct {
	AgentToolSpec
	Run ToolExecuteFunc
}

AgentToolFunc adapts a function to AgentTool without introducing a second implementation-specific interface.

func (AgentToolFunc) Execute

func (tool AgentToolFunc) Execute(
	ctx context.Context,
	toolCallID string,
	params any,
	onUpdate AgentToolUpdateCallback,
) (AgentToolResult, error)

func (AgentToolFunc) Spec

func (tool AgentToolFunc) Spec() AgentToolSpec

type AgentToolResult

type AgentToolResult struct {
	Content ai.ToolResultContent
	Details any
	// StructuredContent is the machine-readable result matching the tool's
	// output schema, for programmatic callers; the model sees Content.
	StructuredContent any
	Usage             *ai.Usage
	AddedToolNames    *[]string
	// IsError reports a failure without returning an error: the model sees
	// Content as an error result, while Details and StructuredContent remain.
	IsError   bool
	Terminate *bool
}

func (AgentToolResult) MarshalJSON

func (result AgentToolResult) MarshalJSON() ([]byte, error)

type AgentToolSpec

type AgentToolSpec struct {
	Name                string
	Label               string
	Description         string
	Parameters          ai.JSONSchema
	ConstrainedSampling *ai.ConstrainedSamplingConfig
	PrepareArguments    PrepareArgumentsFunc
	ExecutionMode       ToolExecutionMode
}

type AgentToolUpdateCallback

type AgentToolUpdateCallback func(AgentToolResult)

AgentToolUpdateCallback snapshots accepted updates and returns before event listeners settle. It is scoped to Execute; calls after Execute returns, or racing with its return, may be ignored.

type BeforeToolCallContext

type BeforeToolCallContext struct {
	AssistantMessage *ai.AssistantMessage
	ToolCall         *ai.ToolCall
	Args             any
	Context          *AgentContext
}

type BeforeToolCallResult

type BeforeToolCallResult struct {
	// Approved is explicit host consent; a nonblocking hook alone grants nothing.
	Approved bool `json:"-"`
	Block    bool
	Reason   string
}

type ConvertToLLMFunc

type ConvertToLLMFunc func(context.Context, AgentMessages) (ai.MessageList, error)

type EventSink

type EventSink func(ctx context.Context, event AgentEvent) error

EventSink handles one event. Parallel tool calls may invoke the same sink concurrently, matching upstream's overlapping event promises, so implementations that mutate shared state must synchronize it. Updates within one tool call arrive one at a time, in the order the tool produced them, and on a goroutine the tool does not wait for: a slow sink lags behind the tool rather than throttling it, up to toolUpdateQueueDepth pending updates.

type FinishTurnFunc added in v0.14.0

type FinishTurnFunc func(context.Context, TurnContext) (TurnAction, error)

FinishTurnFunc runs after the assistant response and its tool results are final and before turn_end, for error and aborted responses too (their decision is ignored: those remain hard exits). An empty action keeps normal scheduling.

type GetAPIKeyFunc

type GetAPIKeyFunc func(context.Context, ai.ProviderID) (*string, error)

type GetModelHeadersFunc

type GetModelHeadersFunc func(context.Context, *ai.Model, *string, ai.ProviderEnv) (*map[string]string, error)

type GetQueuedMessagesFunc

type GetQueuedMessagesFunc func(context.Context) (AgentMessages, error)

type GetRequestAuthFunc

type GetRequestAuthFunc func(context.Context, ai.ProviderID) (*RequestAuth, error)

type MessageEndEvent

type MessageEndEvent struct {
	Message AgentMessage
}

func (MessageEndEvent) MarshalJSON

func (event MessageEndEvent) MarshalJSON() ([]byte, error)

func (MessageEndEvent) Type

type MessageStartEvent

type MessageStartEvent struct {
	Message AgentMessage
}

func (MessageStartEvent) MarshalJSON

func (event MessageStartEvent) MarshalJSON() ([]byte, error)

func (MessageStartEvent) Type

type MessageUpdateEvent

type MessageUpdateEvent struct {
	// Upstream constructs this literal with assistantMessageEvent before message.
	AssistantMessageEvent ai.AssistantMessageEvent
	Message               AgentMessage
}

func (MessageUpdateEvent) MarshalJSON

func (event MessageUpdateEvent) MarshalJSON() ([]byte, error)

func (MessageUpdateEvent) Type

type ParallelExecutionPreparer

type ParallelExecutionPreparer interface {
	PrepareParallelExecution(context.Context, any) (context.Context, func(), error)
}

ParallelExecutionPreparer reserves invocation-ordered resources before a parallel batch is launched. The loop calls it in tool-call source order.

type PrepareArgumentsFunc

type PrepareArgumentsFunc func(args any) (any, error)

type PrepareNextTurnContext

type PrepareNextTurnContext = TurnContext

type PrepareRequestContext added in v0.14.0

type PrepareRequestContext struct {
	Context       *AgentContext
	Model         *ai.Model
	ThinkingLevel ThinkingLevel
}

PrepareRequestContext is what the next provider request would use.

type PrepareRequestFunc added in v0.14.0

type PrepareRequestFunc func(context.Context, PrepareRequestContext) (*AgentLoopTurnUpdate, error)

PrepareRequestFunc runs before every provider request, the first included.

type QueueMode

type QueueMode string
const (
	QueueAll        QueueMode = "all"
	QueueOneAtATime QueueMode = "one-at-a-time"
)

type RequestAuth

type RequestAuth struct {
	APIKey  *string
	Headers ai.ProviderHeaders
	Env     ai.ProviderEnv
	BaseURL *string
}

type RunToolCallOptions added in v0.14.0

type RunToolCallOptions struct {
	Tools            []AgentTool
	AssistantMessage *ai.AssistantMessage
	Context          AgentContext
	Model            *ai.Model
	BeforeToolCall   BeforeToolCallFunc
	AfterToolCall    AfterToolCallFunc
	OnUpdate         AgentToolUpdateCallback
}

RunToolCallOptions run one tool call outside the loop, as ExecuteTool does: the call goes through argument preparation, validation and the hooks, against Tools.

type SessionLoop added in v0.9.0

SessionLoop replaces model/tool iteration while retaining Agent state, events, queue ownership and cancellation. A nil loop uses Orb's native implementation. Implementations consume only new prompts; their own session owns prior context.

type StreamFn

type StreamFn func(
	ctx context.Context,
	model *ai.Model,
	requestContext ai.Context,
	options *ai.SimpleStreamOptions,
) (ai.AssistantMessageEventStream, error)

type ToolExecuteFunc

type ToolExecuteFunc func(
	ctx context.Context,
	toolCallID string,
	params any,
	onUpdate AgentToolUpdateCallback,
) (AgentToolResult, error)

type ToolExecutionEndEvent

type ToolExecutionEndEvent struct {
	ToolCallID       string
	ToolName         string
	Result           AgentToolResult
	IsError          bool
	ParentToolCallID string
}

func (ToolExecutionEndEvent) MarshalJSON

func (event ToolExecutionEndEvent) MarshalJSON() ([]byte, error)

func (ToolExecutionEndEvent) Type

type ToolExecutionMode

type ToolExecutionMode string
const (
	ToolExecutionSequential ToolExecutionMode = "sequential"
	ToolExecutionParallel   ToolExecutionMode = "parallel"
)

type ToolExecutionStartEvent

type ToolExecutionStartEvent struct {
	ToolCallID       string
	ToolName         string
	Args             map[string]any
	ParentToolCallID string
	// contains filtered or unexported fields
}

Tool execution events of calls a tool made through ExecuteTool carry ParentToolCallID.

func NewToolExecutionStartEvent

func NewToolExecutionStartEvent(toolCall *ai.ToolCall) ToolExecutionStartEvent

func (ToolExecutionStartEvent) MarshalJSON

func (event ToolExecutionStartEvent) MarshalJSON() ([]byte, error)

func (ToolExecutionStartEvent) Type

type ToolExecutionUpdateEvent

type ToolExecutionUpdateEvent struct {
	ToolCallID       string
	ToolName         string
	Args             map[string]any
	PartialResult    AgentToolResult
	ParentToolCallID string
	// contains filtered or unexported fields
}

func NewToolExecutionUpdateEvent

func NewToolExecutionUpdateEvent(toolCall *ai.ToolCall, partial AgentToolResult) ToolExecutionUpdateEvent

func (ToolExecutionUpdateEvent) MarshalJSON

func (event ToolExecutionUpdateEvent) MarshalJSON() ([]byte, error)

func (ToolExecutionUpdateEvent) Type

type TransformContextFunc

type TransformContextFunc func(context.Context, AgentMessages) (AgentMessages, error)

type TurnAction added in v0.14.0

type TurnAction string

TurnAction is a FinishTurn decision. TurnEnd ends a normal run after turn_end without touching steering or follow-up queues; TurnContinue ensures one more provider request, which queued work may satisfy.

const (
	TurnEnd      TurnAction = "end"
	TurnContinue TurnAction = "continue"
)

type TurnContext added in v0.14.0

type TurnContext struct {
	Message     *ai.AssistantMessage
	ToolResults []*ai.ToolResultMessage
	Context     *AgentContext
	NewMessages AgentMessages
}

TurnContext describes a completed turn: the assistant response, its tool results, the context after them and everything the run appended so far.

type TurnEndEvent

type TurnEndEvent struct {
	Message     AgentMessage
	ToolResults []*ai.ToolResultMessage
}

func (TurnEndEvent) MarshalJSON

func (event TurnEndEvent) MarshalJSON() ([]byte, error)

func (TurnEndEvent) Type

type TurnStartEvent

type TurnStartEvent struct{}

func (TurnStartEvent) MarshalJSON

func (TurnStartEvent) MarshalJSON() ([]byte, error)

func (TurnStartEvent) Type

Directories

Path Synopsis
envtest
Package envtest is the shared conformance suite for harness.FileSystem port implementations (DECISIONS.md P10).
Package envtest is the shared conformance suite for harness.FileSystem port implementations (DECISIONS.md P10).

Jump to

Keyboard shortcuts

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