Skip to main content

Key patterns

One client per agent — create OculusClient once at startup and reuse it. Creating a new instance per request bypasses the token cache. One scope per operation — request only the scope needed for each call. Don’t request stripe:* when you only need stripe:customer:read. Handle TokenRevokedException — this means an operator intentionally revoked your agent. Don’t silently retry — alert your team. Register a shutdown handler — call client.stop() (Python) or client.destroy() (TypeScript) on shutdown to cleanly stop background TRL polling.