Skip to navigation

nemo_gym.agents.testing.agent_session_conformance

View as Markdown

Integration test for how an agent refuses an agent session seed it cannot serve.

check_agent_seed_rejected posts the seed through the app’s real /v1/agent_sessions route, in process, the way an Environment Server calls a deployed agent. Call it from an agent’s own tests with a seed that agent does not support, such as a sandbox or a required grant it cannot use.

Module Contents

Functions

NameDescription
check_agent_seed_rejectedSeed seed through app, and raise AssertionError unless the agent refuses it as terminal.

API

nemo_gym.agents.testing.agent_session_conformance.check_agent_seed_rejected(
app: fastapi.FastAPI,
) -> str

Seed seed through app, and raise AssertionError unless the agent refuses it as terminal.

The refusal must be HTTP 422 with a string detail, which is what AgentSeedRejectedError gives, so the Environment Server fails the episode once with the agent’s reason. A plain ValueError gives 500, which is retried. Returns the refusal’s detail for the caller to check.