mix req_managed_agents.agent_core.smoke (ReqManagedAgents v0.1.0)

Copy Markdown View Source

Drives the full req_managed_agents AgentCore Harness client stack end-to-end as a single repeatable command — no live AWS needed.

What it covers

The stub Req adapter intercepts at the transport seam so SigV4 signing, JSON encoding, EventStream decoding, Converse parsing, and the tool→resume loop all run in-process against real production code. The adapter returns valid event-stream binary frames for each turn; the loop runs to an end_turn terminal.

Eight stages are verified:

  1. SigV4 header well-formedSigV4.sign_request/4 produces authorization + x-amz-date headers.
  2. EventStream multi-frame + remainder — decode two complete frames and a 5-byte truncated third; expect 2 messages and a non-empty remainder.
  3. Converse.inline_function shape — a NimbleOptions schema maps to a config.inlineFunction.inputSchema (bare JSON Schema, no json wrapper) with the expected property.
  4. SigV4 signed — every invoke_harness request carried an AWS4-HMAC-SHA256 Authorization header.
  5. tool_use decoded+parsed — the loop actually ran the tool (the resume turn fired).
  6. strict resume contract — the resume body contained BOTH assistant (toolUse) and user (toolResult) roles (the harness does not persist the model's streamed response, so we echo it back).
  7. tool text round-trip — the toolResult text in the resume body equals "echoed: hi".
  8. terminal end_turninvoke_to_completion returned {:ok, %{terminal: :end_turn, stop_reason: "end_turn"}}.

Usage

mix req_managed_agents.agent_core.smoke

Exits 0 on all-pass, non-zero on any failure.

Summary

Functions

Pure smoke flow — returns {:ok, results} or {:error, results} where results is a list of {stage_name, :pass | :fail, detail}.

Functions

run_smoke()

@spec run_smoke() ::
  {:ok, [{String.t(), :pass | :fail, String.t()}]}
  | {:error, [{String.t(), :pass | :fail, String.t()}]}

Pure smoke flow — returns {:ok, results} or {:error, results} where results is a list of {stage_name, :pass | :fail, detail}.

Does not print or halt; suitable for calling directly from tests.