# `Jido.AI.Reasoning.ReAct.Strategy`
[🔗](https://github.com/agentjido/jido_ai/blob/v2.4.0/lib/jido_ai/reasoning/react/strategy.ex#L1)

ReAct strategy delegated to an internal per-parent worker agent.

The parent strategy remains the public orchestration boundary (`ask/await/ask_sync`),
while runtime execution is delegated to a lazily spawned child worker tagged
`:react_worker`.

## Delegation Model

1. Parent receives `"ai.react.query"` and prepares runtime config/context.
2. Parent lazily spawns internal worker on first request (if needed).
3. Parent emits `"ai.react.worker.start"` to worker.
4. Worker streams `Jido.AI.Reasoning.ReAct` events and emits `"ai.react.worker.event"` to parent.
5. Parent applies runtime events to parent state and emits external lifecycle/LLM/tool signals.

## Worker Lifecycle

- Child tag is fixed as `:react_worker`.
- Single active run is enforced (`:reject` busy policy).
- Worker crash during active request marks the request failed.
- No machine-driven fallback path is retained.

## Trace Retention

Parent stores per-request runtime event history in `request_traces` with a hard cap:

    %{request_id => %{events: [event, ...], truncated?: boolean()}}

Once 2000 events are stored for a request, `truncated?` is set to `true`
and new events are not appended.

# `config`

```elixir
@type config() :: %{
  tools: [module()],
  reqllm_tools: [ReqLLM.Tool.t()],
  actions_by_name: %{required(String.t()) =&gt; module()},
  request_transformer: module() | nil,
  agent_module: module(),
  system_prompt: String.t(),
  model: String.t(),
  max_iterations: pos_integer(),
  max_tokens: pos_integer(),
  streaming: boolean(),
  base_tool_context: map(),
  skill_diagnostics: Jido.AI.Skill.Diagnostics.t(),
  base_req_http_options: list(),
  base_llm_opts: keyword(),
  provider_opt_keys_by_string: %{optional(String.t()) =&gt; atom()},
  request_policy: :reject,
  stream_timeout_ms: non_neg_integer(),
  stream_receive_timeout_ms: pos_integer(),
  stream_timeout_ms: non_neg_integer(),
  stream_receive_timeout_ms: pos_integer(),
  tool_heartbeat_ms: non_neg_integer(),
  tool_timeout_ms: pos_integer(),
  tool_max_retries: non_neg_integer(),
  tool_retry_backoff_ms: non_neg_integer(),
  effect_policy: map(),
  output: Jido.AI.Output.t() | nil,
  observability: map(),
  runtime_adapter: true,
  runtime_task_supervisor: pid() | atom() | nil,
  agent_id: String.t() | nil
}
```

# `cancel_action`

```elixir
@spec cancel_action() :: :ai_react_cancel
```

Returns the action atom for request cancellation.

# `context_modify_action`

```elixir
@spec context_modify_action() :: :ai_react_context_modify
```

Returns the canonical action atom for context lifecycle operations.

# `inject_action`

```elixir
@spec inject_action() :: :ai_react_inject
```

Returns the action atom for injecting user-style input into an active ReAct request.

# `list_tools`

```elixir
@spec list_tools(Jido.Agent.t()) :: [module()]
```

Returns the list of currently registered tools for the given agent.

# `llm_partial_action`

```elixir
@spec llm_partial_action() :: :ai_react_llm_partial
```

Returns the legacy action atom for handling streaming deltas (no-op in delegated mode).

# `llm_result_action`

```elixir
@spec llm_result_action() :: :ai_react_llm_result
```

Returns the legacy action atom for handling LLM results (no-op in delegated mode).

# `register_tool_action`

```elixir
@spec register_tool_action() :: :ai_react_register_tool
```

Returns the action atom for registering a tool dynamically.

# `request_error_action`

```elixir
@spec request_error_action() :: :ai_react_request_error
```

Returns the action atom for handling request rejections.

# `runtime_event_action`

```elixir
@spec runtime_event_action() :: :ai_react_runtime_event
```

Returns the legacy action atom for direct runtime stream events (no-op in delegated mode).

# `set_system_prompt_action`

```elixir
@spec set_system_prompt_action() :: :ai_react_set_system_prompt
```

Returns the action atom for updating the base system prompt.

# `set_tool_context_action`

```elixir
@spec set_tool_context_action() :: :ai_react_set_tool_context
```

Returns the action atom for updating tool context.

# `start_action`

```elixir
@spec start_action() :: :ai_react_start
```

Returns the action atom for starting a ReAct conversation.

# `steer_action`

```elixir
@spec steer_action() :: :ai_react_steer
```

Returns the action atom for steering an active ReAct request.

# `tool_result_action`

```elixir
@spec tool_result_action() :: :ai_react_tool_result
```

Returns the legacy action atom for handling tool results (no-op in delegated mode).

# `unregister_tool_action`

```elixir
@spec unregister_tool_action() :: :ai_react_unregister_tool
```

Returns the action atom for unregistering a tool.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
