[BUG] Crew planning sees only the first knowledge source of an agent
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
Línea de trabajo
The bug is in _create_tasks_summary() in lib/crewai/src/crewai/utilities/planning_handler.py, where only knowledge_list[0] is embedded in the planner prompt. Run the reproduction script from the issue and check whether "second fact" appears in the summary. Note that pull request #9720 is already open against this issue, so review it before starting. Done means every knowledge source appears in the summary and quotes or newlines in the text are escaped.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
CrewPlanner._create_tasks_summary() reads every knowledge source from an agent, then embeds only the first one in the planner prompt:
lib/crewai/src/crewai/utilities/planning_handler.py:140-163
def _create_tasks_summary(self) -> str:
tasks_summary = []
for idx, task in enumerate(self.tasks):
knowledge_list = self._get_agent_knowledge(task)
agent_tools = (
f"[{', '.join(str(tool) for tool in task.agent.tools)}]"
if task.agent and task.agent.tools
else '"agent has no tools"',
f',\n "agent_knowledge": "[\\"{knowledge_list[0]}\\"]"'
if knowledge_list and str(knowledge_list) != "None"
else "",
)
task_summary = f"""
...
"agent_tools": {"".join(agent_tools)}"""
knowledge_list[0] is the only source that reaches the planner. When an agent has two or more knowledge_sources, the rest are dropped without a warning, so the plan is made without context the executor will actually have.
The value is also interpolated unescaped. A source containing a double quote or a newline breaks the "agent_knowledge" value that the surrounding prompt presents as JSON.
Steps to Reproduce
from crewai import Agent, Task
from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource
from crewai.utilities.planning_handler import CrewPlanner
agent = Agent(
role="Researcher",
goal="Research",
backstory="Backstory",
knowledge_sources=[
StringKnowledgeSource(content="first fact"),
StringKnowledgeSource(content="second fact"),
],
)
task = Task(
description="Explain the topic",
expected_output="An explanation",
agent=agent,
)
summary = CrewPlanner([task], None)._create_tasks_summary()
print("second fact" in summary)
Output on current main:
False
Expected Behavior
Both sources are present in the summary, and their text is escaped so quotes and newlines cannot corrupt it, for example:
"agent_knowledge": ["first fact", "second fact"]
AI assistance
I used an AI coding agent to investigate, reproduce, and prepare this report, and reviewed its results. Per CONTRIBUTING.md, please apply the llm-generated label; external contributors cannot add it with my current permissions.
- Lenguaje dominante
- Python
- Estrellas
- 61.2k
- Forks
- 9.2k
- Merge medio
- 1 d 14 h
- PR fusionados (30 d)
- 180
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de crewAIInc/crewAI
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM providerPosiblemente ocupada @HashimSyedUBC la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missingPosiblemente ocupada @basil-k-aji-dev la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
[BUG] Native Azure provider ignores the seed settingPosiblemente ocupada @basil-k-aji-dev la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
crewAIInc/crewAI#9787 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summaryPosiblemente ocupada @basil-k-aji-dev la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
Todos los issues de crewAIInc/crewAI
Issues similares
-
bug harness
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
mruangutai/harness#2687 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
modal-labs/modal-client#4158 ·
-
good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 Medio día Aptitud para principiantes 72/100
The-Swarm-Corporation/swarms-rs#168 ·
Los mantenedores suelen responder en 1 día
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
linuxserver/docker-healthchecks#137 · 1 comentario ·