Class LlmRegistrationExtension

java.lang.Object
dev.agenor.runtime.guardrail.LlmRegistrationExtension
All Implemented Interfaces:
AgentRegistrationExtension

public final class LlmRegistrationExtension extends Object implements AgentRegistrationExtension
Injects the @WithGuardrails chain and installs telemetry on LLMAgent instances at agent registration time, discovered via ServiceLoader.
Since:
0.25.0
See Also:
  • Constructor Details

    • LlmRegistrationExtension

      public LlmRegistrationExtension()
  • Method Details

    • onAgentRegistered

      public void onAgentRegistered(Agent agent, RegistrationContext context)
      Description copied from interface: AgentRegistrationExtension
      Called once for agent during registerAgent().
      Specified by:
      onAgentRegistered in interface AgentRegistrationExtension
      Parameters:
      agent - the agent being registered; never null
      context - runtime services available to this extension; never null
    • handledAnnotations

      public Set<Class<? extends Annotation>> handledAnnotations()
      Description copied from interface: AgentRegistrationExtension
      The annotations this extension acts on, for diagnostics.

      The runtime uses the union of these sets to detect annotations that no loaded extension claims — the signature of a missing optional module — and reports them once at startup. It is never used to decide whether AgentRegistrationExtension.onAgentRegistered(Agent, RegistrationContext) is invoked: every registered extension is always invoked for every agent, whatever this returns.

      Claiming an annotation asserts only that this extension processes it, not that it will have an effect on every agent carrying it — an extension that applies to a specific agent type should say so itself when it sees the annotation on an agent it cannot serve.

      Defaults to the empty set, so extensions written before this method existed keep compiling and working; they simply claim nothing.

      Specified by:
      handledAnnotations in interface AgentRegistrationExtension
      Returns:
      @WithGuardrails, which this extension processes
      Since:
      0.26.0