interceptEnvironmentCreated
fun <TFeature : Any> interceptEnvironmentCreated(feature: AIAgentFeature<*, TFeature>, featureImpl: TFeature, transform: AgentCreateContext<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
feature
The feature for which to register the environment transformer
featureImpl
The implementation of the feature
transform
A function that transforms the environment, with access to the agent creation context
Example:
pipeline.interceptEnvironmentCreated(MyFeature, myFeatureImpl) { environment ->
// Modify the environment based on agent context
environment.copy(
variables = environment.variables + mapOf("customVar" to "value")
)
}
Content copied to clipboard