Repository navigation
feat: add agui fastAPI compatible langgraph agent - #2117
Conversation
|
Caution Review failedThe pull request is closed. """ WalkthroughA new Python module for CopilotKit integration with LangGraph, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LangGraphAGUIAgent
participant LangGraphAgent (super)
participant CopilotKit
User->>LangGraphAGUIAgent: Send custom CopilotKit event (e.g., manually_emit_message)
LangGraphAGUIAgent->>LangGraphAGUIAgent: _dispatch_event intercepts event
alt CopilotKit custom event
LangGraphAGUIAgent->>LangGraphAgent (super): Dispatches standard events (start, content, end)
else Other events
LangGraphAGUIAgent->>LangGraphAgent (super): Dispatches event as usual
end
LangGraphAGUIAgent->>CopilotKit: Emits filtered or custom events as needed
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
0aaac7e to
2179da6
Compare
ec84af3 to
a5307c1
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
sdk-python/copilotkit/langgraph_agui_agent.py (2)
35-40: Consider using dataclass for cleaner implementation.The
PredictStateToolclass would benefit from using Python's dataclass decorator.+from dataclasses import dataclass + +@dataclass class PredictStateTool: - def __init__(self, tool: str, state_key: str, tool_argument: str): - self.tool = tool - self.state_key = state_key - self.tool_argument = tool_argument + tool: str + state_key: str + tool_argument: str
150-157: Simplify nested if statements.The nested if statements can be combined for better readability.
- if "copilotkit:emit-tool-calls" in metadata: - if metadata["copilotkit:emit-tool-calls"] is False and is_tool_event: - return "" # Don't dispatch this event + if "copilotkit:emit-tool-calls" in metadata and metadata["copilotkit:emit-tool-calls"] is False and is_tool_event: + return "" # Don't dispatch this event - if "copilotkit:emit-messages" in metadata: - if metadata["copilotkit:emit-messages"] is False and is_message_event: - return "" # Don't dispatch this event + if "copilotkit:emit-messages" in metadata and metadata["copilotkit:emit-messages"] is False and is_message_event: + return "" # Don't dispatch this event
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
examples/coagents-research-canvas/ui/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlsdk-python/poetry.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
examples/coagents-research-canvas/ui/package.json(1 hunks)sdk-python/copilotkit/__init__.py(2 hunks)sdk-python/copilotkit/langgraph_agui_agent.py(1 hunks)sdk-python/pyproject.toml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
`examples/**`: All examples should be placed in the examples/ directory, with ba...
examples/**: All examples should be placed in the examples/ directory, with backend agent implementations in agent/ or agent-py/, frontend Next.js applications in ui/, and setup instructions in README.md
📄 Source: CodeRabbit Inference Engine (.cursor/rules/copilotkit-architecture.mdc)
List of files the instruction was applied to:
examples/coagents-research-canvas/ui/package.json
`{sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**}...
{sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**}: Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
📄 Source: CodeRabbit Inference Engine (.cursor/rules/copilotkit-architecture.mdc)
List of files the instruction was applied to:
sdk-python/copilotkit/__init__.pysdk-python/pyproject.tomlsdk-python/copilotkit/langgraph_agui_agent.py
`sdk-python/**/*`: Use [sdk-python/] package for developing Python agents
sdk-python/**/*: Use [sdk-python/] package for developing Python agents
📄 Source: CodeRabbit Inference Engine (.cursor/rules/quick-reference.mdc)
List of files the instruction was applied to:
sdk-python/copilotkit/__init__.pysdk-python/pyproject.tomlsdk-python/copilotkit/langgraph_agui_agent.py
`sdk-python/pyproject.toml`: Use [sdk-python/pyproject.toml] for Python SDK configuration
sdk-python/pyproject.toml: Use [sdk-python/pyproject.toml] for Python SDK configuration
📄 Source: CodeRabbit Inference Engine (.cursor/rules/quick-reference.mdc)
List of files the instruction was applied to:
sdk-python/pyproject.toml
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/copilotkit/agent.py : Check [copilotkit/agent.py] for main agent class when developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Import from the 'copilotkit' package in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/agent-js/**/*.{js,ts,jsx,tsx} : Install '@copilotkit/sdk-js' package for JavaScript agents.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.253Z
Learning: Applies to {sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**} : Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to examples/coagents-starter/agent-py/**/* : Check [coagents-starter/agent-py/] for Python agent example
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Define actions and agent logic in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/**/* : Use [sdk-python/] package for developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Python agents should be placed in folders named 'agent-py/' or 'agent/' and use the sdk-python package.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to CopilotKit/packages/sdk-js/**/* : Use [sdk-js/] package for developing JavaScript agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Define clear actions and interfaces for agents.
examples/coagents-research-canvas/ui/package.json (11)
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to CopilotKit/package.json : Review [CopilotKit/package.json] for workspace setup
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to CopilotKit/package.json : Use [CopilotKit/package.json] for workspace setup
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to CopilotKit/packages/react-ui/**/* : Add [react-ui/] for pre-built components when building a simple Copilot or customizing UI components
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to CopilotKit/packages/react-core/**/* : Use [react-core/] for basic integration when building a simple Copilot
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.253Z
Learning: Applies to CopilotKit/package.json : Workspace configuration should be maintained in CopilotKit/package.json
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.253Z
Learning: Applies to CopilotKit/packages/react-ui/** : UI components for copilot interfaces should be placed in CopilotKit/packages/react-ui/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/agent-js/**/*.{js,ts,jsx,tsx} : Install '@copilotkit/sdk-js' package for JavaScript agents.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.253Z
Learning: Applies to CopilotKit/packages/react-core/** : Core React components and hooks for CopilotKit should be placed in CopilotKit/packages/react-core/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/frontend-development.mdc:0-0
Timestamp: 2025-07-04T14:02:20.704Z
Learning: Applies to packages/{react-ui,react-core,react-textarea}/**/*.tsx : Maintain consistent styling with Tailwind CSS
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/frontend-development.mdc:0-0
Timestamp: 2025-07-04T14:02:20.704Z
Learning: Applies to packages/{react-ui,react-core,react-textarea}/**/*.tsx : Uses Tailwind CSS for styling
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/frontend-development.mdc:0-0
Timestamp: 2025-07-04T14:02:20.704Z
Learning: Applies to packages/{react-ui,react-core,react-textarea}/**/*.tsx : Follow accessibility best practices
sdk-python/copilotkit/__init__.py (11)
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Import from the 'copilotkit' package in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/copilotkit/agent.py : Check [copilotkit/agent.py] for main agent class when developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.253Z
Learning: Applies to {sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**} : Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/agent-js/**/*.{js,ts,jsx,tsx} : Install '@copilotkit/sdk-js' package for JavaScript agents.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/**/* : Use [sdk-python/] package for developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Define actions and agent logic in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to examples/coagents-starter/agent-py/**/* : Check [coagents-starter/agent-py/] for Python agent example
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/agent/{main.py,index.js} : Single agent pattern: Use 'agent/main.py' for Python or 'agent/index.js' for JavaScript as the main entry point for simple agents.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Python agents should be placed in folders named 'agent-py/' or 'agent/' and use the sdk-python package.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to CopilotKit/packages/sdk-js/**/* : Use [sdk-js/] package for developing JavaScript agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to examples/coagents-starter-crewai-crews/**/* : Use [coagents-starter-crewai-crews/] for CrewAI crews integration
sdk-python/pyproject.toml (2)
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/pyproject.toml : Use [sdk-python/pyproject.toml] for Python SDK configuration
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/pyproject-template.toml : Configure 'pyproject-template.toml' for Python agent projects.
sdk-python/copilotkit/langgraph_agui_agent.py (6)
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/copilotkit/agent.py : Check [copilotkit/agent.py] for main agent class when developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Import from the 'copilotkit' package in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Define actions and agent logic in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.253Z
Learning: Applies to {sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**} : Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to examples/coagents-starter/agent-py/**/* : Check [coagents-starter/agent-py/] for Python agent example
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Define clear actions and interfaces for agents.
🧬 Code Graph Analysis (1)
sdk-python/copilotkit/__init__.py (1)
sdk-python/copilotkit/langgraph_agui_agent.py (1)
LangGraphAGUIAgent(48-200)
🪛 Ruff (0.11.9)
sdk-python/copilotkit/langgraph_agui_agent.py
3-3: ag_ui_langgraph.add_langgraph_fastapi_endpoint imported but unused
Remove unused import: ag_ui_langgraph.add_langgraph_fastapi_endpoint
(F401)
14-14: ag_ui.core.RawEvent imported but unused
Remove unused import
(F401)
15-15: ag_ui.core.RunAgentInput imported but unused
Remove unused import
(F401)
150-151: Use a single if statement instead of nested if statements
(SIM102)
154-155: Use a single if statement instead of nested if statements
(SIM102)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Build Images (next-openai, next-openai)
- GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, agent, js, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, ui)
- GitHub Check: Test (20.x)
- GitHub Check: Test (18.x)
🔇 Additional comments (2)
examples/coagents-research-canvas/ui/package.json (1)
12-14: LGTM! Consistent version updates.All three @CopilotKit packages have been updated to the same version (1.9.2-next.17), maintaining version consistency across the SDK components.
sdk-python/copilotkit/__init__.py (1)
8-8: LGTM! New agent class properly exposed in the public API.The import and export of
LangGraphAGUIAgentfollow the established patterns in the module.Also applies to: 23-23
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
sdk-python/copilotkit/langgraph_agui_agent.py (1)
163-165: Add complete defensive checks for nested property access.The code still accesses
event["data"]["chunk"]without verifying that these keys exist, which could raise KeyError if the event structure is unexpected.- chunk = event.get("data", {}).get("chunk") + data = event.get("data", {}) + chunk = data.get("chunk") if isinstance(data, dict) else None tool_call_chunks = getattr(chunk, "tool_call_chunks", []) if chunk else [] tool_call_data = tool_call_chunks[0] if tool_call_chunks else None
🧹 Nitpick comments (2)
sdk-python/copilotkit/langgraph_agui_agent.py (2)
33-38: Consider using dataclass for cleaner implementation.The
PredictStateToolclass could benefit from using Python's dataclass decorator for better type safety and automatic method generation.-class PredictStateTool: - def __init__(self, tool: str, state_key: str, tool_argument: str): - self.tool = tool - self.state_key = state_key - self.tool_argument = tool_argument +from dataclasses import dataclass + +@dataclass +class PredictStateTool: + tool: str + state_key: str + tool_argument: strNote: Add the dataclass import at the top of the file.
146-155: Simplify nested if statements.The nested if statements can be combined for better readability.
- if "copilotkit:emit-tool-calls" in metadata: - if metadata["copilotkit:emit-tool-calls"] is False and is_tool_event: - return "" # Don't dispatch this event + if "copilotkit:emit-tool-calls" in metadata and metadata["copilotkit:emit-tool-calls"] is False and is_tool_event: + return "" # Don't dispatch this event - if "copilotkit:emit-messages" in metadata: - if metadata["copilotkit:emit-messages"] is False and is_message_event: - return "" # Don't dispatch this event + if "copilotkit:emit-messages" in metadata and metadata["copilotkit:emit-messages"] is False and is_message_event: + return "" # Don't dispatch this event
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
sdk-python/copilotkit/langgraph_agui_agent.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`{sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**}...
{sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**}: Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
📄 Source: CodeRabbit Inference Engine (.cursor/rules/copilotkit-architecture.mdc)
List of files the instruction was applied to:
sdk-python/copilotkit/langgraph_agui_agent.py
`sdk-python/**/*`: Use [sdk-python/] package for developing Python agents
sdk-python/**/*: Use [sdk-python/] package for developing Python agents
📄 Source: CodeRabbit Inference Engine (.cursor/rules/quick-reference.mdc)
List of files the instruction was applied to:
sdk-python/copilotkit/langgraph_agui_agent.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/copilotkit/agent.py : Check [copilotkit/agent.py] for main agent class when developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Import from the 'copilotkit' package in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/agent-js/**/*.{js,ts,jsx,tsx} : Install '@copilotkit/sdk-js' package for JavaScript agents.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.253Z
Learning: Applies to {sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**} : Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to examples/coagents-starter/agent-py/**/* : Check [coagents-starter/agent-py/] for Python agent example
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Define actions and agent logic in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/**/* : Use [sdk-python/] package for developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Python agents should be placed in folders named 'agent-py/' or 'agent/' and use the sdk-python package.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to CopilotKit/packages/sdk-js/**/* : Use [sdk-js/] package for developing JavaScript agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Define clear actions and interfaces for agents.
sdk-python/copilotkit/langgraph_agui_agent.py (7)
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/copilotkit/agent.py : Check [copilotkit/agent.py] for main agent class when developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Import from the 'copilotkit' package in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Define actions and agent logic in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.253Z
Learning: Applies to {sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**} : Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to examples/coagents-starter/agent-py/**/* : Check [coagents-starter/agent-py/] for Python agent example
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.698Z
Learning: Define clear actions and interfaces for agents.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.738Z
Learning: Applies to sdk-python/**/* : Use [sdk-python/] package for developing Python agents
🪛 Ruff (0.11.9)
sdk-python/copilotkit/langgraph_agui_agent.py
148-149: Use a single if statement instead of nested if statements
(SIM102)
152-153: Use a single if statement instead of nested if statements
(SIM102)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, agent, js, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Build Images (next-openai, next-openai)
- GitHub Check: Build Images (coagents-qa-native, agent, js, local-deps)
- GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (coagents-routing, ui)
- GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
- GitHub Check: Test (20.x)
- GitHub Check: Test (18.x)
🔇 Additional comments (2)
sdk-python/copilotkit/langgraph_agui_agent.py (2)
1-18: Imports look good!All imports are properly organized and used throughout the file.
189-200: State merging implementation looks good!The method properly extends the parent's state merging logic to include CopilotKit-specific actions.
c3ae1de to
eb3532b
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
sdk-python/copilotkit/langgraph_agui_agent.py (1)
148-154: Simplify nested if statements for better readabilityThe nested if statements can be combined for cleaner code.
- if "copilotkit:emit-tool-calls" in metadata: - if metadata["copilotkit:emit-tool-calls"] is False and is_tool_event: - return "" # Don't dispatch this event + if "copilotkit:emit-tool-calls" in metadata and metadata["copilotkit:emit-tool-calls"] is False and is_tool_event: + return "" # Don't dispatch this event - if "copilotkit:emit-messages" in metadata: - if metadata["copilotkit:emit-messages"] is False and is_message_event: - return "" # Don't dispatch this event + if "copilotkit:emit-messages" in metadata and metadata["copilotkit:emit-messages"] is False and is_message_event: + return "" # Don't dispatch this event
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
examples/coagents-research-canvas/agent/poetry.lockis excluded by!**/*.lockexamples/coagents-research-canvas/ui/pnpm-lock.yamlis excluded by!**/pnpm-lock.yamlsdk-python/poetry.lockis excluded by!**/*.lock
📒 Files selected for processing (15)
CopilotKit/.changeset/rotten-windows-kick.md(1 hunks)CopilotKit/packages/runtime/src/lib/runtime/langgraph/langgraph-agent.ts(2 hunks)docs/content/docs/coagents/coagent-troubleshooting/common-coagent-issues.mdx(1 hunks)docs/content/docs/coagents/persistence/message-persistence.mdx(2 hunks)docs/snippets/langgraph-platform-deployment-tabs.mdx(2 hunks)docs/snippets/self-hosting-copilot-runtime-langgraph-endpoint.mdx(10 hunks)docs/snippets/self-hosting-copilot-runtime-starter.mdx(5 hunks)docs/snippets/self-hosting-remote-endpoints.mdx(2 hunks)examples/coagents-research-canvas/agent/pyproject.toml(2 hunks)examples/coagents-research-canvas/agent/research_canvas/demo.py(2 hunks)examples/coagents-research-canvas/ui/package.json(1 hunks)examples/coagents-research-canvas/ui/src/app/api/copilotkit/route.ts(2 hunks)sdk-python/copilotkit/__init__.py(2 hunks)sdk-python/copilotkit/langgraph_agui_agent.py(1 hunks)sdk-python/pyproject.toml(2 hunks)
✅ Files skipped from review due to trivial changes (3)
- CopilotKit/.changeset/rotten-windows-kick.md
- CopilotKit/packages/runtime/src/lib/runtime/langgraph/langgraph-agent.ts
- sdk-python/copilotkit/init.py
🚧 Files skipped from review as they are similar to previous changes (11)
- docs/snippets/self-hosting-copilot-runtime-starter.mdx
- docs/snippets/self-hosting-remote-endpoints.mdx
- docs/content/docs/coagents/persistence/message-persistence.mdx
- docs/snippets/langgraph-platform-deployment-tabs.mdx
- examples/coagents-research-canvas/agent/pyproject.toml
- docs/snippets/self-hosting-copilot-runtime-langgraph-endpoint.mdx
- examples/coagents-research-canvas/ui/package.json
- docs/content/docs/coagents/coagent-troubleshooting/common-coagent-issues.mdx
- examples/coagents-research-canvas/ui/src/app/api/copilotkit/route.ts
- examples/coagents-research-canvas/agent/research_canvas/demo.py
- sdk-python/pyproject.toml
🧰 Additional context used
📓 Path-based instructions (2)
{sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**}
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/copilotkit-architecture.mdc
sdk-python/**/*
Instructions used from:
Sources:
📄 CodeRabbit Inference Engine
- .cursor/rules/quick-reference.mdc
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to sdk-python/copilotkit/agent.py : Check [copilotkit/agent.py] for main agent class when developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.727Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Import from the 'copilotkit' package in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.727Z
Learning: Applies to **/agent-js/**/*.{js,ts,jsx,tsx} : Install '@copilotkit/sdk-js' package for JavaScript agents.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.282Z
Learning: Applies to {sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**} : Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to examples/coagents-starter/agent-py/**/* : Check [coagents-starter/agent-py/] for Python agent example
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.727Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Define actions and agent logic in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to sdk-python/**/* : Use [sdk-python/] package for developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.727Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Python agents should be placed in folders named 'agent-py/' or 'agent/' and use the sdk-python package.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to CopilotKit/packages/sdk-js/**/* : Use [sdk-js/] package for developing JavaScript agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.727Z
Learning: Define clear actions and interfaces for agents.
sdk-python/copilotkit/langgraph_agui_agent.py (6)
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to sdk-python/copilotkit/agent.py : Check [copilotkit/agent.py] for main agent class when developing Python agents
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.727Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Import from the 'copilotkit' package in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.727Z
Learning: Applies to **/{agent,agent-py}/**/*.py : Define actions and agent logic in Python agent files.
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/copilotkit-architecture.mdc:0-0
Timestamp: 2025-07-04T14:01:37.282Z
Learning: Applies to {sdk-python/**,sdk-python/copilotkit/crewai/**,sdk-python/copilotkit/openai/**} : Python SDK and its integrations should be implemented in sdk-python/, with CrewAI agents in sdk-python/copilotkit/crewai/ and OpenAI integrations in sdk-python/copilotkit/openai/
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/quick-reference.mdc:0-0
Timestamp: 2025-07-04T14:02:44.814Z
Learning: Applies to examples/coagents-starter/agent-py/**/* : Check [coagents-starter/agent-py/] for Python agent example
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/agent-development.mdc:0-0
Timestamp: 2025-07-04T14:01:21.727Z
Learning: Define clear actions and interfaces for agents.
🧬 Code Graph Analysis (1)
sdk-python/copilotkit/langgraph_agui_agent.py (2)
CopilotKit/packages/runtime/src/lib/runtime/langgraph/langgraph-agent.ts (2)
TextMessageEvents(31-34)ToolCallEvents(36-36)registry/registry/quickstarts/mcp-starter/utils/mcp-client.ts (1)
tools(115-234)
🪛 Ruff (0.12.2)
sdk-python/copilotkit/langgraph_agui_agent.py
148-149: Use a single if statement instead of nested if statements
(SIM102)
152-153: Use a single if statement instead of nested if statements
(SIM102)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
- GitHub Check: Build Images (next-openai, next-openai)
- GitHub Check: Build Images (coagents-routing, ui)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
🔇 Additional comments (8)
sdk-python/copilotkit/langgraph_agui_agent.py (8)
1-18: LGTM: Clean imports and proper module organizationThe imports are well-organized and follow the CopilotKit Python SDK guidelines for importing from the 'copilotkit' package ecosystem.
20-44: LGTM: Well-structured enums and type definitionsThe enums provide clear constants for event handling, and the type aliases improve code readability and maintainability.
46-50: LGTM: Proper class initialization with schema extensionThe constructor correctly calls the parent class and extends the constant schema keys with "copilotkit", following the established pattern.
57-82: LGTM: Comprehensive message event emissionThe manual message event emission properly follows the event lifecycle (start → content → end) with correct event types and data structure.
84-110: LGTM: Proper tool call event handlingThe tool call event emission correctly implements the complete lifecycle (start → args → end) with appropriate event data.
112-121: LGTM: State snapshot event handlingThe state emission logic correctly updates the active run state and dispatches the appropriate state snapshot event.
158-188: LGTM: Robust event handling with defensive programmingThe method properly handles nested property access and implements good defensive programming practices to avoid AttributeError exceptions.
189-201: LGTM: Proper state merging with CopilotKit integrationThe method correctly extends the merged state with CopilotKit actions derived from the tools, maintaining backward compatibility while adding the required integration.
Test ResultsStatus: ❌ Failed (View Run) Commit: 66c6a89 Duration: 728.6s Total Tests: 33 Pass Rate: 97.0% Failed Tests: 1 ❌ Failed Tests
🔍 Detailed Resultscoagents-research-canvasCoAgents Research Canvas (UI) - Local Depenencies
coagents-qa-nativeCoAgents QA Native (UI) - Local
coagents-qa-textCoAgents QA Text (UI) - Local
coagents-routingCoAgents Routing (UI) - Local
next-openaiNext OpenAI - Self Hosted
|
🦋 Changeset detectedLatest commit: 55294af The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Click here if you're a maintainer who wants to add another changeset to this PR |
PreviewsCommit SHA: c830e2d
|
This PR bring support for Copilotkit's binding of the AGUI LangGraph FastAPI/Python agent
Summary by CodeRabbit
New Features
Dependency Updates
@ag-ui/langgraphdependency and related exports.Documentation
remoteEndpointswithagentsobject for improved integration.