Description
When a Crew is constructed with explicit knowledge_sources, knowledge initialization can fail (for example missing OPENAI_API_KEY for the default Chroma OpenAI embedder). The failure is logged, but create_crew_knowledge catches the exception and the crew continues as if knowledge were configured.
Result: kickoff “succeeds” with empty knowledge, and agents answer without retrieval. Easy to miss in non-verbose runs.
Also: ChromaDBConfig._default_embedding_function docstring says the default is all-MiniLM-L6-v2 via ONNX, but the implementation uses OpenAIEmbeddingFunction / text-embedding-3-small (docs elsewhere correctly say OpenAI is the default).
Steps to Reproduce
from crewai import Agent, Crew, Task, Process
from crewai.knowledge.source.string_knowledge_source import StringKnowledgeSource
from crewai.llms.base_llm import BaseLLM
class StubLLM(BaseLLM):
def call(self, messages, tools=None, callbacks=None, available_functions=None,
from_task=None, from_agent=None, response_model=None):
return "Thought: ok.\nFinal Answer: invented answer without retrieval."
def supports_function_calling(self) -> bool:
return False
# Ensure OPENAI_API_KEY is unset
knowledge = StringKnowledgeSource(content="Secret fact: the vault code is 42.")
agent = Agent(role="r", goal="g", backstory="b", llm=StubLLM(model="stub"), verbose=False)
task = Task(description="What is the vault code?", expected_output="the code", agent=agent)
crew = Crew(
agents=[agent],
tasks=[task],
knowledge_sources=[knowledge],
process=Process.sequential,
verbose=False,
)
result = crew.kickoff()
print(result) # completes; knowledge never loaded
Expected behavior
If the user explicitly provided knowledge_sources and initialization/upsert fails, Crew construction or kickoff should fail loudly (raise) so the misconfiguration is obvious. Optionally fix the misleading ONNX docstring on _default_embedding_function.
Actual behavior
Errors like Failed to upsert documents: The OPENAI_API_KEY environment variable is not set. are logged, then create_crew_knowledge swallows the exception and the crew runs without knowledge.
Operating System
macOS
Python Version
3.13
crewAI Version
1.15.21 / current main
Willingness to Contribute
Yes — I can open a PR that re-raises on explicit knowledge_sources init failure + corrects the Chroma default-embedder docstring, with a regression test.
Description
When a
Crewis constructed with explicitknowledge_sources, knowledge initialization can fail (for example missingOPENAI_API_KEYfor the default Chroma OpenAI embedder). The failure is logged, butcreate_crew_knowledgecatches the exception and the crew continues as if knowledge were configured.Result: kickoff “succeeds” with empty knowledge, and agents answer without retrieval. Easy to miss in non-verbose runs.
Also:
ChromaDBConfig._default_embedding_functiondocstring says the default isall-MiniLM-L6-v2via ONNX, but the implementation usesOpenAIEmbeddingFunction/text-embedding-3-small(docs elsewhere correctly say OpenAI is the default).Steps to Reproduce
Expected behavior
If the user explicitly provided
knowledge_sourcesand initialization/upsert fails, Crew construction or kickoff should fail loudly (raise) so the misconfiguration is obvious. Optionally fix the misleading ONNX docstring on_default_embedding_function.Actual behavior
Errors like
Failed to upsert documents: The OPENAI_API_KEY environment variable is not set.are logged, thencreate_crew_knowledgeswallows the exception and the crew runs without knowledge.Operating System
macOS
Python Version
3.13
crewAI Version
1.15.21 / current
mainWillingness to Contribute
Yes — I can open a PR that re-raises on explicit
knowledge_sourcesinit failure + corrects the Chroma default-embedder docstring, with a regression test.