interceptEnvironmentCreated
fun interceptEnvironmentCreated(feature: AIAgentFeature<*, *>, transform: suspend AgentEnvironmentTransformingContext.(AIAgentEnvironment) -> AIAgentEnvironment)(source)
Intercepts environment creation to allow features to modify or enhance the agent environment.
This method registers a transformer function that will be called when an agent environment is being created, allowing the feature to customize the environment based on the agent context.
Parameters
transform
A function that transforms the environment, with access to the agent creation context
Example:
pipeline.interceptEnvironmentCreated(InterceptContext) { environment ->
// Modify the environment based on agent context
environment.copy(
variables = environment.variables + mapOf("customVar" to "value")
)
}
Content copied to clipboard