Class EmbabelRemoteActionsDeployer

java.lang.Object
ai.badmonkey.agentspaces.embabel.EmbabelRemoteActionsDeployer
All Implemented Interfaces:
AutoCloseable

public final class EmbabelRemoteActionsDeployer extends Object implements AutoCloseable
Keeps the Embabel platform's view of the fleet current (spec §10.6, auto-deploy): once started with a platform handed to deployWhenReady(Object), it watches the bridge's remote-action registry and deploys a freshly generated @Agent through EmbabelRemoteActions.deployTo(Object) whenever the set of actions changes — the first time cards arrive, when a new card brings a new capability, and when an expired card takes one away. Card refreshes that change nothing but the issue time do not redeploy.

Framework-neutral: no Spring type appears here. The Spring starter wraps it in a SmartLifecycle that calls deployWhenReady(Object) with the AgentPlatform bean and then start(); any other host calls the same two methods. Detection is by polling the registry on a virtual thread at the configured interval, which is the ad-cache's own view of card arrival and expiry.

Embabel's platform has no undeploy in the surface this module reaches, so an action that disappears is removed from the next generated agent while the previously deployed generation stays registered until the platform restarts; invoking one of its vanished actions times out and throws, which the planner treats as the action failing.

  • Constructor Details

    • EmbabelRemoteActionsDeployer

      public EmbabelRemoteActionsDeployer(EmbabelRemoteActions bridge, Duration pollInterval)
      Creates the deployer.
      Parameters:
      bridge - the remote-actions bridge that generates the agent
      pollInterval - how often to check the registry for changes
  • Method Details

    • deployWhenReady

      public EmbabelRemoteActionsDeployer deployWhenReady(Object agentPlatform)
      Names the platform to deploy onto (Embabel's AgentPlatform, typed as Object so this module needs no Embabel artifact). May be called before or after start(); when the watcher is already running, the current action set is deployed at once.
      Parameters:
      agentPlatform - the platform
      Returns:
      this deployer
    • start

      public void start()
      Starts watching the registry. Idempotent. Nothing deploys until a platform is known through deployWhenReady(Object).
    • stop

      public void stop()
      Stops watching. Idempotent; already deployed generations stay deployed.
    • isRunning

      public boolean isRunning()
      Returns whether the watcher is running.
    • deployments

      public int deployments()
      Returns how many generations have been deployed so far.
    • checkNow

      public boolean checkNow()
      Compares the registry with the last deployed generation and deploys a new one when the action set changed and a platform is known. Hosts that drive their own cadence may call this instead of start().
      Returns:
      true when a new generation was deployed
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable