Annotation Interface Agent


@Retention(RUNTIME) @Target(METHOD) public @interface Agent
Java methods annotated with @Agent are considered agents that other agents can invoke.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    If true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result.
    Description of the agent.
    Name of the agent.
    Key of the output variable that will be used to store the result of the agent's invocation.
    Names of other agents participating in the definition of the context of this agent.
    Class<? extends TypedKey<?>>
     
    Description of the agent.
  • Element Details

    • name

      String name
      Name of the agent. If not provided, method name will be used.
      Returns:
      name of the agent.
      Default:
      ""
    • value

      String value
      Description of the agent. This is an alias of the description attribute, and it is possible to use either. It should be clear and descriptive to allow language model to understand the agent's purpose and its intended use.
      Returns:
      description of the agent.
      Default:
      ""
    • description

      String description
      Description of the agent. This is an alias of the value attribute, and it is possible to use either. It should be clear and descriptive to allow language model to understand the agent's purpose and its intended use.
      Returns:
      description of the agent.
      Default:
      ""
    • outputKey

      String outputKey
      Key of the output variable that will be used to store the result of the agent's invocation.
      Returns:
      name of the output variable.
      Default:
      ""
    • typedOutputKey

      Class<? extends TypedKey<?>> typedOutputKey
      Default:
      dev.langchain4j.agentic.Agent.NoTypedKey.class
    • async

      boolean async
      If true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result.
      Returns:
      true if the agent should be invoked in an asynchronous manner, false otherwise.
      Default:
      false
    • summarizedContext

      String[] summarizedContext
      Names of other agents participating in the definition of the context of this agent.
      Returns:
      array of names of other agents participating in the definition of the context of this agent.
      Default:
      {}