Skip to content

feat(weave): add AG2 (formerly AutoGen) tracing integration#6370

Open
VasiliyRad wants to merge 5 commits intowandb:masterfrom
VasiliyRad:vasiliyr/03152026
Open

feat(weave): add AG2 (formerly AutoGen) tracing integration#6370
VasiliyRad wants to merge 5 commits intowandb:masterfrom
VasiliyRad:vasiliyr/03152026

Conversation

@VasiliyRad
Copy link
Copy Markdown

Add AG2 (formerly AutoGen) tracing integration

Weave traces conversations for several agent frameworks but not AG2. AG2 is the community-driven fork of Microsoft AutoGen, one of the most downloaded multi-agent orchestration frameworks on PyPI. This is a separate integration from the existing autogen integration, which targets Microsoft's autogen-agentchat v0.5+ — the two projects have diverged in API.

This PR patches four AG2 methods to capture nested traces of agent conversations and LLM calls, using the same
SymbolPatcher pattern as the CrewAI integration.

Changes

  • weave/integrations/ag2/ — patcher module with input
    sanitizers for chat and LLM inputs
  • weave/integrations/patch.pypatch_ag2() function and
    import-based dispatcher that routes to the correct patcher
    depending on whether AG2 or Microsoft AutoGen is installed
  • weave/integrations/__init__.py — export patch_ag2
  • weave/trace/autopatch.pyag2 field in
    AutopatchSettings
  • tests/integrations/ag2/ — two-agent with tool use,
    three-agent group chat (VCR cassettes needs to be generated
    before merge)

@VasiliyRad VasiliyRad requested a review from a team as a code owner March 17, 2026 05:11
@wandbot-3000
Copy link
Copy Markdown

wandbot-3000 bot commented Mar 17, 2026

This PR requires manual approval from a wandb user to run all CI checks.

To see the current diff, click here.

To approve CI for this PR as of this commit, comment:

/approve 98706c2d2f8a17343a2f94d12aa1c6ac778b8f29

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 17, 2026

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@VasiliyRad
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Mar 17, 2026
@wandbot-3000
Copy link
Copy Markdown

wandbot-3000 bot commented Mar 17, 2026

Comment thread tests/integrations/ag2/ag2_test.py Outdated
Comment thread tests/integrations/ag2/ag2_test.py Outdated
Comment thread tests/integrations/ag2/ag2_test.py Outdated
Copy link
Copy Markdown
Collaborator

@andrewtruong andrewtruong left a comment

Choose a reason for hiding this comment

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

Hey @VasiliyRad thanks for the PR. This PR seems mostly fine

You'll also need to:

  1. Add an extra for this in pyproject.toml;
  2. Generate the cassettes for your tests;

Comment thread weave/integrations/patch.py Outdated
@VasiliyRad
Copy link
Copy Markdown
Author

Hey @VasiliyRad thanks for the PR. This PR seems mostly fine

You'll also need to:

  1. Add an extra for this in pyproject.toml;
  2. Generate the cassettes for your tests;

Done — added ag2 extra and ag2_tests dependency group in pyproject.toml. Cassettes recorded and included

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