Documentation
¶
Overview ¶
Package agenttool carries ADK-internal AgentTool event-forwarding options shared between AgentTool and middleware plumbing.
Index ¶
- func ExtractTextContent(message any) string
- func WithEventReceiverTransform[E any](transform EventReceiverTransform[E]) tool.Option
- func WithForegroundExecution[E any](ctx context.Context, receivers []EventReceiver[E], enableStreaming bool) (context.Context, func())
- func WithInvocationOptions[O any](agentName string, options []O) tool.Option
- func WithInvocationStreaming[O any](enabled bool) tool.Option
- type EventReceiver
- type EventReceiverTransform
- type ForegroundExecution
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTextContent ¶
ExtractTextContent returns the model-facing text represented by a supported message.
func WithEventReceiverTransform ¶
func WithEventReceiverTransform[E any](transform EventReceiverTransform[E]) tool.Option
WithEventReceiverTransform adds an internal receiver-list transform to an AgentTool invocation.
func WithForegroundExecution ¶
func WithForegroundExecution[E any]( ctx context.Context, receivers []EventReceiver[E], enableStreaming bool, ) (context.Context, func())
WithForegroundExecution attaches process-local foreground projection state. detach prevents future receiver calls without waiting for calls already in flight.
func WithInvocationOptions ¶
WithInvocationOptions associates agent run options with one AgentTool target.
Types ¶
type EventReceiver ¶
type EventReceiver[E any] func(event E)
EventReceiver is a caller-provided function that receives an event emitted by the AgentTool's inner agent. Receivers must be best-effort and safe to call after their downstream consumer has stopped.
func ResolveEventReceivers ¶
func ResolveEventReceivers[E any](opts ...tool.Option) []EventReceiver[E]
ResolveEventReceivers applies the configured transforms in option order.
func ResolveInvocationOptions ¶
func ResolveInvocationOptions[E any, O any]( agentName string, opts ...tool.Option, ) ([]EventReceiver[E], bool, []O)
ResolveInvocationOptions preserves tool-option order while selecting options for agentName.
type EventReceiverTransform ¶
type EventReceiverTransform[E any] func(current []EventReceiver[E]) []EventReceiver[E]
EventReceiverTransform derives the receiver list for an AgentTool invocation from the receivers configured so far. Transforms run in tool-option order. The receiver list may be empty, but must not contain nil elements.
type ForegroundExecution ¶
type ForegroundExecution[E any] struct { // contains filtered or unexported fields }
ForegroundExecution carries process-local projection state from an AgentTool invocation to an executor running in the same process.
func ForegroundExecutionFromContext ¶
func ForegroundExecutionFromContext[E any](ctx context.Context) *ForegroundExecution[E]
ForegroundExecutionFromContext returns same-process foreground projection state.
func (*ForegroundExecution[E]) EnableStreaming ¶
func (e *ForegroundExecution[E]) EnableStreaming() bool
EnableStreaming reports whether the launching foreground invocation streams.
func (*ForegroundExecution[E]) Forward ¶
func (e *ForegroundExecution[E]) Forward( event E, backgrounded <-chan struct{}, clone func(E) E, )
Forward sends an independent event copy to each active foreground receiver.