Skip to content

fix(crewai): preserve legacy input wrapper compatibility - #3522

Merged
contextablemark merged 1 commit into
mainfrom
contextablemark/fix-crewai-input-wrapper-compat
Dec 1, 2026
Merged

contextablemark merged 1 commit into
mainfrom
contextablemark/fix-crewai-input-wrapper-compat

Conversation

@contextablemark

Copy link
Copy Markdown
Contributor

Summary

AG-UI #3513 started passing strip_leading_system to crewai_prepare_inputs on every run. OpenBot's regular and conversational CrewAI engines wrap that helper with its 1.0 signature. Both reject the keyword with a TypeError before reaching the model. OpenBot regular engine wrapper · OpenBot conversational engine wrapper

Keep the original helper call for requests without run guidance. When a request carries prepared guidance, pass strip_leading_system=False to preserve the remaining system messages after guidance extraction.

Verification

  • Added an endpoint regression for each driver using a wrapper with the 1.0 signature. Both cases reproduced the TypeError before the fix and now finish the run and reach the model stub. All 18 run-guidance tests passed.
  • Ran the full CrewAI Python suite with the locked dependencies on Python 3.12. 866 passed, 3 skipped, and 30 deselected.
  • Built a local ag-ui-crewai==1.1.0 wheel using the staged release metadata and this patch. OpenBot's CrewAI suite passed on main (36 tests) and on the #2636 head (51 tests). These suites exercise instruction delivery and tool hand-back through local provider endpoints.

Release

Merge this fix before publishing ag-ui-crewai==1.1.0. After this PR lands, update release/next from main to include it in the existing release PR #3521. A local merge preview confirmed that the adapter still has version 1.1.0.

@contextablemark
contextablemark requested a review from a team as a code owner December 1, 2026 19:07
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Python Preview Packages

Version 0.0.0.dev1796152055 published to TestPyPI.

Warning: These packages are built from contributor code that may not yet have been vetted for correctness or security. Install at your own risk and do not use in production.

Install with uv

Add the TestPyPI index to your pyproject.toml:

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = true

Then install the packages you need:

# Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1796152055' --index testpypi

# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1796152055' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1796152055' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1796152055' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1796152055' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1796152055' --index testpypi

Install with pip

pip install \
  --index-url https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple/ \
  ag-ui-protocol==0.0.0.dev1796152055

Use --extra-index-url https://pypi.org/simple/ so pip can resolve
transitive dependencies (pydantic, fastapi, etc.) from real PyPI.


Commit: d6f7a6d

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue that could prevent agentic chat requests from completing when run guidance was disabled. Requests now process successfully in both regular and conversational flows, while requests with guidance enabled continue to preserve their existing behavior. This improves reliability for chat interactions across both flow types without changing how guidance-enabled requests are handled.

The endpoint now omits strip_leading_system when run guidance is disabled and passes False when guidance is active. A parameterized regression test covers regular and conversational flows with guidance disabled.

Changes: CrewAI run guidance compatibility

Layer / File(s) Summary
Conditional input preparation and regression coverage
integrations/crew-ai/python/ag_ui_crewai/endpoint.py, integrations/crew-ai/python/tests/test_run_guidance.py
When guidance is active, the endpoint passes strip_leading_system=False. Otherwise, it omits the keyword. Tests cover successful requests and one model call for regular and conversational flows using a wrapper with the legacy keyword signature.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • ag-ui-protocol/ag-ui#3513: Adds run guidance behavior that this change updates for compatibility with CrewAI wrappers using the 1.0 signature.

Suggested reviewers: davidmckayv, ranst91

Merge Risk: Minimal · up to 683f7

This change restores compatibility for existing CrewAI wrappers that use the older input-preparation signature, and it leaves guidance-enabled behavior as intended. Regression tests cover the affected no-guidance paths, and no merge-blocking risk is evident.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Description check Inconclusive The description follows the repository template's intent. The template is mostly a contributing reminder (file an issue first, read CONTRIBUTING.md). The author does not state that an issue was filed … Add a link to the related issue or confirm that the change was discussed with maintainers, as the template's contributing guidance asks. Optionally note that CONTRIBUTING.md was followed. The rest of the description is complete and needs no…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: a CrewAI fix that keeps the legacy input wrapper (1.0 signature) working. The changeset makes the endpoint call the helper without the new keyword when no run guidance…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: a CrewAI fix that keeps the legacy input wrapper (1.0 signature) working. The changeset makes the endpoint call the helper without the new keyword when no run guidance is active, and adds a regression test for that case. The title is specific, concise, and matches the objectives.

Full details: Description check

Explanation

The description follows the repository template's intent. The template is mostly a contributing reminder (file an issue first, read CONTRIBUTING.md). The author does not state that an issue was filed or linked, and does not mention the contributing guide. The description gives a clear summary, the cause (AG-UI #3513 and the 1.0 wrapper signature), the fix, verification steps, and release sequencing.

Resolution

Add a link to the related issue or confirm that the change was discussed with maintainers, as the template's contributing guidance asks. Optionally note that CONTRIBUTING.md was followed. The rest of the description is complete and needs no changes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 236fa80 and 683f78d.

Files selected for processing: 2

  • integrations/crew-ai/python/ag_ui_crewai/endpoint.py
  • integrations/crew-ai/python/tests/test_run_guidance.py

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pkg-pr-new

pkg-pr-new Bot commented Dec 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

@ag-ui/a2a-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a-middleware@3522

@ag-ui/a2ui-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2ui-middleware@3522

@ag-ui/event-throttle-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/event-throttle-middleware@3522

@ag-ui/mcp-apps-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mcp-apps-middleware@3522

@ag-ui/mcp-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mcp-middleware@3522

@ag-ui/a2a

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a@3522

@ag-ui/adk-js

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/adk-js@3522

@ag-ui/adk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/adk@3522

@ag-ui/ag2

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/ag2@3522

@ag-ui/agno

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/agno@3522

@ag-ui/antigravity

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/antigravity@3522

@ag-ui/aws-strands

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/aws-strands@3522

@ag-ui/claude-agent-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/claude-agent-sdk@3522

@ag-ui/claude-managed-agents

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/claude-managed-agents@3522

@ag-ui/crewai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/crewai@3522

@ag-ui/langchain

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langchain@3522

@ag-ui/langgraph

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langgraph@3522

@ag-ui/llamaindex

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/llamaindex@3522

@ag-ui/mastra

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mastra@3522

@ag-ui/openai-agents

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/openai-agents@3522

@ag-ui/pydantic-ai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/pydantic-ai@3522

@ag-ui/vercel-ai-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/vercel-ai-sdk@3522

@ag-ui/watsonx

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/watsonx@3522

@ag-ui/cloudflare-agents

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/cloudflare-agents@3522

@ag-ui/a2ui-toolkit

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2ui-toolkit@3522

create-ag-ui-app

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/create-ag-ui-app@3522

@ag-ui/client

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/client@3522

@ag-ui/core

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/core@3522

@ag-ui/encoder

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/encoder@3522

@ag-ui/proto

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/proto@3522

commit: 683f78d

@contextablemark

Copy link
Copy Markdown
Contributor Author

Hey @davidmckayv, could you review and approve this fix before we release ag-ui-crewai 1.1.0?

Additional testing with the staged 1.1.0 build exposed a crash before the first model call in both OpenBot CrewAI engines. The adapter passed a new keyword to their input wrappers, which still use the 1.0 signature. This patch preserves that signature for runs without guidance. Both regression cases reproduced the crash before the fix, and the patched wheel passed the CrewAI suites on OpenBot main and CopilotKit/OpenBot#2636.

We want to land this before merging the release PR (#3521).

@davidmckayv davidmckayv 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.

Approved at 683f78d. The fix is right. With guidance off, the call is now exactly the 1.0 call: strip_leading_system is left out, and its default is True, which matches the old guidance is None value. So wrappers written against the 1.0 signature, like OpenBot's bundled CrewAI engines, work again. With guidance on, it still passes strip_leading_system=False, as it should. The new test wraps the helper with the exact 1.0 signature and covers both the regular and conversational flows. CI is green.

One nit, not blocking: a 1.0-style wrapper on an endpoint with guidance turned on would still get the new keyword and fail. A line in the changelog or README telling wrappers to accept **kwargs before turning guidance on would help.

@contextablemark
contextablemark merged commit 51ce6d7 into main Dec 1, 2026
89 checks passed
@contextablemark
contextablemark deleted the contextablemark/fix-crewai-input-wrapper-compat branch December 1, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants