Annotation Interface Agent


@Target(TYPE) @Retention(RUNTIME) public @interface Agent
Declares a class as an AI agent.

An agent is a CDI bean that encapsulates autonomous, goal-driven behavior. The agent's lifecycle, workflow, and actions are fully defined using additional annotations.

Agents support two scope annotations: WorkflowScoped and @ApplicationScoped. If no scope annotation is present on the class, the agent will be assumed to be WorkflowScoped.

A workflow context will still be created for each workflow execution even when the agent is @ApplicationScoped, beginning with a trigger and in most cases ending with an outcome. Any conversational state maintained by injected LargeLanguageModel implementations is expected to follow this workflow context lifecycle.

Since:
1.0
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The agent's description.
    The agent's name.
  • Element Details

    • name

      String name
      The agent's name.

      If not specified, the simple class name with the first letter lowercased will be used as a default (e.g., MyAgent becomes myAgent).

      Returns:
      the configured agent name, or an empty string to use the default derived name
      Default:
      ""
    • description

      String description
      The agent's description.

      Used for documentation and discovery purposes.

      Returns:
      the agent description, or an empty string if none is provided
      Default:
      ""