Gym
Gym copied to clipboard
Docs: Multi-Step Patterns
Document Multi-Step Patterns
Context
Users have asked how to handle multi-step agentic tasks where the agent makes multiple tool calls within a single trajectory. This requires understanding:
- How NeMo Gym maintains state across multiple steps
- The session model and how it routes requests
- When to use stateful vs. stateless patterns
- How to manage state persistence (in-memory vs. database)
We should add documentation for this foundational pattern, and update the README for the example_stateful_counter resource server which demonstrates this.
Problem
Multi-step interactions are core to agentic tasks, but users don't have clear documentation on:
- What happens when an agent makes multiple tool calls
- How to maintain state between those calls (e.g., keeping track of what the agent has done so far)
- The session lifecycle and routing model
- Best practices for stateful resource servers
Acceptance Criteria
- [ ] Create a "Multi-Step Interactions" section in documentation that covers:
- What multi-step means in the context of NeMo Gym
- How sessions work (creation, routing, cleanup)
- When you need stateful vs. stateless resource servers
- State management patterns (in-memory, database, external services)
- [ ] Document
example_stateful_counteras a reference implementation:- Write comprehensive README
- Code walkthrough of key patterns
- Setup and testing instructions
- [ ] Add multi-step pattern to main tutorial flow or as prominent "next step"
- [ ] Consider adding a decision tree: "Does my task need state management?"
Priority
High - foundational pattern needed for most agentic tasks
Related
- Database integration tutorial will build on these session patterns. We need to determine how we structure database examples: as part of this multi-step documentation or as standalone documentation (or both, given this is commonly requested).
- This is separate from multi-turn conversations (user <-> assistant exchanges)
@lbliii tagging for visibility