Annotation Interface BeforeCall
Marks a method as a pre-invocation hook for an agentic pattern.
The annotated method must be static, accept an
AgenticScope as argument, and return void.
It can also declare parameters resolved through a SupplierParameterResolver.
It will be invoked before every execution of the agent, allowing initialization or transformation
of the shared state.
Example:
public interface StoryCreatorWithDefaults {
@SequenceAgent(outputKey = "story",
subAgents = { CreativeWriter.class, StyleEditor.class })
String write(@V("topic") String topic);
@BeforeCall
static void beforeCall(AgenticScope agenticScope) {
agenticScope.writeStateIfAbsent("style", "comedy");
}
}