interceptEnvironmentCreated
fun <TFeature : Any> interceptEnvironmentCreated(context: InterceptContext<TFeature>, transform: AgentTransformEnvironmentContext<TFeature>.(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
context
The context of the feature being intercepted, providing access to the feature key and implementation
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