Guava.Testing (Guava v0.36.0)

Copy Markdown View Source

Drive an agent module against Guava's v1/test-agent endpoint — no phone needed.

Guava.Testing.session(MyAgent, fn session ->
  Guava.Testing.Session.say(session, "Hi, what are your hours?")
  Guava.Testing.Session.wait_for_turn(session)
  Guava.Testing.Session.evaluate(session, ["The agent gave hours."], [])
end)

Or let an LLM roleplay the caller with roleplay/3.

For fast, offline unit tests of individual callbacks — no network, no LLM — use Guava.Testing.MockCall (also reachable as mock_call/1):

mock = Guava.Testing.mock_call()
{:noreply, _state} = MyAgent.handle_call_started(mock.call, MyAgent.initial_state())
assert [%Guava.Commands.SetTask{task_id: "intake"}] = Guava.Testing.MockCall.commands(mock)

Summary

Functions

Build an in-memory Guava.Testing.MockCall for unit-testing callbacks offline. Convenience for Guava.Testing.MockCall.new/1; see that module for the full API.

Run an automated roleplay where an LLM plays the caller. Returns the (still-running) session so you can Guava.Testing.Session.evaluate/3 then Guava.Testing.Session.stop/1.

Run agent_module against a live test session and pass the session to fun. The session is stopped when fun returns.

Functions

mock_call(opts \\ [])

@spec mock_call(keyword()) :: Guava.Testing.MockCall.t()

Build an in-memory Guava.Testing.MockCall for unit-testing callbacks offline. Convenience for Guava.Testing.MockCall.new/1; see that module for the full API.

roleplay(agent_module, roleplay_prompt, opts \\ [])

@spec roleplay(module(), String.t(), keyword()) :: pid()

Run an automated roleplay where an LLM plays the caller. Returns the (still-running) session so you can Guava.Testing.Session.evaluate/3 then Guava.Testing.Session.stop/1.

session(agent_module, fun, opts \\ [])

@spec session(module(), (pid() -> result), keyword()) :: result when result: var

Run agent_module against a live test session and pass the session to fun. The session is stopped when fun returns.

Options