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

Chain-of-Thought strategy delegated to an internal per-parent worker agent.

The parent strategy remains the orchestration boundary while a lazily spawned
child worker (`:cot_worker`) owns runtime execution and streaming.

## Delegation Model

1. Parent receives `"ai.cot.query"` and prepares worker payload.
2. Parent lazily spawns internal worker on first request (if needed).
3. Parent emits `"ai.cot.worker.start"` to worker.
4. Worker performs one CoT LLM turn and emits `"ai.cot.worker.event"` envelopes.
5. Parent applies worker events to CoT state and preserves external API.

## Request Lifecycle Contract

- Runtime worker events are normalized into lifecycle transitions:
  `request_started`, `request_completed`, `request_failed`, `request_cancelled`.
- LLM stream events (`llm_started`, `llm_delta`, `llm_completed`) update snapshot fields
  and emit canonical lifecycle signals (`ai.llm.delta`, `ai.llm.response`, `ai.usage`).
- Concurrency policy defaults to `request_policy: :reject`; concurrent requests emit
  `ai.request.error` with `reason: :busy`.
- Request traces are retained in bounded in-memory state (cap: 2000
  events per request, then marked truncated).

# `config`

```elixir
@type config() :: %{
  system_prompt: String.t(),
  model: String.t(),
  request_policy: :reject,
  llm_timeout_ms: pos_integer() | nil,
  runtime_task_supervisor: pid() | atom() | nil,
  observability: map(),
  runtime_adapter: true
}
```

# `get_conclusion`

```elixir
@spec get_conclusion(Jido.Agent.t()) :: String.t() | nil
```

Returns the conclusion from the agent's current state.

# `get_raw_response`

```elixir
@spec get_raw_response(Jido.Agent.t()) :: String.t() | nil
```

Returns the raw LLM response from the agent's current state.

# `get_steps`

```elixir
@spec get_steps(Jido.Agent.t()) :: [Jido.AI.Reasoning.ChainOfThought.Machine.step()]
```

Returns the extracted reasoning steps from the agent's current state.

# `llm_partial_action`

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

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

# `llm_result_action`

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

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

# `request_error_action`

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

Returns the action atom for handling request rejection events.

# `start_action`

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

Returns the action atom for starting a CoT reasoning session.

---

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