Class SampleTools

java.lang.Object
com.inductiveautomation.eventstream.designer.ai.tools.SampleTools

public final class SampleTools extends Object

The package's one public face: hands out the on-demand sample tools an Event Stream script-assist agent installs, keyed by the surface being edited.

Everything behind it — which tool a surface gets, what a sample fetch has to run to produce one, and how the outcome is worded for the model — is this package's business and stays package-private. A caller supplies what only the Designer knows (the RPC, the resource's coordinates, and an EDT-only read of the configuration as currently edited) and gets back tools it never has to look inside.

Threading

Construction is free and thread-agnostic; nothing is read until a tool is called. The returned tools each run a blocking Gateway round-trip, so they must be invoked off the Event Dispatch Thread — which is where the agent's tool loop calls them. See SampleFetcher for how a fetch straddles the two threads.

  • Constructor Details

    • SampleTools

      public SampleTools(EventStreamRpc rpc, String projectName, String resourceFolderPath, Supplier<@Nullable EventStreamConfig> liveConfig)
      Parameters:
      rpc - the Gateway RPC used to encode the stream's last captured events.
      projectName - the project the Event Stream resource belongs to.
      resourceFolderPath - the Event Stream resource's folder path.
      liveConfig - the Event Stream configuration as currently edited, or null when it cannot be read. Invoked on the EDT on every fetch, so a sample tracks mid-session edits.
  • Method Details

    • forSurface

      public List<CallableTool> forSurface(EventStreamSurface surface)

      The sample tool surface should install.

      EventStreamSurface.FILTER gets the argument-less tool: it is the one surface upstream of the Filter, so nothing can stop its sample from arriving and there is no choice to express. Every surface downstream of the Filter gets the filterable tool, whose applyFilter argument lets an agent bypass a Filter that would otherwise starve the sample.