Jido.AI.Reasoning.ReAct.Config (Jido AI v2.3.0)

Copy Markdown View Source

Canonical configuration for the Task-based ReAct runtime.

Summary

Functions

Returns a stable config fingerprint used by checkpoint tokens.

Merge request-scoped LLM option overrides into an existing normalized option list.

Build a runtime config from options.

Convert runtime tools to ReqLLM tool definitions.

Returns the effective stream consumer timeout.

Returns the tool-execution heartbeat interval in milliseconds.

Types

t()

@type t() :: %Jido.AI.Reasoning.ReAct.Config{
  effect_policy: any(),
  llm: %{
    optional(:timeout_ms) => nil | integer(),
    max_tokens: integer(),
    temperature: number(),
    req_http_options: [any()],
    tool_choice: any(),
    llm_opts: any()
  },
  max_iterations: integer(),
  model: any(),
  observability: %{
    emit_telemetry?: boolean(),
    emit_signals?: boolean(),
    redact_tool_args?: boolean()
  },
  output: nil | nil | any(),
  pending_input_server: nil | nil | any(),
  request_transformer: nil | nil | atom(),
  stream_timeout_ms: integer(),
  streaming: boolean(),
  system_prompt: nil | nil | binary(),
  token: %{
    :secret => binary(),
    optional(:ttl_ms) => nil | integer(),
    compress?: boolean()
  },
  tool_exec: %{
    concurrency: integer(),
    max_retries: integer(),
    timeout_ms: integer(),
    retry_backoff_ms: integer()
  },
  tool_heartbeat_ms: integer(),
  tools: map(),
  trace: %{
    capture_deltas?: boolean(),
    capture_thinking?: boolean(),
    capture_messages?: boolean()
  },
  version: integer()
}

Functions

fingerprint(config)

@spec fingerprint(t()) :: String.t()

Returns a stable config fingerprint used by checkpoint tokens.

llm_opts(config)

@spec llm_opts(t()) :: keyword()

Convert config to generation options for ReqLLM.Generation.stream_text/3 and ReqLLM.Generation.generate_text/3.

merge_llm_opts(config, base_opts, overrides)

@spec merge_llm_opts(t(), keyword(), keyword() | map() | nil) :: keyword()

Merge request-scoped LLM option overrides into an existing normalized option list.

The 3-arg form validates provider_options overrides against the compile-time config.model's schema. The 4-arg form takes an explicit model_override so per-turn provider swaps (via a request_transformer returning :model) can validate against the runtime provider's schema instead.

merge_llm_opts(config, base_opts, overrides, model_override)

@spec merge_llm_opts(t(), keyword(), keyword() | map() | nil, term() | nil) ::
  keyword()

new(opts \\ %{})

@spec new(map() | keyword()) :: t()

Build a runtime config from options.

reqllm_tools(config)

@spec reqllm_tools(t()) :: [ReqLLM.Tool.t()]

Convert runtime tools to ReqLLM tool definitions.

stream_timeout(config)

@spec stream_timeout(t()) :: pos_integer()

Returns the effective stream consumer timeout.

When stream_timeout_ms is 0 (default), auto-derives from tool_exec.timeout_ms + 60_000 to ensure the stream consumer outlives the longest possible tool execution plus LLM response time.

tool_heartbeat_ms(config)

@spec tool_heartbeat_ms(t()) :: non_neg_integer()

Returns the tool-execution heartbeat interval in milliseconds.

When > 0, the ReAct runner emits a :keepalive event every interval while tools are executing, so a consumer that sets a short stream_event_timeout_ms on Jido.AI.Request.Stream.events/2 does not time out during a long-running tool call. 0 (default) disables heartbeats.