diff --git a/.github/workflows/examples-integration-test.yml b/.github/workflows/examples-integration-test.yml
index fadc4bce9..e16e878f5 100644
--- a/.github/workflows/examples-integration-test.yml
+++ b/.github/workflows/examples-integration-test.yml
@@ -105,6 +105,9 @@ jobs:
# DSPy examples
- { path: 'examples/dspy/dspy_calculator.py', name: 'DSPy ReAct Agent' }
+
+ # Haystack examples
+ - { path: 'examples/haystack/haystack_example.py', name: 'Haystack OpenAI' }
# Add more examples as needed
@@ -189,4 +192,4 @@ jobs:
echo "ā
All examples passed!" >> $GITHUB_STEP_SUMMARY
else
echo "ā Some examples failed. Check the logs above." >> $GITHUB_STEP_SUMMARY
- fi
\ No newline at end of file
+ fi
\ No newline at end of file
diff --git a/docs/v1/integrations/haystack.mdx b/docs/v1/integrations/haystack.mdx
index 02c63187c..9b570541a 100644
--- a/docs/v1/integrations/haystack.mdx
+++ b/docs/v1/integrations/haystack.mdx
@@ -69,10 +69,9 @@ AgentOps makes monitoring your Haystack agents seamless. Haystack, much like Aut
## Full Examples
-You can refer to the following examples -
+You can refer to the following example -
-- [Philosopher Agent](https://github.com/AgentOps-AI/agentops/blob/main/examples/haystack_examples/haystack_anthropic_example.ipynb)
-- [Mathematician Agent](https://github.com/AgentOps-AI/agentops/blob/main/examples/haystack_examples/haystack_openai_example.ipynb)
+- [Simple Haystack example (OpenAI)](https://github.com/AgentOps-AI/agentops/blob/main/examples/haystack/haystack_example.py)
diff --git a/examples/haystack/haystack_example.py b/examples/haystack/haystack_example.py
new file mode 100644
index 000000000..541ab2dd8
--- /dev/null
+++ b/examples/haystack/haystack_example.py
@@ -0,0 +1,34 @@
+import os
+
+import agentops
+from haystack.components.generators.openai import OpenAIGenerator
+
+
+def main():
+ agentops.init(os.getenv("AGENTOPS_API_KEY"))
+
+ tracer = agentops.start_trace(
+ trace_name="Haystack OpenAI Example",
+ tags=["haystack", "openai", "agentops-example"],
+ )
+
+ prompt = "In one sentence, what is AgentOps?"
+ generator = OpenAIGenerator(model="gpt-4o-mini")
+ result = generator.run(prompt=prompt)
+ replies = result.get("replies") or []
+ print("Haystack reply:", replies[0] if replies else "")
+
+ print("\n" + "=" * 50)
+ print("Now let's verify that our LLM calls were tracked properly...")
+ try:
+ validation_result = agentops.validate_trace_spans(trace_context=tracer)
+ agentops.print_validation_summary(validation_result)
+ except agentops.ValidationError as e:
+ print(f"\nā Error validating spans: {e}")
+ raise
+
+ agentops.end_trace(tracer, end_state="Success")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/examples/haystack/requirements.txt b/examples/haystack/requirements.txt
new file mode 100644
index 000000000..dc4b30512
--- /dev/null
+++ b/examples/haystack/requirements.txt
@@ -0,0 +1,2 @@
+haystack-ai>=2.0.0
+openai>=1.0.0