Class AgenorRuntime.Builder

java.lang.Object
dev.agenor.runtime.AgenorRuntime.Builder
Enclosing class:
AgenorRuntime

public static class AgenorRuntime.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • fromFilesystemConfig

      public AgenorRuntime.Builder fromFilesystemConfig(String configPath)
      Load configuration from the YAML / JSON file
      Parameters:
      configPath - path to a configuration file
      Returns:
      this builder
      Throws:
      ConfigurationException - if loading fails or the configuration is invalid
    • fromClasspathConfig

      public AgenorRuntime.Builder fromClasspathConfig(String resourcePath)
      Load configuration from a classpath resource
      Parameters:
      resourcePath - classpath resource path
      Returns:
      this builder
      Throws:
      ConfigurationException - if loading fails
    • withConfiguration

      public AgenorRuntime.Builder withConfiguration(AgenorConfiguration config)
      Use the provided configuration object
      Parameters:
      config - the configuration to use
      Returns:
      this builder
      Throws:
      ConfigurationException - if the configuration is null or invalid
    • withDefaultConfig

      public AgenorRuntime.Builder withDefaultConfig()
      Load the default configuration (agenor.yml from filesystem or classpath)
      Returns:
      this builder
      Throws:
      ConfigurationException - if loading fails or the configuration is invalid
    • messageDispatcher

      public AgenorRuntime.Builder messageDispatcher(MessageDispatcher dispatcher)
      Sets the message dispatcher.
      Parameters:
      dispatcher - the dispatcher to use; must not be null
      Returns:
      this builder
      Since:
      0.20.0
    • deadLetterQueue

      public AgenorRuntime.Builder deadLetterQueue(DeadLetterQueue deadLetterQueue)
      Sets where the runtime records a message whose delivery it gave up on.

      Defaults to a bounded InMemoryDeadLetterQueue. The runtime wires this into a dispatcher it builds itself. A dispatcher supplied through messageDispatcher(MessageDispatcher) has to be given the same instance through its own configuration, or the runtime and the transport will each hold a view of a different set of failures.

      Parameters:
      deadLetterQueue - the queue; null restores the default
      Returns:
      this builder
      Since:
      0.32.0
    • agentRegistry

      public AgenorRuntime.Builder agentRegistry(AgentRegistry registry)
      Sets the agent registry capability.

      When individual capability setters are used, the runtime assembles a composite directory from all provided capabilities.

      Parameters:
      registry - the registry implementation; must not be null
      Returns:
      this builder
      Since:
      0.20.0
    • agentResolver

      public AgenorRuntime.Builder agentResolver(AgentResolver resolver)
      Sets the agent resolver capability.
      Parameters:
      resolver - the resolver implementation; must not be null
      Returns:
      this builder
      Since:
      0.20.0
    • agentDiscovery

      public AgenorRuntime.Builder agentDiscovery(AgentDiscovery discovery)
      Sets the agent discovery capability.
      Parameters:
      discovery - the discovery implementation; must not be null
      Returns:
      this builder
      Since:
      0.20.0
    • agentPresence

      public AgenorRuntime.Builder agentPresence(AgentPresence presence)
      Sets the agent presence capability.
      Parameters:
      presence - the presence implementation; must not be null
      Returns:
      this builder
      Since:
      0.20.0
    • heartbeatInterval

      public AgenorRuntime.Builder heartbeatInterval(Duration interval)
      Turns on periodic heartbeats for the agents this runtime runs (ADR-028 D-3).

      Off unless called. A presence backend that expires entries needs this — or an unbounded staleness window — or it will report every agent as AgentStatus.UNKNOWN one window after start-up. The recommended cadence is 15–30 seconds, roughly a third of the backend's window.

      Parameters:
      interval - the cadence between heartbeats; must be positive
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if interval is zero or negative
      Since:
      0.26.0
    • behaviorScheduler

      public AgenorRuntime.Builder behaviorScheduler(BehaviorScheduler behaviorScheduler)
    • memoryStore

      public AgenorRuntime.Builder memoryStore(MemoryStore memoryStore)
    • llmMemoryManagerFactory

      public AgenorRuntime.Builder llmMemoryManagerFactory(Function<String,LLMMemoryManager> factory)
    • telemetry

      public AgenorRuntime.Builder telemetry(AgenorTelemetry telemetry)
      Sets the telemetry instance used to emit spans for LLM calls, guardrails, behavior execution, and HITL approvals.
      Parameters:
      telemetry - the telemetry instance; null uses noop
      Returns:
      this
      Since:
      0.19.0
    • approvalGate

      public AgenorRuntime.Builder approvalGate(ApprovalGate gate)
      Sets the approval gate used for HITL workflows.

      Defaults to an in-memory gate supplied by agenor-runtime-ext when not set, or null if that module is absent. Provide a persistent implementation (e.g. JdbcApprovalGate) to survive JVM restarts.

      Parameters:
      gate - the approval gate; must not be null
      Returns:
      this
      Since:
      0.23.0
    • scanPackage

      public AgenorRuntime.Builder scanPackage(String packageName)
    • scanPackages

      public AgenorRuntime.Builder scanPackages(String... packageNames)
    • scanPackages

      public AgenorRuntime.Builder scanPackages(Collection<String> packageNames)
    • service

      public <T> AgenorRuntime.Builder service(Class<T> serviceClass, T instance)
    • build

      public AgenorRuntime build()