Class ComposedAgent

java.lang.Object
com.inductiveautomation.ignition.common.ai.ComposedAgent
All Implemented Interfaces:
Agent

public final class ComposedAgent extends Object implements Agent
Agent composed from named slots — a preamble and framing for the system prompt, a series of ToolBundles, and a series of AdditionalContextParts. All slots are evaluated once when ComposedAgent.Builder.build() is invoked; freshness comes from the surrounding Agent.AgentFactory rebuilding the agent at each click.

A builder seeded with a base agent extends that agent additively: the base's system prompt is rendered before any builder-supplied preamble/framing, the base's tools are placed before builder-supplied bundles, and the base's additional context is prepended to builder-supplied sections. Identity (typeId, name, description) and the turn limit default to the base's values; any may be overridden via the matching builder method.

Example — extending a base agent the caller already holds:

Agent agent = ComposedAgent.builder(baseAgent)
    .typeId("com.example.scripting.extension")
    .framing(EXTENSION_FUNCTION_BODY_FRAMING)
    .contextSection("Function signature", () -> renderSignature(descriptor))
    .contextSection("Caller context", () -> callerContext)
    .build();

Factories such as PlatformAgentFactory return a pre-seeded ComposedAgent.Builder directly, so callers chain customizations on the factory result without re-wrapping through this static.

  • Method Details

    • builder

      public static ComposedAgent.Builder builder(String typeId, String name)
      Parameters:
      typeId - stable type identifier for this agent type. Useful for diagnostics and routing.
      name - human-readable name used in logs and routing.
      Returns:
      a new builder seeded with the given identity. ComposedAgent.Builder.description must be called before ComposedAgent.Builder.build().
    • builder

      public static ComposedAgent.Builder builder(Agent base)
      Seeds a builder that extends base additively. The base's system prompt becomes the outermost layer of the rendered prompt; its tools are concatenated before any builder-supplied bundles; its additional context is rendered before any builder-supplied sections. Identity (typeId, name, description) and the turn limit default to the base's; call ComposedAgent.Builder.typeId, ComposedAgent.Builder.name, ComposedAgent.Builder.description, or ComposedAgent.Builder.maxTurnsPerInvocation to override.
      Parameters:
      base - the agent to extend; its accessors are read at ComposedAgent.Builder.build() time.
      Returns:
      a new builder seeded from base.
    • getTypeId

      public String getTypeId()
      Description copied from interface: Agent
      Stable type identifier for this agent type. Useful for diagnostics and routing.
      Specified by:
      getTypeId in interface Agent
    • getName

      public String getName()
      Description copied from interface: Agent
      Human-readable name used in logs and routing.
      Specified by:
      getName in interface Agent
    • getDescription

      public String getDescription()
      Description copied from interface: Agent
      Human and Agent readable description used in logs and routing.
      Specified by:
      getDescription in interface Agent
    • getSystemPrompt

      public String getSystemPrompt()
      Description copied from interface: Agent
      System prompt that primes the model for this agent's role.
      Specified by:
      getSystemPrompt in interface Agent
    • getTools

      public List<CallableTool> getTools()
      Description copied from interface: Agent
      Callable tools exposed to the model. Typically built from Tool-annotated methods via Tools.fromAnnotated(Object...), but may include hand-rolled CallableTool implementations. Returns an empty list if the agent declares no tools.
      Specified by:
      getTools in interface Agent
    • getAdditionalContext

      public Optional<String> getAdditionalContext()
      Description copied from interface: Agent
      Supplemental context to be folded into the prompt (e.g. project state, schema, current selection), or empty if none is provided.
      Specified by:
      getAdditionalContext in interface Agent
    • getMaxTurnsPerInvocation

      public int getMaxTurnsPerInvocation()
      Description copied from interface: Agent
      Maximum number of model turns — tool-calling rounds — the harness runs in a single invocation before it stops the loop. A single turn may run several tools at once, so this bounds rounds, not individual tool calls. Defaults to 20; agents backed by user config override this with their configured value. The harness additionally caps this at its own hard ceiling.
      Specified by:
      getMaxTurnsPerInvocation in interface Agent