Skip to content

fix(agent): expose human input flag on executor#6070

Closed
fengjikui wants to merge 1 commit into
crewAIInc:mainfrom
fengjikui:fix-human-input-executor-state
Closed

fix(agent): expose human input flag on executor#6070
fengjikui wants to merge 1 commit into
crewAIInc:mainfrom
fengjikui:fix-human-input-executor-state

Conversation

@fengjikui

@fengjikui fengjikui commented Jun 8, 2026

Copy link
Copy Markdown

Summary

  • add an AgentExecutor.ask_for_human_input property that delegates to AgentExecutorState
  • keep the experimental executor compatible with ExecutorContext, whose human-input provider reads and writes the flag directly
  • add regression coverage for direct state delegation and the sync human-input provider mutation path

Fixes #6065.

Testing

  • uv run --package crewai --dev python -m pytest lib/crewai/tests/agents/test_agent_executor.py::TestAgentExecutor::test_ask_for_human_input_delegates_to_state lib/crewai/tests/agents/test_agent_executor.py::TestAgentExecutor::test_human_input_provider_can_update_executor_state_flag -q
  • uv run --package crewai --dev ruff check lib/crewai/src/crewai/experimental/agent_executor.py lib/crewai/tests/agents/test_agent_executor.py
  • git diff --check

I also ran the full lib/crewai/tests/agents/test_agent_executor.py file locally; it reached 76 passed, 13 failed. The failures were environment/extra dependency issues unrelated to this patch: local SOCKS proxy support missing socksio, missing crewai[anthropic], and missing crewai_tools.

This PR is AI-assisted and labeled llm-generated per the contribution guide.

Summary by CodeRabbit

  • New Features

    • Agent executor now provides a configurable option to request human feedback during agent execution, allowing dynamic control over human input prompts.
  • Tests

    • Added comprehensive test coverage for human input functionality, validating that feedback requests can be toggled and that feedback processing correctly updates executor state.

@fengjikui

Copy link
Copy Markdown
Author

I do not have permission to apply repository labels from this fork, but this PR is AI-assisted and should carry the required llm-generated label per the contribution guide.

@fengjikui

Copy link
Copy Markdown
Author

Closing this duplicate in favor of #6069, which contains the same fix with stronger validation and already has the CodeRabbit review completed.

@fengjikui fengjikui closed this Jun 8, 2026
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 414781e1-a7bf-4efc-855d-783ab2a7ef0d

📥 Commits

Reviewing files that changed from the base of the PR and between 913a3ab and 52f2faf.

📒 Files selected for processing (2)
  • lib/crewai/src/crewai/experimental/agent_executor.py
  • lib/crewai/tests/agents/test_agent_executor.py

📝 Walkthrough

Walkthrough

AgentExecutor adds a public ask_for_human_input property with getter and setter that delegate to self._state.ask_for_human_input, enabling it to satisfy the ExecutorContext protocol. Test coverage validates property access and integration with SyncHumanInputProvider feedback handling.

Changes

Human Feedback Property on AgentExecutor

Layer / File(s) Summary
ask_for_human_input property
lib/crewai/src/crewai/experimental/agent_executor.py
AgentExecutor exposes ask_for_human_input as a public property with getter and setter that proxy to self._state.ask_for_human_input, satisfying the ExecutorContext protocol requirement.
Human input property tests
lib/crewai/tests/agents/test_agent_executor.py
Added two test cases with required import: (1) property delegates to underlying state, (2) SyncHumanInputProvider can mutate executor state by clearing the flag after feedback processing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A whisper through the executor's door,
Human voices calling out once more,
A property flows, from state to sight,
Feedback loops now glowing bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix(agent): expose human input flag on executor' clearly and specifically describes the main change: exposing the ask_for_human_input property on AgentExecutor.
Linked Issues check ✅ Passed The changes fully address issue #6065 by adding the ask_for_human_input property getter/setter to AgentExecutor, satisfying ExecutorContext protocol requirements and enabling human-input handling.
Out of Scope Changes check ✅ Passed All changes are in scope: the property addition to AgentExecutor and test coverage for the new property and SyncHumanInputProvider interaction are directly related to fixing the issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{"name":"HttpError","status":500,"request":{"method":"PATCH","url":"https://api.github.com/repos/crewAIInc/crewAI/issues/comments/4647177657","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/0.0.0-development octokit-core.js/7.0.6 Node.js/24","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8"},"body":{"body":"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- review_stack_entry_start -->\n\n[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/crewAIInc/crewAI/pull/6070?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)\n\n<!-- review_stack_entry_end -->\n<!-- This is an auto-generated comment: review in progress by coderabbit.ai -->\n\n> [!NOTE]\n> Currently processing new changes in this PR. This may take a few minutes, please wait...\n> \n> <details>\n> <summary>⚙️ Run configuration</summary>\n> \n> **Configuration used**: Organization UI\n> \n> **Review profile**: CHILL\n> \n> **Plan**: Pro Plus\n> \n> **Run ID**: `414781e1-a7bf-4efc-855d-783ab2a7ef0d`\n> \n> </details>\n> \n> <details>\n> <summary>📥 Commits</summary>\n> \n> Reviewing files that changed from the base of the PR and between 913a3abeadb0491eb09f98af2f36082b67747b68 and 52f2faf5aa23ff66e900c989ab2f7343cf092f99.\n> \n> </details>\n> \n> <details>\n> <summary>📒 Files selected for processing (2)</summary>\n> \n> * `lib/crewai/src/crewai/experimental/agent_executor.py`\n> * `lib/crewai/tests/agents/test_agent_executor.py`\n> \n> </details>\n> \n> ```ascii\n>  ________________________________________________\n> < If this were a race, you'd still be importing. >\n>  ------------------------------------------------\n>   \\\n>    \\   (\\__/)\n>        (•ㅅ•)\n>        /   づ\n> ```\n\n<!-- end of auto-generated comment: review in progress by coderabbit.ai -->\n\n<!-- finishing_touch_checkbox_start -->\n\n<details>\n<summary>✨ Finishing Touches</summary>\n\n<details>\n<summary>🧪 Generate unit tests (beta)</summary>\n\n- [ ] <!-- {\"checkboxId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Create PR with unit tests\n\n</details>\n\n</details>\n\n<!-- finishing_touch_checkbox_end -->\n<!-- tips_start -->\n\n---\n\nThanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=crewAIInc/crewAI&utm_content=6070)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.\n\n<details>\n<summary>❤️ Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n\n<sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub>\n\n<!-- tips_end -->"},"request":{"retryCount":3,"signal":{},"retries":3,"retryAfter":16}}}

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.

[BUG] human_input=True on Task raises AttributeError: 'AgentExecutor' object has no attribute 'ask_for_human_input' with default experimental executor

1 participant