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.

      The value must be unique within the runtime: it is the address the agent is sent messages at, registered in the directory under, and published as the sender of its own messages. A class annotated with a fixed id and instantiated twice therefore produces two agents claiming one address.

      When left empty, BaseAgent generates a random UUID — which is also what an agent gets when it is not annotated at all. There is no class-name default. This Javadoc promised one, in kebab-case, until 0.34.0; nothing ever implemented it, and a default derived from the class would give every instance of a class the same address.

      A subclass that passes its own id to super(...) overrides this value, because an explicit instance id is the authoritative one — that is how an agent class instantiated several times gets distinct addresses.

      Returns:
      the agent identifier, or empty string for a generated one
      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