feat: Native framework integration for LangChain, CrewAI, AutoGen, LlamaIndex#2
Closed
feat: Native framework integration for LangChain, CrewAI, AutoGen, LlamaIndex#2
Conversation
…, and LlamaIndex Implement auto-detection and seamless integration with popular agent frameworks so the @agent decorator is not required. The SDK detects installed frameworks at runtime and monkey-patches their core execution methods to emit lifecycle events (start/end/error, step, tool call, LLM call). Architecture: - detection.py: Framework detection via importlib + sys.modules inspection - registry.py: Singleton adapter registry mapping frameworks to adapters - core.py: AgentQ class with context manager + auto_integrate() one-liner - adapters/base.py: BaseAdapter ABC with event emission infrastructure - adapters/langchain.py: Hooks AgentExecutor.invoke and LCEL RunnableSequence - adapters/crewai.py: Hooks Crew.kickoff and Agent.execute_task - adapters/autogen.py: Hooks ConversableAgent.initiate_chat and generate_reply - adapters/llamaindex.py: Hooks ReActAgent/AgentRunner chat and query methods All adapters store direct class references for reliable unpatch, and all 52 unit tests pass covering detection, registry, core, and all 4 adapters. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FrameworkDetectorinspectssys.modulesandimportlibto detect which agent frameworks (LangChain, CrewAI, AutoGen, LlamaIndex) are installed and active at runtime@agentdecorator neededagentq_sdk.auto_integrate()(one-liner) or useAgentQ()as a context manager to activate framework integrationArchitecture
Test plan
🤖 Generated with Claude Code