Package dev.agenor.runtime.hitl
Class HitlAnnotationProcessor
java.lang.Object
dev.agenor.runtime.hitl.HitlAnnotationProcessor
Reads the
RequiresApproval annotation from behavior classes registered
with a BaseAgent and wraps each annotated behavior in a
HumanCheckpointBehavior at agent registration time.
Called by AgenorRuntime.registerAgent() for every BaseAgent:
// Inside AgenorRuntime.registerAgent():
if (agent instanceof BaseAgent baseAgent) {
HitlAnnotationProcessor.process(baseAgent, approvalGate);
}
Wiring logic
- Iterate over all behaviors currently registered on the agent.
- For each behavior whose class carries
RequiresApproval: - Parse
RequiresApproval.timeout()→Duration. - Instantiate
ApprovalNotifier: if notifier class is theDefaultApprovalNotifiersentinel, substituteLoggingApprovalNotifier. - Remove the original behavior from the agent.
- Add a
HumanCheckpointBehaviorwrapping it in its place.
- Since:
- 0.13.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThrown when a behavior class listed in@RequiresApprovalcannot be wired at agent bootstrap time. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidprocess(BaseAgent agent, ApprovalGate gate) Processes allRequiresApproval-annotated behaviors onagentand wraps them withHumanCheckpointBehavior.
-
Method Details
-
process
Processes allRequiresApproval-annotated behaviors onagentand wraps them withHumanCheckpointBehavior.This method is a no-op if no behavior carries the annotation.
- Parameters:
agent- the agent being registered; nevernullgate- the singleton approval gate; nevernull- Throws:
HitlAnnotationProcessor.HitlWiringException- if a notifier class cannot be instantiated, or if the timeout string cannot be parsed
-