ContextualAgentEnvironment
Represents an AI agent environment that operates within the context of a specific agent framework.
This class acts as a decorator over an existing AIAgentEnvironment, augmenting operations with contextual processing using the provided AIAgentContext.
Metadata handling: when executeTool is called with a ToolCallMetadata argument, this environment collects metadata contributions from every feature that registered a handler via ai.koog.agents.core.feature.pipeline.AIAgentPipelineAPI.provideToolCallMetadata and merges them with the caller-supplied metadata. On key collision, the caller's value wins, so an explicit call-site override is never silently replaced by a feature contribution. After the merge, the framework injects the live AIAgentContext under AgentContextAwareTool.AgentContextKey; the framework's value always wins over caller and feature entries so a tool always observes the real context driving the current call. The merged metadata is then passed to the wrapped environment, which threads it into ai.koog.agents.core.tools.ToolBase.execute.
Parameters
The underlying agent environment responsible for managing tool execution.
The context that augments the environment with additional behavioral and execution information.
Constructors
Constructs a new instance of ContextualAgentEnvironment with a decorated environment and a contextual context.
Functions
Executes a tool call and returns its result.
Executes a tool call with caller-supplied metadata and returns its result.
Executes a batch of tool calls within the AI agent environment and processes their results.
Executes a batch of tool calls with shared caller-supplied metadata and returns their results.
Reports a problem that occurred within the environment.