Skip to main content
Maxim AI provides comprehensive agent monitoring, evaluation, and observability for your Smolagents applications. With Maxim’s one-line integration, you can easily trace and analyze agent interactions, tool usage, and performance metrics.

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:
Or add them to your 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

That’s it! All your Smolagents interactions will now be logged and available in your Maxim dashboard.

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:
  1. Log in to your Maxim Dashboard
  2. Navigate to your repository
  3. 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 .env file 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