Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI
AgentOps Examples
This directory contains comprehensive examples demonstrating how to integrate AgentOps with various AI/ML frameworks, libraries, and providers. Each example is provided as a Jupyter notebook and a Python script with detailed explanations and code samples.
📁 Directory Structure
ag2/- Examples for AG2 (AutoGen 2.0) multi-agent conversationsagentchat_with_memory- Agent chat with persistent memoryasync_human_input- Asynchronous human input handlingtools_wikipedia_search- Wikipedia search tool integration
anthropic/- Anthropic Claude API integration examplesagentops-anthropic-understanding-tools- Deep dive into tool usageanthropic-example-async- Asynchronous API callsanthropic-example-sync- Synchronous API callsantrophic-example-tool- Tool calling examplesREADME.md- Detailed Anthropic integration guide
autogen/- Microsoft AutoGen framework examplesAgentChat- Basic agent chat functionalityMathAgent- Mathematical problem-solving agent
crewai/- CrewAI multi-agent framework examplesjob_posting- Job posting automation workflowmarkdown_validator- Markdown validation agent
gemini/- Google Gemini API integrationgemini_example- Basic Gemini API usage with AgentOps
google_adk/- Google AI Development Kit exampleshuman_approval- Human-in-the-loop approval workflows
langchain/- LangChain framework integrationlangchain_examples- Comprehensive LangChain usage examples
litellm/- LiteLLM proxy integrationlitellm_example- Multi-provider LLM access through LiteLLM
openai/- OpenAI API integration examplesmulti_tool_orchestration- Complex tool orchestrationopenai_example_async- Asynchronous OpenAI API callsopenai_example_sync- Synchronous OpenAI API callsweb_search- Web search functionality
openai_agents/- OpenAI Agents SDK examplesagent_patterns- Common agent design patternsagents_tools- Agent tool integrationcustomer_service_agent- Customer service automation
smolagents/- SmolAgents framework examplesmulti_smolagents_system- Multi-agent system coordinationtext_to_sql- Natural language to SQL conversion
watsonx/- IBM Watsonx AI integrationwatsonx-streaming- Streaming text generationwatsonx-text-chat- Text generation and chat completionwatsonx-tokeniation-model- Tokenization and model detailsREADME.md- Detailed Watsonx integration guide
xai/- xAI (Grok) API integrationgrok_examples- Basic Grok API usagegrok_vision_examples- Vision capabilities with Grok
Utility Scripts
generate_documentation.py- Script to convert Jupyter notebooks to MDX documentation files- Converts notebooks from
examples/todocs/v2/examples/ - Handles frontmatter, GitHub links, and installation sections
- Transforms
%pip installcommands to CodeGroup format
- Converts notebooks from
📓 Prerequisites
- AgentOps Account: Sign up at agentops.ai
- Python Environment: Python 3.10+ recommended
- API Keys: Obtain API keys for the services you want to use
📖 Documentation Generation
The generate_documentation.py script automatically converts these Jupyter notebook examples into documentation for the AgentOps website. It:
- Extracts notebook content and converts to Markdown
- Adds proper frontmatter and metadata
- Transforms installation commands into user-friendly format
- Generates GitHub links for source notebooks
- Creates MDX files in
docs/v2/examples/
Usage
python examples/generate_documentation.py examples/langchain/langchain_examples.ipynb
🤝 Contributing
When adding new examples:
- Create a new subdirectory for the framework/provider
- Include comprehensive Jupyter notebooks with explanations
- Add a README.md if the integration is complex
- Ensure examples are self-contained and runnable
- Follow the existing naming conventions
- Use the
generate_documentation.pyscript to create documentation files - Add the example notebook to the main
README.mdfor visibility - Add the generated documentation to the
docs/v2/examples/directory for website visibility - Submit a pull request with a clear description of your changes
📚 Additional Resources
📄 License
These examples are provided under the same license as the AgentOps project. See the main repository for license details.