[BUG] Flow.input_history is referenced by two docstrings but does not exist
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Start in crewai/flow/runtime/__init__.py, where the issue says _input_history is defined, and read the references in crewai/flow/conversation.py and crewai/flow/input_provider.py. Check the existing flow tests for history behavior, then verify that callers can inspect the prompt, response, and metadata through the documented API. A linked open pull request (#9218) is already addressing this issue.
索引モデルが issue の本文から書いたものです。
説明
Flow.input_history is referenced by two module docstrings but does not exist
What
crewai/flow/conversation.py:232 documents its input as "Convert Flow.input_history entries to LLM message format", and crewai/flow/input_provider.py:68 explains that "The response metadata is stored in _input_history". But Flow exposes no public input_history; the history exists only as a private pydantic attribute.
On crewai==1.15.37, installed from this repository's lib/crewai:
>>> from crewai.flow import Flow
>>> hasattr(Flow, "input_history")
False
>>> "_input_history" in Flow.__private_attributes__
True
So the only way to read what Flow.ask() asked and what came back — the request message, the response, the request metadata and the provider's InputResponse.metadata — is the private attribute.
Why it matters
This is the accessor that makes InputProvider/InputResponse usable: without it, a custom provider can carry response metadata but nothing documented can read it back. It also blocks the docs task in #8071, whose acceptance criteria say "show how to inspect response metadata using the existing flow.input_history API" — that criterion cannot be satisfied today.
Reproduction (scripted provider, no console, no LLM):
from crewai.flow import Flow, start
from crewai.flow.input_provider import InputResponse
class ScriptedProvider:
def request_input(self, message, flow, metadata=None):
return InputResponse(text="vector databases", metadata={"answered_by": "script"})
class ResearchFlow(Flow):
input_provider = ScriptedProvider()
@start()
def gather(self):
return self.ask("What should we research?", metadata={"channel": "#research"})
flow = ResearchFlow()
print(flow.kickoff()) # vector databases
print(flow._input_history) # the metadata only exists here
print(hasattr(flow, "input_history")) # False
Suggested fix (small, no behaviour change)
@property
def input_history(self) -> list[InputHistoryEntry]:
"""Return the ``Flow.ask()`` requests this flow has served.
Each entry carries the prompt, the response (``None`` when the provider had
nothing to give), the method that asked, the timestamp, the request metadata and
the provider's ``InputResponse.metadata``.
Returns:
list[InputHistoryEntry]: A copy, so callers cannot mutate the flow's history.
"""
return list(self._input_history)
InputHistoryEntry is already imported at the top of crewai/flow/runtime/__init__.py (line 128) for the private attribute's annotation, so this needs no new imports. Returning a copy keeps the existing append-only contract.
Note
I raised this in #8071 before writing the guide section, because the example the issue asks for would otherwise have to teach the private attribute. Happy to send the property + a unit test as the PR for this issue if you want it; the docs example then follows in #8071.
- 主要言語
- Python
- スター
- 60.6k
- フォーク
- 9.1k
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 214
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crewAIInc/crewAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
feature-request
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
crewAIInc/crewAI#9200 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
crewAIInc/crewAI#9132 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] Scrape tools reject the documented cookies mapping and drop cookies when the URL is passed at runtime対応中かも @Luckyou-d が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[BUG] OpenAI-compatible embedding model alias breaks embedder construction対応中かも @gokay-ai が 11 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
crewAIInc/crewAI#8761 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
crewAIInc/crewAI の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
bigbio/sdrf-pipelines#372 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
521xueweihan/HelloGitHub#4297 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
aws-samples/sample-per-model-bedrock#822 ·
メンテナーはふだん 1 日以内に返信
-
area:study-data p2-high ready-for-agent type:chore
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
fderuiter/deruiter.dev#3706 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
awslabs/visual-asset-management-system#1234 ·
メンテナーはふだん 1 日以内に返信