Annotation Interface AfterAgentInvocation


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

Example:


    public interface CreativeWriter {

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

        @AfterAgentInvocation
        static void afterAgentInvocation(AgentResponse response) {
            System.out.println("Current score is: " + response.agenticScope().readState("score", 0.0));
        }
    }