fix: parse pydantic output before first guardrail invocation#4624
Open
Anandesh-Sharma wants to merge 1 commit intocrewAIInc:mainfrom
Open
fix: parse pydantic output before first guardrail invocation#4624Anandesh-Sharma wants to merge 1 commit intocrewAIInc:mainfrom
Anandesh-Sharma wants to merge 1 commit intocrewAIInc:mainfrom
Conversation
When guardrails are configured, _export_output() was intentionally skipped on the first attempt, setting pydantic_output to None. This meant task_output.pydantic was None on the first guardrail call but correctly populated on retries, creating inconsistent behavior. Now _export_output() is always called regardless of guardrails, so guardrail functions receive consistent TaskOutput with pydantic data on every invocation. Fixed in both sync and async execution paths. Fixes crewAIInc#4369 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TaskOutput.pydanticbeingNoneon the first guardrail call but populated on retries_export_output()was intentionally skipped when guardrails were present, causing inconsistent behavior_export_output()is always called, so guardrail functions receive consistentTaskOutputwith pydantic data on every invocation_execute_core) and async (_aexecute_core) pathsFixes #4369
Test plan
output_pydanticand a guardrail functiontask_output.pydanticis populated on the first guardrail invocationtask_output.pydanticpopulated🤖 Generated with Claude Code