nemo_gym.base_responses_api_agent

View as Markdown

Module Contents

Classes

API

class nemo_gym.base_responses_api_agent.BaseResponsesAPIAgent()

Bases: BaseServer

config
BaseResponsesAPIAgentConfig
class nemo_gym.base_responses_api_agent.BaseResponsesAPIAgentConfig()
class nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent()

Bases: BaseResponsesAPIAgent, AggregateMetricsMixin, SimpleServer

config
BaseResponsesAPIAgentConfig
nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent._model_call_capture_enabled() -> bool
nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.aggregate_metrics(
body: nemo_gym.base_resources_server.AggregateMetricsRequest = Body()
) -> nemo_gym.base_resources_server.AggregateMetrics
async

Default: same RewardProfiler aggregation as resources server. Override to proxy.

nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.base_url_for_run(
base_url: str,
body: typing.Any
) -> str

A model-server base URL with the per-rollout capture-correlation prefix applied.

base_url_for_run is the base-URL counterpart of url_path_for_run for SDK-style harnesses that configure a client once instead of prefixing each call: same gating, applied to a server root URL (append the API-version suffix afterwards).

nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.resolve_model_base_url(
model_server_name: str,
rollout_id: typing.Optional[str] = None
) -> str

Resolve a model-server URL with an optional rollout prefix.

nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.responses(
body: nemo_gym.openai_utils.NeMoGymResponseCreateParamsNonStreaming = Body()
) -> nemo_gym.openai_utils.NeMoGymResponse
asyncabstract
nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.rollout_id_from_run(
body: typing.Any
) -> typing.Optional[str]

Per-rollout capture id for a run-request (its task/rollout indices).

None when model-call capture (observability) is disabled or the body carries no indices, so callers apply no correlation prefix in either case.

nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.run(
body: nemo_gym.base_resources_server.BaseRunRequest = Body()
) -> nemo_gym.base_resources_server.BaseVerifyResponse
asyncabstract
nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.setup_webserver() -> fastapi.FastAPI
nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.url_path_for_request(
url_path: str,
request: typing.Optional[fastapi.Request]
) -> str

Carry an inbound /ng-rollout/<id> self-call prefix onto a downstream url_path.

Agents whose model calls happen inside responses() receive the correlation id as the rollout_id path parameter of the prefixed self-call route; this re-applies it to the outgoing model call. Unprefixed requests pass through unchanged.

nemo_gym.base_responses_api_agent.SimpleResponsesAPIAgent.url_path_for_run(
url_path: str,
body: typing.Any
) -> str

A downstream url_path with the per-rollout capture-correlation prefix applied.

Returns /ng-rollout/<id><url_path> when observability is enabled and the run body carries task/rollout indices; otherwise url_path unchanged. Use for calls made while handling /run — both direct model-server calls and self-calls to /v1/responses (the prefixed self-call route carries the id into responses()).