nemo_gym.server_runtime.episode_tokens
nemo_gym.server_runtime.episode_tokens
Tokens that let an agent call one episode’s tools on an Environment Server.
Module Contents
Classes
Functions
Data
API
The episode a token names, and the nonce that makes the token unguessable.
Whether other names the same episode with the same nonce, compared in constant time.
Mint and read the tokens an Environment Server grants for one episode’s tools.
A rollout ID is predictable (<task index>-<rollout index> unless the caller sets one), so each token
carries a random nonce. The server accepts a token only while it holds the same claims for that episode
(EpisodeTokenClaims.matches): the nonce is what authenticates a call. The signature, with a random secret
for each server run (episode_token_secret), keeps the claims intact, and lets a worker that does not hold
the episode read which episode a token names.
A new token for episode_id, and the claims the server keeps to check it.
The claims of a token this server signed, or None for any other string. It never raises.
The random secret that signs this server run’s episode tokens.
The first call in a process without the secret makes one and sets it in EPISODE_TOKEN_SECRET_ENV. A
multi-worker server builds its server object in the main process before uvicorn starts the workers, so every
worker inherits the same secret and reads tokens that another worker minted.