Gym
Gym copied to clipboard
Create Database Integration Tutorial
Create Database Integration Tutorial
Background
Multiple users have asked how to handle database operations in NeMo Gym for stateful agentic tasks. This is a common need for agentic training.
Problem
We don't have documentation or examples showing how to:
- Connect to a database from a resource server
- Handle database state across multi-turn interactions
- Manage concurrency for database operations during RL training (many parallel rollouts)
- Use the session model to route requests to the same database/instance
Acceptance Criteria
- [ ] Create a new resource server example
- [ ] Show integration with a real database (PostgreSQL or similar)
- [ ] Demonstrate session management for maintaining state across turns
- [ ] Document concurrency considerations (connection pooling, transaction handling, etc.)
- [ ] Add README with clear setup instructions
- [ ] Create a tutorial walkthrough explaining the key patterns
- [ ] Consider showing both:
- Each session gets its own database instance/schema
- Multiple sessions sharing a database with proper isolation
Priority
High - multiple users asking, common agentic use case
Notes
example_stateful_counter exists but only shows in-memory state, not real database integration