Annotation Interface BeforeAgentInvocation


@Retention(RUNTIME) @Target(METHOD) public @interface BeforeAgentInvocation
Marks a method as a hook to be executed before an agent invocation. The annotated method must be static, take an AgentRequest as arguments, and return void.

Example:


    public interface CreativeWriter {

        @Agent("Generate a story based on the given topic")
        String generateStory(@V("topic") String topic);

        @BeforeAgentInvocation
        static void beforeAgentInvocation(AgentRequest request) {
            System.out.println("Invoked with topic: " + request.inputs().get("topic"));
        }
    }