Skip to content

fix: resolve agui agents only after all other endpoints - #2099

Merged
ranst91 merged 4 commits into
mainfrom
fix/agent-state-resolving
Jul 3, 2025
Merged

ranst91 merged 4 commits into
mainfrom
fix/agent-state-resolving

Conversation

@ranst91

@ranst91 ranst91 commented Jul 3, 2025 •

Copy link
Copy Markdown
Contributor

Bad order of actions was causing issues.
First, look for the remote endpoints, only then AGUI agents

Summary by CodeRabbit

  • Bug Fixes
    • Improved the resolution order of AGUI agents to ensure they are processed only after all other endpoints, enhancing reliability in agent handling.
    • Enhanced agent discovery and state loading for more accurate agent identification and error handling.

@vercel

vercel Bot commented Jul 3, 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 🛑 Canceled (Inspect) Jul 3, 2025 3:37pm
demo-viewer 🛑 Canceled (Inspect) Jul 3, 2025 3:37pm
docs ❌ Failed (Inspect) Jul 3, 2025 3:37pm
examples-coagents-ai-travel-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2025 3:37pm
examples-coagents-research-canvas-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 3, 2025 3:37pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
examples-coagents-ai-researcher-ui ⬜️ Ignored (Inspect) Visit Preview Jul 3, 2025 3:37pm

@coderabbitai

coderabbitai Bot commented Jul 3, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This update refactors the agent resolution logic in the loadAgentState method of the runtime package. AGUI agents are now only resolved after all other endpoints have been processed, and only when the agent's endpoint type is not LangGraphPlatform. Error handling for agent resolution is also more narrowly scoped.

Changes

File(s) Change Summary
CopilotKit/.changeset/bright-ravens-pump.md Adds patch changelog describing the fix to AGUI agent resolution order in the runtime package.
CopilotKit/packages/runtime/src/lib/runtime/copilot-runtime.ts Refactors discoverAgentsFromAgui to use Object.entries with improved fallback for agent properties; refactors loadAgentState to defer AGUI agent resolution and narrow error handling scope based on endpoint type.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant Runtime
    participant OtherEndpoints
    participant AGUIAgent

    Caller->>Runtime: loadAgentState()
    Runtime->>OtherEndpoints: Process all other endpoints
    alt Agent endpoint is not LangGraphPlatform
        Runtime->>AGUIAgent: Fetch and validate AGUI agent
        AGUIAgent-->>Runtime: Return agent or error
        Runtime->>Caller: Return agent state or error
    else Agent endpoint is LangGraphPlatform
        Runtime->>Caller: Return agent state directly
    end
Loading

Possibly related PRs

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 943e6ec and 3441dfd.

📒 Files selected for processing (1)
  • CopilotKit/packages/runtime/src/lib/runtime/copilot-runtime.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • CopilotKit/packages/runtime/src/lib/runtime/copilot-runtime.ts
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: Build Images (next-openai, next-openai)
  • GitHub Check: Build Images (coagents-routing, ui)
  • GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
  • 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, ui)
  • GitHub Check: Build Images (coagents-research-canvas, ui)
  • GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
  • GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
  • GitHub Check: Test (18.x)
  • GitHub Check: Test (20.x)
✨ 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.

@changesets-bot-copilotkit

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b986e7d

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

@ranst91
ranst91 merged commit 3a7f45f into main Jul 3, 2025
@ranst91
ranst91 deleted the fix/agent-state-resolving branch July 3, 2025 15:09
@github-actions

github-actions Bot commented Jul 3, 2025 •

Copy link
Copy Markdown
Contributor

Test Results

Status: ❌ Failed (View Run)

Commit: cb51195

Duration: 873.6s

Total Tests: 20

Pass Rate: 65.0%

Failed Tests: 7

❌ Failed Tests

🔍 Detailed Results

coagents-research-canvas

CoAgents Research Canvas (UI) - Local Depenencies

Model Browser Status Video
OpenAI chromium ✅ PASSED -
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 ❌ FAILED Video
Anthropic chromium ❌ FAILED Video
Google Generative AI chromium ❌ FAILED Video
LangChain (OpenAI) chromium ❌ FAILED Video
LangChain (Anthropic) chromium ❌ FAILED Video
LangChain (Gemini) chromium ❌ FAILED Video
Groq chromium ❌ FAILED Video

@github-actions

github-actions Bot commented Jul 3, 2025

Copy link
Copy Markdown
Contributor

Previews

Commit SHA: f02a9f7

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 – docs — b986e7d1 Deployed Jul 3, 2025 by vercel[bot]
Preview – demo-viewer — b986e7d1 Deployed Jul 3, 2025 by vercel[bot]
Preview – examples-coagents-research-canvas-ui — b986e7d1 Deployed Jul 3, 2025 by vercel[bot]
Preview – copilotkit-feature-viewer — b986e7d1 Deployed Jul 3, 2025 by vercel[bot]
Preview – examples-coagents-ai-travel-app — b986e7d1 Deployed Jul 3, 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