Skip to content

Feature/add atomic agents integration #2783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

vladimirrotariu
Copy link
Contributor

Details

  • One-line setup: track_atomic_agents(project_name="my-project")
  • Traces Atomic Agents runs:
    • general span → agent run
    • tool span → tool call
    • llm span → model request
  • Captures Pydantic schemas in span metadata
  • OpikContextProvider lets you inject trace IDs into prompts
  • Extra install: pip install "opik[atomic_agents]"

Testing

  • 9 pytest cases covering tracing, schemas, errors, idempotency, LLM spans
  • Ruff & MyPy: clean
  • CI:
    • .github/workflows/lib-atomic-agents-tests.yml (Py 3.10-3.12)
    • Integrated into existing lib-integration & cookbook notebook jobs

Documentation

  • atomic_agents_quickstart.ipynb – hands-on tutorial
  • atomic_agents_context_provider.ipynb – advanced prompt injection
  • Example script: sdks/python/examples/atomic_agents_quickstart.py
  • README with install, quick-start, FAQ

@vladimirrotariu vladimirrotariu requested review from a team as code owners July 20, 2025 17:26
@vladimirrotariu
Copy link
Contributor Author

I wanted to mention that 4 of the tests do not pass: hower, the issue is manifesting in the main branch as well;

FAILED tests/e2e/evaluation/test_threads_evaluate.py::test_evaluate_threads__happy_path - AssertionError: Failed to get feedback scores for thread with id '234f7d'.
FAILED tests/e2e/test_guardrails.py::test_passing_guardrails__happyflow[e2e-tests-manual-project-name] - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
FAILED tests/e2e/test_guardrails.py::test_passing_guardrails__happyflow[None] - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
FAILED tests/e2e/test_guardrails.py::test_failing_guardrails__happyflow - json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@andrescrz
Copy link
Member

Hi @vladimirrotariu

Thank you very much for your contribution!

I assigned the following people to this PR, in order to review:

They'll get back to you soon with a review.
Regards,

@@ -1,15 +1,15 @@
import React from "react";
import { BASE_TRACE_DATA_TYPE, SPAN_TYPE } from "@/types/traces";
import TooltipWrapper from "@/components/shared/TooltipWrapper/TooltipWrapper";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please revert the automatic import formatting changes? These adjustments aren’t necessary for this PR.

The same applies to all frontend files modified here. Once this is addressed, we’ll be able to begin reviewing the frontend portion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andriidudar hi, I rectified this :)

@vladimirrotariu vladimirrotariu force-pushed the feature/add-atomic-agents-integration branch from 1ca8c0f to a18979e Compare July 24, 2025 00:07
@@ -0,0 +1,114 @@
# Opik × Atomic Agents Integration
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be somewhere in the documentation, but not here.

@@ -0,0 +1,5 @@
atomic-agents
pydantic
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these dependencies except for atomic-agents are already in tests/test_requirements.txt so no need to install them.

def test_error_info_present(fake_backend):
track_atomic_agents(project_name="err-test")

BaseAgent = sys.modules["atomic_agents.agents.base_agent"].BaseAgent
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not to move it to regular import?

@@ -1,3 +1,18 @@
[project]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't use pyproject toml for dependencies management at the moment, please remove it to avoid confusion.

@@ -0,0 +1,17 @@
"""Atomic Agents integration package for Opik SDK.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this comment (so as every other AI generated comment at the top of the file can be omitted).

return info


__all__: list[str] = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this

tracer.end(error_info=error_info_collector.collect(exc))
raise

BaseAgent.run = _agent_run # type: ignore[assignment]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All track-like decorators must be inherited from BaseTrackDecorator, similarly to other integrations. It encapsulates all the context-related work, you only need to define how to process inputs and outputs before submitting a span/trace.

@@ -0,0 +1,124 @@
"""Pytest fixtures for the atomic_agents integration tests."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these tests are not needed, once the integration is re-implemented to use BaseTrackDecorator logic, tests can be simplified.
Please look at our other integrations and integration tests for them: openai, genai, crewai, etc.
They all have similar pattern. New integration should have it as well.

__IS_TRACKING_ENABLED = False


def track_atomic_agents(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't got an experience with atomic-agents yet, but if it's possible - track_atomic_agents should take an agent instance as input instead of patching an entire library. It gives more granular control over the code.

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

Successfully merging this pull request may close these issues.