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