Skip to content

[integration] Added Haystack integration - #54

Open
lucifertrj wants to merge 9 commits into
comet-ml:mainfrom
lucifertrj:haystack-integration
Open

[integration] Added Haystack integration#54
lucifertrj wants to merge 9 commits into
comet-ml:mainfrom
lucifertrj:haystack-integration

Conversation

@lucifertrj

Copy link
Copy Markdown
Contributor

What & why

This PR adds support to the Haystack Framework- Deepset integration with the OPIK connector. Issue: #44

Trace Screenshot

Screenshot 2026-07-21 at 14 53 48

Checklist

  • Linked to its tracking issue (commented to claim it before starting)
  • Example is in the right bucket (integrations / guides / use-cases / scripts)
  • Folder name is lowercase_with_underscores
  • README.md has all required sections; index tables updated if examples were added/renamed/removed
  • Dry-run works with no credentials — bash run.sh exits cleanly (this is what CI's secrets-free job runs)
  • uv run ruff check . and uv run ruff format --check . are clean
  • No credentials or .env files committed
  • Dependencies declared in pyproject.toml (uv project); no requirements.txt, no committed uv.lock
  • run.sh exists and starts with set -e
  • OPIK_PROJECT_NAME is set — exported in run.sh (scripts) or defined in config.py (use-cases/guides)

@LeoRoccoBreedt

Copy link
Copy Markdown
Collaborator

Thanks @lucifertrj — this one's in great shape. I checked out the branch and ran the CI-equivalent checks locally:

  • bash run.sh with no creds → exits 0 with meaningful DRY_RUN output
  • uv run ruff check . / ruff format --checkclean
  • uv sync + dry-run imports everything (incl. SerperDevWebSearch), so haystack-ai / serperdev-haystack / opik>=2.2.0 are all correctly declared
  • Tracing genuinely works — I confirmed OpikConnector(name=...) registers OpikTracer as Haystack's global tracer on construction (is_tracing_enabled → True on opik 2.2.13), which is why your trace screenshot is real

Nice work updating the integrations/README.md index and using the nested framework/example layout. Just two things to tidy before we merge, plus a couple of nits.

Should-fix

1. Give the load-bearing OpikConnector(...) line a # WHY: comment.

OpikConnector(name="haystack-multi-agent-scout", project_name=config.OPIK_PROJECT_NAME)

This is the single most important line in the example — its constructor swaps in the global OpikTracer, which is what makes tracing happen — but because the instance is constructed and discarded, it reads like a mistake to anyone copying the code. The repo's code-style rule calls for a # WHY: exactly when a behaviour would surprise a reader, and a dangling constructor qualifies:

# WHY: constructing OpikConnector registers Opik as Haystack's global tracer for the whole
# process; the instance is intentionally unused because we run Agents directly, not via a Pipeline.
OpikConnector(name="haystack-multi-agent-scout", project_name=config.OPIK_PROJECT_NAME)

(Your example README explains this in prose already — this is just so the code itself does too.) Minor bonus: it's created inside build_coordinator, so calling run_agent twice would re-register the tracer each time — harmless, but hoisting it to module init would read cleaner.

2. OPIK_PROJECT_NAME default is inconsistent across files.

  • .env.examplehaystack-multi-agent
  • config.py / run.sh / OpikConnector / README → haystack-multi-agent-scout

Someone who copies .env.example lands in a different project than the docs describe. Align them (suggest standardizing on haystack-multi-agent-scout).

Nits

  • Heads-up on CI: this example needs OPENAI_API_KEY and SERPERDEV_API_KEY, and it's hardwired to Haystack's OpenAIChatGenerator (so the cheap-model routing via OPIK_EXAMPLES_MODEL doesn't apply — correctly, since that var is provider-prefixed for litellm). Net effect: the live-run job won't exercise this unless CI has a SerperDev key, so a maintainer may need to run it manually. Not a blocker — inherent to a SerperDev-based example.
  • OpikConnector(name="haystack-multi-agent-scout") reuses the project-name string as the connector name; the name is really the trace/connector label, so a distinct descriptive name would be a touch clearer. Trivial.
  • .env.example is missing a trailing newline.

Otherwise this is approvable once 1 and 2 are in. Thanks for a clean, well-structured integration!

@lucifertrj

Copy link
Copy Markdown
Contributor Author

perfect. I missed the .env.example part for the project name. I will make the fix.

@lucifertrj

Copy link
Copy Markdown
Contributor Author

resolved:

  • Why comment for constructing OPIKConnector
  • Trailing newline in .env.example and keeping the OPIK_PROJECT_NAME as haystack-multi-agent-scout consistent across config.py, run.sh, .env.example, and readme.

@LeoRoccoBreedt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants