[BUG] Flow.input_history is referenced by two docstrings but does not exist
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 60.6k
- Fork
- 9.1k
- Merge medio
- 1g 4h
- PR unite (30g)
- 214
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di crewAIInc/crewAI
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Feature request: GoldenDirectiveTool (harmonic relationship score, full vs cropped reporting)Apertafeature-request
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
crewAIInc/crewAI#9200 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[FEATURE] Docs: ApifyActorsTool example with a typed-input ActorForse già presa @johnisanerd l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
crewAIInc/crewAI#9132 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Scrape tools reject the documented cookies mapping and drop cookies when the URL is passed at runtimeForse già presa @Luckyou-d l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] OpenAI-compatible embedding model alias breaks embedder constructionForse già presa @gokay-ai l’ha presa 12 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
crewAIInc/crewAI#8761 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di crewAIInc/crewAI
Issue simili
-
area: providers/aws priority: p2 size: S type: bug type: testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
finos/open-resource-broker#851 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
sandialabs/atlas-ui-3#1196 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
ShaftHQ/SHAFT_ENGINE#7902 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: GraphML export writes invalid XML when a value contains a control character (e.g. form feed)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
topoteretes/cognee#6646 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
DOI-USGS/pywatershed#428 ·