1+ name : Examples Integration Test
2+
3+ # This workflow runs all example scripts to ensure they work correctly
4+ # and that LLM spans are properly tracked in AgentOps using the
5+ # integrated validation functionality.
6+
7+ on :
8+ push :
9+ branches : [ main, develop ]
10+ paths :
11+ - ' examples/**/*.py'
12+ - ' agentops/**'
13+ - ' .github/workflows/examples-integration-test.yml'
14+ pull_request :
15+ branches : [ main, develop ]
16+ paths :
17+ - ' examples/**/*.py'
18+ - ' agentops/**'
19+ - ' .github/workflows/examples-integration-test.yml'
20+ workflow_dispatch :
21+
22+ env :
23+ PYTHON_VERSION : ' 3.11'
24+
25+ jobs :
26+ test-examples :
27+ runs-on : ubuntu-latest
28+ timeout-minutes : 30
29+
30+ strategy :
31+ fail-fast : false
32+ matrix :
33+ example :
34+ # OpenAI examples
35+ - { path: 'examples/openai/openai_example_sync.py', name: 'OpenAI Sync' }
36+ - { path: 'examples/openai/openai_example_async.py', name: 'OpenAI Async' }
37+ - { path: 'examples/openai/multi_tool_orchestration.py', name: 'OpenAI Multi-Tool' }
38+ - { path: 'examples/openai/web_search.py', name: 'OpenAI Web Search' }
39+ - { path: 'examples/openai/o3_responses_example.py', name: 'OpenAI o3 Responses' }
40+
41+ # Anthropic examples
42+ - { path: 'examples/anthropic/anthropic-example-sync.py', name: 'Anthropic Sync' }
43+ - { path: 'examples/anthropic/anthropic-example-async.py', name: 'Anthropic Async' }
44+ - { path: 'examples/anthropic/agentops-anthropic-understanding-tools.py', name: 'Anthropic Tools' }
45+
46+ # LangChain examples
47+ - { path: 'examples/langchain/langchain_examples.py', name: 'LangChain' }
48+
49+ # LiteLLM examples
50+ - { path: 'examples/litellm/litellm_example.py', name: 'LiteLLM' }
51+
52+ # Google Generative AI examples
53+ - { path: 'examples/google_genai/gemini_example.py', name: 'Google Gemini' }
54+
55+ # xAI examples
56+ - { path: 'examples/xai/grok_examples.py', name: 'xAI Grok' }
57+ - { path: 'examples/xai/grok_vision_examples.py', name: 'xAI Grok Vision' }
58+
59+ # CrewAI examples
60+ - { path: 'examples/crewai/job_posting.py', name: 'CrewAI Job Posting' }
61+ - { path: 'examples/crewai/markdown_validator.py', name: 'CrewAI Markdown' }
62+
63+ # AutoGen examples
64+ - { path: 'examples/autogen/AgentChat.py', name: 'AutoGen Agent Chat' }
65+ - { path: 'examples/autogen/MathAgent.py', name: 'AutoGen Math Agent' }
66+
67+ # AG2 examples
68+ - { path: 'examples/ag2/async_human_input.py', name: 'AG2 Async Human Input' }
69+ - { path: 'examples/ag2/tools_wikipedia_search.py', name: 'AG2 Wikipedia Search' }
70+
71+ # Agno examples
72+ - { path: 'examples/agno/agno_async_operations.py', name: 'Agno Async Operations' }
73+ - { path: 'examples/agno/agno_basic_agents.py', name: 'Agno Basic Agents' }
74+ - { path: 'examples/agno/agno_research_team.py', name: 'Agno Research Team' }
75+ - { path: 'examples/agno/agno_tool_integrations.py', name: 'Agno Tool Integrations' }
76+ - { path: 'examples/agno/agno_workflow_setup.py', name: 'Agno Workflow Setup' }
77+
78+ # Google ADK examples
79+ - { path: 'examples/google_adk/human_approval.py', name: 'Google ADK Human Approval' }
80+
81+ # LlamaIndex examples
82+ # - { path: 'examples/llamaindex/llamaindex_example.py', name: 'LlamaIndex' }
83+
84+ # Mem0 examples
85+ - { path: 'examples/mem0/mem0_memoryclient_example.py', name: 'Mem0 Memory Client' }
86+
87+ # Watsonx examples
88+ - { path: 'examples/watsonx/watsonx-streaming.py', name: 'Watsonx Streaming' }
89+ - { path: 'examples/watsonx/watsonx-text-chat.py', name: 'Watsonx Text Chat' }
90+ - { path: 'examples/watsonx/watsonx-tokeniation-model.py', name: 'Watsonx Tokenization' }
91+
92+ # LangGraph examples
93+ - { path: 'examples/langgraph/langgraph_example.py', name: 'LangGraph' }
94+
95+ # Smolagents examples
96+ - { path: 'examples/smolagents/multi_smolagents_system.py', name: 'Smolagents Multi System' }
97+ - { path: 'examples/smolagents/text_to_sql.py', name: 'Smolagents Text to SQL' }
98+
99+ # OpenAI Agents examples
100+ - { path: 'examples/openai_agents/agent_guardrails.py', name: 'OpenAI Agents Guardrails' }
101+ - { path: 'examples/openai_agents/agent_patterns.py', name: 'OpenAI Agents Patterns' }
102+ - { path: 'examples/openai_agents/agents_tools.py', name: 'OpenAI Agents Tools' }
103+ - { path: 'examples/openai_agents/customer_service_agent.py', name: 'OpenAI Agents Customer Service' }
104+
105+ # Add more examples as needed
106+
107+ steps :
108+ - uses : actions/checkout@v4
109+
110+ - name : Set up Python
111+ uses : actions/setup-python@v4
112+ with :
113+ python-version : ${{ env.PYTHON_VERSION }}
114+
115+ - name : Install AgentOps
116+ run : |
117+ pip install -e .
118+
119+ - name : Install example dependencies
120+ run : |
121+ # Install common dependencies
122+ pip install python-dotenv requests
123+
124+ # Install from requirements.txt in the example's directory
125+ example_dir=$(dirname "${{ matrix.example.path }}")
126+ if [ -f "$example_dir/requirements.txt" ]; then
127+ echo "Installing dependencies from $example_dir/requirements.txt"
128+ pip install -r "$example_dir/requirements.txt"
129+ else
130+ echo "No requirements.txt found in $example_dir"
131+ fi
132+
133+ - name : Run example - ${{ matrix.example.name }}
134+ env :
135+ AGENTOPS_API_KEY : ${{ secrets.AGENTOPS_API_KEY }}
136+ OPENAI_API_KEY : ${{ secrets.OPENAI_API_KEY }}
137+ ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
138+ GOOGLE_API_KEY : ${{ secrets.GOOGLE_API_KEY }}
139+ XAI_API_KEY : ${{ secrets.XAI_API_KEY }}
140+ WATSONX_API_KEY : ${{ secrets.WATSONX_API_KEY }}
141+ WATSONX_PROJECT_ID : ${{ secrets.WATSONX_PROJECT_ID }}
142+ WATSONX_URL : ${{ secrets.WATSONX_URL }}
143+ MEM0_API_KEY : ${{ secrets.MEM0_API_KEY }}
144+ GEMINI_API_KEY : ${{ secrets.GEMINI_API_KEY }}
145+ COHERE_API_KEY : ${{ secrets.COHERE_API_KEY }}
146+ GROQ_API_KEY : ${{ secrets.GROQ_API_KEY }}
147+ FIREWORKS_API_KEY : ${{ secrets.FIREWORKS_API_KEY }}
148+ MISTRAL_API_KEY : ${{ secrets.MISTRAL_API_KEY }}
149+ AI21_API_KEY : ${{ secrets.AI21_API_KEY }}
150+ TAVILY_API_KEY : ${{ secrets.TAVILY_API_KEY }}
151+ EXA_API_KEY : ${{ secrets.EXA_API_KEY }}
152+ LLAMA_API_KEY : ${{ secrets.LLAMA_API_KEY }}
153+ PERPLEXITY_API_KEY : ${{ secrets.PERPLEXITY_API_KEY }}
154+ REPLICATE_API_TOKEN : ${{ secrets.REPLICATE_API_TOKEN }}
155+ PINECONE_API_KEY : ${{ secrets.PINECONE_API_KEY }}
156+ PYTHONPATH : ${{ github.workspace }}
157+ run : |
158+ echo "Running ${{ matrix.example.name }}..."
159+ python "${{ matrix.example.path }}" || exit 1
160+
161+ - name : Check for errors
162+ if : failure()
163+ run : |
164+ echo "Example ${{ matrix.example.name }} failed!"
165+ echo "Path: ${{ matrix.example.path }}"
166+
167+ # Show last 50 lines of any log files
168+ if [ -f agentops.log ]; then
169+ echo "=== AgentOps Log ==="
170+ tail -n 50 agentops.log
171+ fi
172+
173+ summary :
174+ needs : test-examples
175+ runs-on : ubuntu-latest
176+ if : always()
177+
178+ steps :
179+ - name : Summary
180+ run : |
181+ echo "## Examples Integration Test Summary" >> $GITHUB_STEP_SUMMARY
182+ echo "" >> $GITHUB_STEP_SUMMARY
183+
184+ if [ "${{ needs.test-examples.result }}" == "success" ]; then
185+ echo "✅ All examples passed!" >> $GITHUB_STEP_SUMMARY
186+ else
187+ echo "❌ Some examples failed. Check the logs above." >> $GITHUB_STEP_SUMMARY
188+ fi
0 commit comments