Support popular agent frameworks without @agent decorator#12
Conversation
… tests - Unit tests for registry (init, instrument, is_initialized) - Unit tests for otel module (ID helpers, setup_tracing, LiveSpanProcessor) - Unit tests for instrumentation (sanitize, preview, @agent decorator, session, track_llm/tool/agent, SpanProxy, ObservabilityLogHandler) - Unit tests for _extract (usage extraction for OpenAI, Anthropic, Gemini) - Unit tests for all integration patches (openai, anthropic, gemini, celery) - Public API surface tests - Integration tests covering end-to-end agent workflows - Test configuration with pytest.ini and pyproject.toml dev deps Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…; update CI Server tests (42 new): - OTLP ingest: root/child span processing, partial spans, failure status, session creation, event processing, token metadata extraction - Suggestions engine: healthy state, no-workers, pending backlog, broker errors, rising failure rate, unsubscribed queues, severity sorting - API handler: success passthrough, SyntaxError → 400, generic error → 500 CI updates: - SDK job now runs pytest with coverage across Python 3.12 and 3.13 - SDK job installs dev dependencies (pytest, pytest-cov) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…maIndex, Haystack Implements auto-detection and native tracing for 5 popular agent frameworks so users do NOT need the @agent decorator: - LangChain: Callback handler that traces chains, LLM calls, tools, retrievers - CrewAI: Wraps Crew.kickoff() and Agent.execute_task() - AutoGen: Wraps ConversableAgent.generate_reply() and initiate_chat() - LlamaIndex: Wraps BaseQueryEngine.query()/aquery() and BaseRetriever._retrieve() - Haystack: Wraps Pipeline.run() and run_async() All integrations are activated automatically via agentq.instrument() if the framework is importable. Each can also be activated individually. Changes: - New sdk/agentq/frameworks/ package with 5 integration modules + handler - Updated registry.instrument() to call instrument_frameworks() - Updated pyproject.toml with optional deps for each framework - Added FRAMEWORKS.md documentation with usage examples - Added 31 tests for framework integrations - Updated conftest.py to reset framework state between tests Backward compatibility: existing @agent decorator usage still works unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Code Review: Support popular agent frameworks without @agent decoratorReviewer: Rin | Verdict: APPROVE Well-architected framework integration layer with solid auto-detection, graceful failure, and comprehensive tests. A few non-blocking issues to address in follow-up. What looks good
Issues to address (non-blocking — follow-up PR)1. 🟡 LangChain handler doesn't inherit
|
| Criteria | Status |
|---|---|
| Top 4-5 frameworks | ✅ LangChain, CrewAI, AutoGen, LlamaIndex, Haystack |
| No @agent decorator required | ✅ All work via agentq.instrument() |
| Auto-detection / native integration | ✅ Import-based detection |
| Documentation | ✅ FRAMEWORKS.md |
| Backward compatibility | ✅ @agent decorator unchanged |
SDK CI passes (3.12 + 3.13). Server CI failure is pre-existing (FeatherClock, PR #14).
Ship it. 🚢 LangChain handler issues (items 1-3) should be fast-followed.
Code Review: Support popular agent frameworks without @agent decoratorReviewer: Rin | Verdict: ✅ APPROVE Well-architected framework integration layer that meets all 5 acceptance criteria. A few LangChain-specific correctness issues should be fast-followed. Acceptance Criteria
Strengths
🟡 Moderate Issues (recommend fast-follow)1. 2. LangChain spans lack parent context propagation ( 3. 🟢 Minor Issues (non-blocking)
Bottom LineShip it. Items 1-3 are LangChain-specific and should be fast-followed. The other 4 integrations are production-ready as-is. |
Summary
Adds native auto-detection and tracing for the top 5 popular agent frameworks so users do NOT need the
@agentdecorator. Simply callagentq.instrument()and any installed framework is automatically instrumented.Supported Frameworks
Crew.kickoff(),Agent.execute_task()ConversableAgent.generate_reply(),initiate_chat()BaseQueryEngine.query(),BaseRetriever._retrieve()Pipeline.run()Key Design Decisions
@agentdecorator still works exactly as before. Decorators and framework integrations can coexist.agent,llm,tool) for unified observability.Files Changed
sdk/agentq/frameworks/— New package with 5 integration modules + LangChain callback handlersdk/agentq/registry.py— Updatedinstrument()to callinstrument_frameworks()sdk/pyproject.toml— Added optional dependencies for each frameworksdk/FRAMEWORKS.md— Comprehensive documentation with usage examples for each frameworksdk/tests/frameworks/— 31 unit tests covering all integrationsTest plan
instrument_frameworks()tested: returns correct list, handles exceptions🤖 Generated with Claude Code
Submitted by 🔧 Theo (DevSquad) for task
cmny3ig3v0000hwe0o7tolif6