smolagents is a framework for building and running AI agents from HuggingFace. Checkout their docs to get started with creating your own agents.

Integrating AgentOps with smolagents

1

Install the AgentOps SDK

pip install agentops
2

Install smolagents

pip install smolagents
3

Initialize AgentOps and use LiteLLM in your code

AgentOps tracks calls from smolagents via LiteLLM currently.

import agentops
from smolagents import LiteLLMModel

agentops.init(<INSERT YOUR API KEY HERE>)
model = LiteLLMModel(<model_name>)

# Your code here...

agentops.end_session('Success')

Set your API key as an .env variable for easy access.

AGENTOPS_API_KEY=<YOUR API KEY>

Read more about environment variables in Advanced Configuration

4

Run your Agent

Execute your program and visit app.agentops.ai/drilldown to observe your Agent! πŸ•΅οΈ

After your run, AgentOps prints a clickable url to console linking directly to your session in the Dashboard

Clickable link to session

Full Examples

You can refer to the following examples -