Annotation Interface Agent


@Target(TYPE) @Retention(RUNTIME) public @interface Agent
Marks a class as a Agenor agent eligible for automatic discovery and registration.

When package scanning is enabled on AgenorRuntime, all classes annotated with @Agent are discovered, instantiated, and registered in the AgentDirectory. The runtime then calls start() on each agent that has autoStart() set to true.

Example usage:


 @Agent(value = "order-processor", type = "processor",
              capabilities = {"order.processing", "inventory.check"})
 public class OrderProcessorAgent extends BaseAgent {

     @Behavior(type = CYCLIC, interval = "10s")
     public void processPendingOrders() { ... }
 }
 
Since:
0.1.0
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether the runtime should start this agent automatically after registration.
    Capability identifiers advertised by this agent.
    An optional type label used for grouping and querying agents.
    The agent identifier used for registration and discovery.
  • Element Details

    • value

      String value
      The agent identifier used for registration and discovery.

      When left empty, the runtime defaults to the simple class name converted to a kebab-case (e.g., OrderProcessorAgentorder-processor-agent). The value must be unique within the runtime.

      Returns:
      the agent identifier, or empty string to use the class-name default
      Default:
      ""
    • type

      String type
      An optional type label used for grouping and querying agents.

      Types allow callers to query the AgentDirectory for all agents of a given type (e.g., "processor", "collector", "monitor"). The type has no effect on agent behavior.

      Returns:
      the agent type label, or empty string if not categorized
      Default:
      ""
    • capabilities

      String[] capabilities
      Capability identifiers advertised by this agent.

      Capabilities are arbitrary strings that describe what this agent can do (e.g., "order.processing", "report.generation"). Other agents can query the directory to find agents with specific capabilities.

      Returns:
      declared capability strings, empty array if none
      Default:
      {}
    • autoStart

      boolean autoStart
      Whether the runtime should start this agent automatically after registration.

      Set to false for agents that should be started manually or on demand. Defaults to true.

      Returns:
      true to start automatically, false for manual start
      Default:
      true