agenttool

package
v0.10.0-alpha.21 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package agenttool carries ADK-internal AgentTool event-forwarding options shared between AgentTool and middleware plumbing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractTextContent

func ExtractTextContent(message any) string

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

func WithInvocationOptions[O any](agentName string, options []O) tool.Option

WithInvocationOptions associates agent run options with one AgentTool target.

func WithInvocationStreaming

func WithInvocationStreaming[O any](enabled bool) tool.Option

WithInvocationStreaming configures whether an AgentTool should stream its inner run.

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.

Jump to

Keyboard shortcuts

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