# `Jido.AI.Test`
[🔗](https://github.com/agentjido/jido_ai/blob/v2.4.0/lib/jido_ai/test.ex#L1)

Public test helpers for deterministic Jido.AI ReAct tests.

`expect_react/1` scripts the model boundary while the application still runs
its real ReAct runtime, tools, event projection, and assertions.

    expect_react do
      user "summarize README"
      call "read", %{path: "README.md"}
      answer "README says Hello."
    end

The script is registered for the current test process tree and matched by the
latest user prompt. For code that starts agents outside that tree, pass the
returned script explicitly:

    script =
      expect_react do
        user "summarize README"
        answer "README says Hello."
      end

    MyAgent.ask_sync(pid, "summarize README", react_opts(script))

# `answer`

```elixir
@spec answer(term(), keyword()) :: :ok
```

Adds the final scripted model answer.

# `assert_final_answer`

```elixir
@spec assert_final_answer(map() | [map()], String.t() | Regex.t()) :: map() | [map()]
```

Asserts that a collected ReAct result or event list ended with `expected`.

# `assert_no_runtime_failure`

```elixir
@spec assert_no_runtime_failure(map() | [map()]) :: map() | [map()]
```

Asserts that a ReAct trace has no terminal runtime failure or cancellation.

# `assert_tool_called`

```elixir
@spec assert_tool_called(map() | [map()], String.t() | atom(), map() | :any) ::
  map() | [map()]
```

Asserts that the ReAct trace includes a model-requested tool call.

# `call`

```elixir
@spec call(String.t() | atom(), map(), keyword()) :: :ok
```

Adds a scripted model tool call.

# `expect_react`
*macro* 

Starts a deterministic ReAct script and registers it for the current test.

# `fail`

```elixir
@spec fail(term(), keyword()) :: :ok
```

Adds a terminal scripted model failure.

# `react_llm_opts`

```elixir
@spec react_llm_opts(Jido.AI.Test.ReActScript.t()) :: keyword()
```

Returns ReqLLM generation opts for an explicit script.

# `react_opts`

```elixir
@spec react_opts(Jido.AI.Test.ReActScript.t()) :: keyword()
```

Returns ReAct runtime opts for an explicit script.

# `reset_react_scripts`

```elixir
@spec reset_react_scripts() :: :ok
```

Clears scripts registered by the current test process tree.

# `user`

```elixir
@spec user(term()) :: :ok
```

Adds the expected initial user prompt for a ReAct test script.

---

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