Use this file to discover all available pages before exploring further.
Docling is available in Crew AI as the CrewDoclingSource knowledge source, enabling multi-agent AI systems to access and process document content with high fidelity.
Here’s how to use Docling as a knowledge source in Crew AI:
from crewai import Agent, Task, Crewfrom crewai.knowledge.source.crew_docling_source import CrewDoclingSource# Create a Docling knowledge sourceknowledge_source = CrewDoclingSource( file_paths=["document.pdf"])# Create an agent with the knowledge sourceagent = Agent( role="Research Analyst", goal="Analyze documents and extract key insights", backstory="You are an expert at analyzing complex documents.", knowledge_sources=[knowledge_source])# Create a tasktask = Task( description="Summarize the main findings from the document", agent=agent, expected_output="A concise summary of key findings")# Create and run the crewcrew = Crew( agents=[agent], tasks=[task])result = crew.kickoff()print(result)
from crewai import Agent, Task, Crewfrom crewai.knowledge.source.crew_docling_source import CrewDoclingSource# Create knowledge sourceknowledge_source = CrewDoclingSource( file_paths=["report.pdf", "analysis.docx"])# Create specialized agentsresearcher = Agent( role="Document Researcher", goal="Extract and organize information from documents", backstory="Expert at finding relevant information in complex documents", knowledge_sources=[knowledge_source])analyst = Agent( role="Data Analyst", goal="Analyze extracted data and identify patterns", backstory="Specialist in data analysis and pattern recognition", knowledge_sources=[knowledge_source])writer = Agent( role="Technical Writer", goal="Create comprehensive reports based on analysis", backstory="Skilled at synthesizing complex information into clear reports")# Define tasksresearch_task = Task( description="Extract all key data points and findings from the documents", agent=researcher, expected_output="Structured list of key findings and data")analysis_task = Task( description="Analyze the extracted data for trends and insights", agent=analyst, expected_output="Analysis report with identified trends", context=[research_task])writing_task = Task( description="Write a comprehensive report combining research and analysis", agent=writer, expected_output="Final comprehensive report", context=[research_task, analysis_task])# Create and run crewcrew = Crew( agents=[researcher, analyst, writer], tasks=[research_task, analysis_task, writing_task], verbose=True)result = crew.kickoff()
from crewai.knowledge.source.crew_docling_source import CrewDoclingSource# Process various document formatsknowledge_source = CrewDoclingSource( file_paths=[ "financial_report.pdf", "presentation.pptx", "analysis.docx", "data.html" ])agent = Agent( role="Document Analyzer", goal="Analyze documents across different formats", backstory="Expert at processing various document types", knowledge_sources=[knowledge_source])
# Research agent that analyzes academic papersknowledge_source = CrewDoclingSource( file_paths=["paper1.pdf", "paper2.pdf", "paper3.pdf"])research_agent = Agent( role="Academic Researcher", goal="Analyze research papers and identify key contributions", backstory="PhD-level researcher with expertise in literature review", knowledge_sources=[knowledge_source])task = Task( description="Compare methodologies across the three papers", agent=research_agent, expected_output="Comparative analysis of methodologies")