Agentix.Test (Agentix v0.1.0)

Copy Markdown View Source

Test helpers for driving agents deterministically without an API key.

import Agentix.Test in your test module to get:

These run async: false (the mock provider is globally named and the audit/provider config is process-global).

Summary

Functions

Asserts the conversation is suspended on a pending tool call named tool_name.

Asserts the conversation's log contains a :tool_call event for tool_name.

Builds a response spec for the mock provider.

Installs the mock provider (sets config :agentix, :provider and starts it). Safe to call repeatedly — resets the script if already running.

Functions

assert_suspended_on(conversation_id, tool_name)

@spec assert_suspended_on(String.t(), String.t()) :: true

Asserts the conversation is suspended on a pending tool call named tool_name.

assert_tool_called(conversation_id, tool_name)

@spec assert_tool_called(String.t(), String.t()) :: true

Asserts the conversation's log contains a :tool_call event for tool_name.

completion(text, opts \\ [])

@spec completion(
  String.t(),
  keyword()
) :: map()

Builds a response spec for the mock provider.

Options: :tool_calls (a list of {name, arguments_map}), :thinking (reasoning text), :usage (a usage map). Pass the result to Agentix.Test.MockProvider.script/1.

install_mock_provider()

@spec install_mock_provider() :: :ok

Installs the mock provider (sets config :agentix, :provider and starts it). Safe to call repeatedly — resets the script if already running.