AgentForge.Runtime (AgentForge v0.2.2)

View Source

Provides the runtime environment for executing flows in the AgentForge system.

Summary

Functions

Creates a new runtime configuration for a flow.

Creates a new runtime configuration that maintains state between executions.

Executes a flow with the given signal and options.

Executes a flow with execution limits.

Gets statistics from the last flow execution.

Types

runtime_options()

@type runtime_options() :: [
  collect_stats: boolean(),
  debug: boolean(),
  max_steps: non_neg_integer() | :infinity,
  name: String.t(),
  return_stats: boolean(),
  store_name: atom(),
  store_prefix: String.t(),
  timeout: non_neg_integer() | :infinity
]

Functions

configure(flow, opts \\ [])

@spec configure(AgentForge.Flow.flow(), runtime_options()) ::
  (AgentForge.Signal.t() ->
     {:ok, term(), term()}
     | {:error, term()})

Creates a new runtime configuration for a flow.

configure_stateful(flow, opts \\ [])

@spec configure_stateful(AgentForge.Flow.flow(), runtime_options()) ::
  (AgentForge.Signal.t() ->
     {:ok, term(), term()}
     | {:error, term()})

Creates a new runtime configuration that maintains state between executions.

execute(flow, signal, opts \\ [])

@spec execute(AgentForge.Flow.flow(), AgentForge.Signal.t(), runtime_options()) ::
  {:ok, AgentForge.Signal.t() | term(), term()} | {:error, term()}

Executes a flow with the given signal and options.

execute_with_limits(flow, signal, opts \\ [])

@spec execute_with_limits(
  AgentForge.Flow.flow(),
  AgentForge.Signal.t(),
  runtime_options()
) ::
  {:ok, AgentForge.Signal.t() | term(), term()}
  | {:ok, AgentForge.Signal.t() | term(), term(), AgentForge.ExecutionStats.t()}
  | {:error, term(), term()}
  | {:error, term(), term(), AgentForge.ExecutionStats.t()}

Executes a flow with execution limits.

Enforces limits on execution (maximum steps and timeout) to prevent infinite loops and long-running processes. Integrates with Store for state persistence between executions.

Options

  • :timeout_ms - Maximum execution time in milliseconds (default: 30000)
  • :collect_stats - Whether to collect execution statistics (default: true)
  • :return_stats - Whether to include stats in the return value (default: false)
  • :debug - Whether to enable debugging (default: false)
  • :name - Name for debugging output (default: "flow")
  • :store_prefix - Prefix for store keys (default: "flow")
  • :store_name - Name of the store to use
  • :store_key - Key within the store to access state
  • :initial_state - Initial state to use for execution

get_last_execution_stats()

Gets statistics from the last flow execution.