Getting Started
Prerequisites
- Python version >=3.10
- A Maxim account (sign up here)
- Generate Maxim API Key
- A Smolagents project
Installation
Install the required packages via pip:requirements.txt:
Basic Setup
1. Set up environment variables
Create a.env file in your project root:
2. Import the required packages
3. Initialize Maxim with your API key
4. Create and run your Smolagents application
Complete Example
Here’s a complete example showing how to integrate Smolagents with Maxim, including a custom SQL tool:Viewing Your Traces
After running your Smolagents application:- Log in to your Maxim Dashboard
- Navigate to your repository
- View detailed agent traces, including:
- Agent conversations
- Tool usage patterns
- Performance metrics
- Cost analytics
Advanced Usage
Custom Tools with Maxim Integration
You can create custom tools and they will automatically be traced by Maxim:Error Handling
Ensure proper cleanup even when errors occur:Troubleshooting
Common Issues
- No traces appearing: Ensure your API key and repository ID are correct
- Import errors: Make sure you’ve installed all required packages (
maxim-py,smolagents,python-dotenv) - Tool not working: Ensure
instrument_smolagents()is called before creating your agent - Environment variables: Verify your
.envfile is in the correct location and contains all required keys
Debug Mode
Enable debug mode to surface any internal errors:Resources
Smolagents Docs
Official Smolagents documentation
Github (smolagents cookbook)
Official Maxim GitHub repository