Skip to content

[bot] Instrument AG2 (49,366 weekly downloads) #721

Description

@braintrust-bot
<!-- library-gap-audit: ag2-agentos-python-sdk -->

Gap

AG2 (ag2 on PyPI, formerly AutoGen, now maintained by the community-governed AG2AI org) has zero Braintrust instrumentation in this repo. This repo already instruments Microsoft's rewrite of the same lineage under the package name autogen-agentchat (py/src/braintrust/integrations/autogen/), but AG2 v1.0+ ships as a completely separate PyPI package (ag2) with its own top-level import namespace and a brand-new, non-overlapping execution API — it is not a subclass or thin wrapper of autogen-agentchat, and none of the existing AutoGen patchers apply to it.

AG2 released v1.0.3 on 2026-08-28 (days before this audit) and represents a ground-up rewrite: "AG2 v1.0 (pip install ag2) is not a drop-in upgrade from Classic. The agent model, orchestration, and imports all changed." (source: https://github.com/ag2ai/ag2). The old ConversableAgent/GroupChat/initiate_chat API has moved to a separate ag2-classic package and is out of scope here — this gap is about the new, actively-promoted ag2 package's execution surface.

Weekly downloads: 49,366 (as of 2026-08-31; https://pypistats.org/packages/ag2)

What is missing

No Braintrust integration, wrapper, or patcher exists for the ag2 package. The following execution APIs have no tracing spans:

  • Agent.ask(...) — the core single-turn execution entry point ("talks to a model provider, calls tools, and returns a reply"). Returns an AgentReply; calling .ask() again on the reply continues the same conversation with history preserved.
  • @tool-decorated function invocation — tools an agent calls during a turn.
  • Hub / Network channels — the multi-agent orchestration layer that replaces classic GroupChat. Agents are registered via await hub.register(...) and communicate over typed channels (conversation, consulting, discussion, workflow) opened with await agent.open(type=..., target=...).
  • Human-in-the-loop hooks (Context.input(...), hitl_hook) that interrupt/resume agent execution.

Braintrust docs status

not_found for AG2/ag2 specifically. The Braintrust docs list "AutoGen" as a supported agent-framework integration, but the dedicated integration page confirms this targets a different package entirely: uv add braintrust autogen-agentchat "autogen-ext[openai]", with the text "Braintrust patches AutoGen's chat agent, team, and FunctionTool entry points (autogen-agentchat>=0.7.0)." AG2, ag2ai, and pyautogen are not mentioned anywhere on https://www.braintrust.dev/docs/guides/tracing/integrations or https://www.braintrust.dev/docs/integrations/agent-frameworks/autogen (checked 2026-08-31).

Upstream sources

Braintrust docs sources checked

Local repo files inspected

  • py/src/braintrust/integrations/__init__.py — no AG2/ag2 entry in the integration registry (only AutoGenIntegration, which wraps autogen-agentchat)
  • py/src/braintrust/integrations/autogen/ — existing integration's integration.py/patchers.py/tracing.py and cassettes (0.7.0/, latest/) are all autogen-agentchat-specific; no ag2/ directory exists
  • py/src/braintrust/integrations/versioning.py — no ag2 version entry
  • py/pyproject.toml — no ag2 entry in [tool.braintrust.matrix]
  • py/noxfile.py — no test_ag2 session
  • Case-insensitive grep for ag2/pyautogen/deepgram across py/src/braintrust/ — zero matches

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions