AI agent instructions
AI agent instructions
How it works
- Your code keeps the API key and mints a token with
POST /access-tokens. - You pass only the token to the agent or sandbox, for example as its
NOTTE_API_KEYenvironment variable. - The agent sends the token as a bearer token, exactly like an API key.
- If the work runs longer than the token’s lifetime, your code mints a new one. Tokens cannot be refreshed or extended.
- When the work is done, your code revokes the token and stops the sessions it started.
Mint a token
Mint a token with your API key:Optional free text of up to 128 characters, for example the id of the sandbox that receives the token.
201 Created:
409. Minting is also rate limited per API key, and answers 429 when you go over the limit.
Use a token
Send the token in theAuthorization header, the same way as an API key:
Revoke a token
Revoke a token with the API key that minted it:204 No Content. Revoking is idempotent: revoking a token that is already revoked also answers 204. Another API key gets 404, and a token cannot revoke tokens.
A revoked token stops working on its next request. Revoking the parent API key, or removing the key’s owner from the workspace, stops its tokens within 60 seconds.
Where tokens work
A token works on these routes, and nowhere else:
Every other route answers
403 with NotteApiAccessTokenNotAllowedError when it receives a token, including minting and revoking tokens, functions and their runs, vaults, personas and profiles. Use an API key for those.
Errors
Token errors use the standard error envelope and name their error class in theX-Error-Class header:
Check the status code and the
X-Error-Class header rather than the message text. On a 401, mint a new token. On a 403, call the route with an API key instead.
Lifetimes and what outlives a token
The token itself lives forexpires_in seconds, one hour at most, or until you revoke it.
Some routes on the list return other credentials, such as session links and signed download URLs. Those keep their own lifetime: when the token expires or is revoked, they keep working.
Manage tokens in the console
In the Notte Console, open Settings → Access tokens to:- create a token: choose the API key it acts as, a name and a lifetime of up to one hour. The console shows the token once.
- list tokens, filtered by status: active, expired or revoked.
- revoke a token.