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.
Initialize AgentOps before creating your Smolagents to automatically track all agent interactions:
Copy
import agentopsfrom smolagents import LiteLLMModel, ToolCallingAgent, DuckDuckGoSearchTool# Initialize AgentOpsagentops.init()# Create a model (supports various providers via LiteLLM)model = LiteLLMModel("openai/gpt-4o-mini")# Create an agent with toolsagent = ToolCallingAgent( tools=[DuckDuckGoSearchTool()], model=model,)# Run the agentresult = agent.run("What are the latest developments in AI safety research?")print(result)
import agentopsfrom smolagents import LiteLLMModel, CodeAgent# Initialize AgentOpsagentops.init()# Create a modelmodel = LiteLLMModel("openai/gpt-4o-mini")# Create a code agent that can perform calculationsagent = CodeAgent( tools=[], # No external tools needed for math model=model, additional_authorized_imports=["math", "numpy"],)# Ask the agent to solve a math problemresult = agent.run( "Calculate the compound interest on $10,000 invested at 5% annual rate " "for 10 years, compounded monthly. Show your work.")print(result)