Skip to content

feat: add agui fastAPI compatible langgraph agent - #2117

Merged
ranst91 merged 15 commits into
mainfrom
feat/lg-agui-fastapi-agent
Jul 15, 2025
Merged

ranst91 merged 15 commits into
mainfrom
feat/lg-agui-fastapi-agent

Conversation

@ranst91

@ranst91 ranst91 commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

This PR bring support for Copilotkit's binding of the AGUI LangGraph FastAPI/Python agent

Summary by CodeRabbit

  • New Features

    • Introduced a new AGUI-compatible LangGraph agent class with enhanced event handling and state management in the Python SDK.
    • Expanded the public API to include the new agent class.
    • Added support for FastAPI integration with LangGraphAGUIAgent in examples and documentation.
  • Dependency Updates

    • Updated dependencies for CopilotKit packages in the UI example.
    • Adjusted version constraints and added a new optional dependency for the Python SDK.
    • Added @ag-ui/langgraph dependency and related exports.
  • Documentation

    • Updated configuration examples to replace deprecated remoteEndpoints with agents object for improved integration.
    • Simplified FastAPI endpoint setup for LangGraph agents in examples.
    • Revised self-hosting and deployment snippets to reflect new agent configuration patterns.

@coderabbitai

coderabbitai Bot commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

"""

Walkthrough

A new Python module for CopilotKit integration with LangGraph, langgraph_agui_agent.py, is introduced. It defines a specialized agent class with custom event handling and state management. The package's public API is updated to export this agent. Dependency versions are updated in both the Python SDK and a UI example.

Changes

File(s) Change Summary
examples/coagents-research-canvas/ui/package.json Updated @copilotkit/react-core, @copilotkit/react-ui, and @copilotkit/runtime dependencies from 1.9.2-next.7 to 0.0.0-feat-lg-agui-fastapi-agent-20250715154607.
sdk-python/copilotkit/langgraph_agui_agent.py New module: Implements LangGraphAGUIAgent with CopilotKit-specific event handling, custom event dispatch, and state merging.
sdk-python/copilotkit/init.py Added LangGraphAGUIAgent to public exports in __all__.
sdk-python/pyproject.toml Updated langgraph dependency constraint to <=0.5.0; added optional ag-ui-langgraph[fastapi] dependency; bumped package version to 0.1.55.
examples/coagents-research-canvas/agent/pyproject.toml Updated copilotkit dependency version constraint from 0.1.52 to 0.1.55.
examples/coagents-research-canvas/agent/research_canvas/demo.py Replaced LangGraphAgent with LangGraphAGUIAgent and registered agents using add_langgraph_fastapi_endpoint at distinct FastAPI paths.
examples/coagents-research-canvas/ui/src/app/api/copilotkit/route.ts Replaced remoteEndpoints with agents object containing two LangGraphHttpAgent instances; added import for LangGraphHttpAgent.
docs/content/docs/coagents/coagent-troubleshooting/common-coagent-issues.mdx Updated example to replace deprecated remoteEndpoints array with agents object for LangGraph HTTP agent configuration.
docs/content/docs/coagents/persistence/message-persistence.mdx Updated example to use FastAPI app with add_langgraph_fastapi_endpoint and LangGraphAGUIAgent, removing previous CopilotKit remote endpoint setup.
docs/snippets/langgraph-platform-deployment-tabs.mdx Updated snippet to use LangGraphAGUIAgent and add_langgraph_fastapi_endpoint replacing older CopilotKit FastAPI integration. Added React Tab import.
docs/snippets/self-hosting-copilot-runtime-langgraph-endpoint.mdx Replaced langGraphPlatformEndpoint with LangGraphAgent and updated CopilotRuntime configuration to use agents object instead of remoteEndpoints.
docs/snippets/self-hosting-copilot-runtime-starter.mdx Replaced remoteEndpoints with empty agents object in CopilotRuntime initialization; removed unused imports and extraneous semicolon.
docs/snippets/self-hosting-remote-endpoints.mdx Replaced remoteEndpoints array with agents object containing LangGraphHttpAgent for FastAPI URL; added React Tab import.
CopilotKit/packages/runtime/src/lib/runtime/langgraph/langgraph-agent.ts Added import and export of LangGraphHttpAgent from @ag-ui/langgraph.

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
Loading

Possibly related PRs

  • feat: integrate AG-UI LangGraph agent in CopilotKit #1968: Both PRs introduce a LangGraph agent tailored for CopilotKit with similar custom event handling, intermediate state prediction, and state merging logic, but the main PR implements this in Python while the retrieved PR implements it in TypeScript for the runtime package.
  • chore: use agui with research canvas tests #2018: The main PR introduces a new LangGraphAGUIAgent class and related event handling in the Python SDK, while the retrieved PR updates the research canvas example to use the AGUI agent in the frontend runtime setup; these changes are related as they both involve integrating the AGUI agent but operate in different layers (SDK vs frontend example).
  • fix: resolve agui agents only after all other endpoints #2099: Both PRs involve AGUI agents; the main PR adds a new specialized agent class and integration, while the retrieved PR fixes the order of resolving AGUI agents in the runtime, relating by the AGUI agent concept but addressing different layers.

Suggested reviewers

  • mme
  • suhasdeshpande
  • ataibarkai
  • tylerslaton
    """

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb3532b and 55294af.

⛔ Files ignored due to path filters (1)
  • examples/coagents-research-canvas/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • examples/coagents-research-canvas/ui/package.json (1 hunks)
  • examples/coagents-research-canvas/ui/src/app/api/copilotkit/route.ts (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel

vercel Bot commented Jul 7, 2025 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
copilotkit-feature-viewer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 6:41pm
demo-viewer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 6:41pm
docs ❌ Failed (Inspect) Jul 15, 2025 6:41pm
examples-coagents-ai-travel-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 6:41pm
examples-coagents-research-canvas-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 6:41pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
examples-coagents-ai-researcher-ui ⬜️ Ignored (Inspect) Visit Preview Jul 15, 2025 6:41pm

@ranst91
ranst91 force-pushed the feat/lg-agui-fastapi-agent branch from 0aaac7e to 2179da6 Compare July 7, 2025 09:26
@ranst91
ranst91 force-pushed the feat/lg-agui-fastapi-agent branch from ec84af3 to a5307c1 Compare July 7, 2025 11:00
@ranst91
ranst91 marked this pull request as ready for review July 7, 2025 11:01

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
sdk-python/copilotkit/langgraph_agui_agent.py (2)

35-40: Consider using dataclass for cleaner implementation.

The PredictStateTool class 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4bd0301 and a5307c1.

⛔ Files ignored due to path filters (2)
  • examples/coagents-research-canvas/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • sdk-python/poetry.lock is 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__.py
  • sdk-python/pyproject.toml
  • 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/__init__.py
  • sdk-python/pyproject.toml
  • sdk-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 LangGraphAGUIAgent follow the established patterns in the module.

Also applies to: 23-23

Comment thread sdk-python/pyproject.toml Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 PredictStateTool class 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: str

Note: 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

📥 Commits

Reviewing files that changed from the base of the PR and between a5307c1 and 25d170a.

📒 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.

@ranst91
ranst91 force-pushed the feat/lg-agui-fastapi-agent branch from c3ae1de to eb3532b Compare July 15, 2025 15:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
sdk-python/copilotkit/langgraph_agui_agent.py (1)

148-154: Simplify nested if statements for better readability

The 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

📥 Commits

Reviewing files that changed from the base of the PR and between 0923bc1 and eb3532b.

⛔ Files ignored due to path filters (3)
  • examples/coagents-research-canvas/agent/poetry.lock is excluded by !**/*.lock
  • examples/coagents-research-canvas/ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
  • sdk-python/poetry.lock is 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 organization

The 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 definitions

The enums provide clear constants for event handling, and the type aliases improve code readability and maintainability.


46-50: LGTM: Proper class initialization with schema extension

The constructor correctly calls the parent class and extends the constant schema keys with "copilotkit", following the established pattern.


57-82: LGTM: Comprehensive message event emission

The 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 handling

The tool call event emission correctly implements the complete lifecycle (start → args → end) with appropriate event data.


112-121: LGTM: State snapshot event handling

The state emission logic correctly updates the active run state and dispatches the appropriate state snapshot event.


158-188: LGTM: Robust event handling with defensive programming

The method properly handles nested property access and implements good defensive programming practices to avoid AttributeError exceptions.


189-201: LGTM: Proper state merging with CopilotKit integration

The method correctly extends the merged state with CopilotKit actions derived from the tools, maintaining backward compatibility while adding the required integration.

@github-actions

github-actions Bot commented Jul 15, 2025 •

Copy link
Copy Markdown
Contributor

Test Results

Status: ❌ Failed (View Run)

Commit: 66c6a89

Duration: 728.6s

Total Tests: 33

Pass Rate: 97.0%

Failed Tests: 1

❌ Failed Tests

🔍 Detailed Results

coagents-research-canvas

CoAgents Research Canvas (UI) - Local Depenencies

Model Browser Status Video
OpenAI chromium ❌ FAILED Video
Anthropic chromium ✅ PASSED -
CrewAI chromium ✅ PASSED -

coagents-qa-native

CoAgents QA Native (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -

coagents-qa-text

CoAgents QA Text (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -
OpenAI (LGC Python) chromium ✅ PASSED -
Anthropic (LGC Python) chromium ✅ PASSED -
OpenAI (LGC JS) chromium ✅ PASSED -
Anthropic (LGC JS) chromium ✅ PASSED -

coagents-routing

CoAgents Routing (UI) - Local

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -

next-openai

Next OpenAI - Self Hosted

Model Browser Status Video
OpenAI chromium ✅ PASSED -
Anthropic chromium ✅ PASSED -
LangChain (OpenAI) chromium ✅ PASSED -
Groq chromium ✅ PASSED -

@changesets-bot-copilotkit

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 55294af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@copilotkit/runtime Patch
@copilotkit/runtime-client-gql Patch
@copilotkit/react-core Patch
@copilotkit/react-textarea Patch
@copilotkit/react-ui Patch
@copilotkit/sdk-js Patch
@copilotkit/shared Patch

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Previews

Commit SHA: c830e2d

Name Preview
coagents-research-canvas Preview • Preview with LGC Python • Preview with LGC JS
coagents-routing Preview • Preview with LGC Python • Preview with LGC JS
coagents-qa-text Preview • Preview with LGC Python • Preview with LGC JS
coagents-qa-native Preview • Preview with LGC Python • Preview with LGC JS
next-openai Preview

This branch had an error being deployed

1 failed and 4 active deployments
Preview – copilotkit-feature-viewer — 55294af2 Deployed Jul 15, 2025 by vercel[bot]
Preview – examples-coagents-research-canvas-ui — 55294af2 Deployed Jul 15, 2025 by vercel[bot]
Preview – demo-viewer — 55294af2 Deployed Jul 15, 2025 by vercel[bot]
Preview – examples-coagents-ai-travel-app — 55294af2 Deployed Jul 15, 2025 by vercel[bot]
Preview – docs — 55294af2 Deployed Jul 15, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant