Smolagents
Track and analyze your Smolagents AI agents with AgentOps
AgentOps provides seamless integration with Smolagents, HuggingFace’s lightweight framework for building AI agents. Monitor your agent workflows, tool usage, and execution traces automatically.
Core Concepts
Smolagents is designed around several key concepts:
- Agents: AI assistants that can use tools and reason through problems
- Tools: Functions that agents can call to interact with external systems
- Models: LLM backends that power agent reasoning (supports various providers via LiteLLM)
- Code Execution: Agents can write and execute Python code in sandboxed environments
- Multi-Agent Systems: Orchestrate multiple specialized agents working together
Installation
Install AgentOps and Smolagents, along with any additional dependencies:
Setting Up API Keys
Before using Smolagents with AgentOps, you need to set up your API keys:
- AGENTOPS_API_KEY: From your AgentOps Dashboard
- LLM API Keys: Depending on your chosen model provider (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY)
Set these as environment variables or in a .env
file.
Then load them in your Python code:
Usage
Initialize AgentOps before creating your Smolagents to automatically track all agent interactions:
Examples
More Examples
Multi-Agent System
Complex multi-agent web browsing system
Text to SQL Agent
Convert natural language queries to SQL
Visit your AgentOps Dashboard to see detailed traces of your Smolagents executions, tool usage, and agent reasoning steps.