Overview
Tom (Theory of Mind) Agent provides advanced user understanding capabilities that help your agent interpret vague instructions and adapt to user preferences over time. Built on research in user mental modeling, Tom agents can:- Understand unclear or ambiguous user requests
- Provide personalized guidance based on user modeling
- Build long-term user preference profiles
- Adapt responses based on conversation history
- User instructions are vague or incomplete
- You need to infer user intent from minimal context
- Building personalized experiences across multiple conversations
- Understanding user preferences and working patterns
Research Foundation
Tom agent is based on the TOM-SWE research paper on user mental modeling for software engineering agents:Citation
Paper: TOM-SWE on arXiv
Quick Start
This example is available on GitHub: examples/01_standalone_sdk/30_tom_agent.py
examples/01_standalone_sdk/30_tom_agent.py
Running the Example
Tom Tools
TomConsultTool
The consultation tool provides personalized guidance when the agent encounters vague or unclear user requests:- Analyzes conversation history for context
- Provides personalized suggestions based on user modeling
- Helps disambiguate vague instructions
- Adapts to user communication patterns
SleeptimeComputeTool
The indexing tool processes conversation history to build user preference profiles:- Processes conversation history into user models
- Stores preferences in
~/.openhands/directory - Builds understanding of user patterns over time
- Enables long-term personalization across sessions
Configuration
RAG Support
Enable retrieval-augmented generation for enhanced context awareness:Custom LLM for Tom
You can optionally use a different LLM for Tom’s internal reasoning:Data Storage
Tom stores user modeling data persistently in~/.openhands/:
- Remember user preferences across sessions
- Track which conversations have been indexed
- Build long-term understanding of user patterns
Use Cases
1. Handling Vague Requests
When a user provides minimal information:2. Personalized Recommendations
Tom adapts suggestions based on past interactions:3. Intent Inference
Understanding what the user really wants:Best Practices
-
Enable RAG: For better context awareness, always enable RAG:
- Index Regularly: Run sleeptime compute after important conversations to build better user models
- Provide Context: Even with Tom, providing more context leads to better results
-
Monitor Data: Check
~/.openhands/periodically to understand what’s being learned - Privacy Considerations: Be aware that conversation data is stored locally for user modeling
Next Steps
- Agent Delegation - Combine Tom with sub-agents for complex workflows
- Context Condenser - Manage long conversation histories effectively
- Custom Tools - Create tools that work with Tom’s insights

