├── .cache └── plugin │ └── social │ ├── 0b649b356e60b558dfaafe8bb095862e.png │ ├── 0cce129b2747506603c430fd3fe2b3d6.png │ ├── 0f18d6e26b8551d3f42ef92b0f786024.png │ ├── 14c48b40955d6021b47ae973d9aef723.png │ ├── 17484ad7f45b09a1db146ba3ad3df79a.png │ ├── 1d935acb34360e4768e35ae13479bbf9.png │ ├── 216220c022e734cc7999210b48c9fb59.png │ ├── 246dcba6c47283feac354f5871842fe8.png │ ├── 259ba94ac7e93bd9f968c57ec4a15fe5.png │ ├── 288fd82ce2209be4864d19bd50b21474.png │ ├── 28a844df4871a1cdfcba05fdc87bb3e8.png │ ├── 40770a96ef2fb657a7aa16a9facf702f.png │ ├── 4747e68a5e5c0f0994cdc5b37682a37c.png │ ├── 4809f4ae19b6e78539b900da82d8a1f6.png │ ├── 481b171eb3fe3dec67ca86d2d923f598.png │ ├── 4ae47a8f7da894db700b2f29242cd0c5.png │ ├── 4c1fb3bfd02d6b1317779fe5101058a7.png │ ├── 56e240bc0124af182495bc59877d8d11.png │ ├── 5d2431971fcde0af2c84e4680a4227a7.png │ ├── 69bcd9a2304ea69e1244a7ac510dd98d.png │ ├── 6b49f5ef597c15cabc3df9bac4fbcf44.png │ ├── 7296e2d6c7b2c713ed7b2e4546e3acdb.png │ ├── 805d7c5662a45ca18b52554eecbc34af.png │ ├── 80f1492950494de7a34a1f20f6dd4368.png │ ├── 834ad7f8096fa4c92637b815777bf2bd.png │ ├── 8b089bdf12d22c016f481d654be39eb1.png │ ├── 96f1c198bf51f822eb04a25adf7ca20c.png │ ├── 9f88e9bd3010b149e527e0600c2e438c.png │ ├── Roboto-Black.ttf │ ├── Roboto-BlackItalic.ttf │ ├── Roboto-Bold.ttf │ ├── Roboto-BoldItalic.ttf │ ├── Roboto-Italic.ttf │ ├── Roboto-Light.ttf │ ├── Roboto-LightItalic.ttf │ ├── Roboto-Medium.ttf │ ├── Roboto-MediumItalic.ttf │ ├── Roboto-Regular.ttf │ ├── Roboto-Thin.ttf │ ├── Roboto-ThinItalic.ttf │ ├── a0c21e9a7250afebc533da92c7050bed.png │ ├── a19c79f0bc7a3e5ffc6b511a68273e5d.png │ ├── a1d83c5e1feb928b579ad122a8d3786d.png │ ├── a3d8476a7b5c6630a5f91aed8c210173.png │ ├── ac9c4b6558565d4c349355101e95c74a.png │ ├── b417e4353162a563e70f1350a2777e2c.png │ ├── b84a1e5d0534be3c31f04a7d4a98b515.png │ ├── bca675d7c3c82f52ebd329487fb9ade1.png │ ├── bdf46ef3b5230ebb45ef648933f54fa2.png │ ├── beacb748aad822c66a972b39186dbef1.png │ ├── caa7abb72303dbe5a02ec11e6f1eba6b.png │ ├── cff5eb5aae0959e143c12945428558bc.png │ ├── d01b95e8266a0d2c5f825b88d98a97a1.png │ ├── d7db21df76b132d3ca3ae4313e23f77d.png │ ├── d87db72302152f8c0953d7105c28a206.png │ ├── e580fe32a1d3f15fc89057d053ae3e52.png │ ├── e9111c93e01f7c1dfec7bbab69843076.png │ ├── ebf70df39c2bfd2c4a89d70846a516ff.png │ ├── ed5690e7952bdee0372c8d3f1f5d98d7.png │ ├── f6d08b81ae945faa6c4a436de48d2da6.png │ ├── f875c8d6b0cd71d9ae38300c82361d77.png │ └── fc9a9f44881519178d4000f24000ef9d.png ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml ├── security.md └── workflows │ ├── linter.yml │ ├── mkdocs.yml │ ├── notify-downstream.yml │ ├── security-checker.yml │ ├── stale.yml │ ├── tests.yml │ └── type-checker.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .ruff.toml ├── LICENSE ├── README.md ├── crewAI.excalidraw ├── docs ├── api-reference │ └── introduction.mdx ├── changelog.mdx ├── common-room-tracking.js ├── concepts │ ├── agents.mdx │ ├── cli.mdx │ ├── collaboration.mdx │ ├── crews.mdx │ ├── event-listener.mdx │ ├── flows.mdx │ ├── knowledge.mdx │ ├── llms.mdx │ ├── memory.mdx │ ├── planning.mdx │ ├── processes.mdx │ ├── reasoning.mdx │ ├── tasks.mdx │ ├── testing.mdx │ ├── tools.mdx │ └── training.mdx ├── docs.json ├── enterprise-api.yaml ├── enterprise │ ├── features │ │ ├── hallucination-guardrail.mdx │ │ ├── tool-repository.mdx │ │ ├── traces.mdx │ │ └── webhook-streaming.mdx │ ├── guides │ │ ├── azure-openai-setup.mdx │ │ ├── build-crew.mdx │ │ ├── deploy-crew.mdx │ │ ├── enable-crew-studio.mdx │ │ ├── hubspot-trigger.mdx │ │ ├── human-in-the-loop.mdx │ │ ├── kickoff-crew.mdx │ │ ├── react-component-export.mdx │ │ ├── salesforce-trigger.mdx │ │ ├── slack-trigger.mdx │ │ ├── team-management.mdx │ │ ├── update-crew.mdx │ │ ├── webhook-automation.mdx │ │ └── zapier-trigger.mdx │ ├── introduction.mdx │ └── resources │ │ └── frequently-asked-questions.mdx ├── examples │ └── example.mdx ├── guides │ ├── advanced │ │ ├── customizing-prompts.mdx │ │ └── fingerprinting.mdx │ ├── agents │ │ └── crafting-effective-agents.mdx │ ├── concepts │ │ └── evaluating-use-cases.mdx │ ├── crews │ │ └── first-crew.mdx │ └── flows │ │ ├── first-flow.mdx │ │ └── mastering-flow-state.mdx ├── images │ ├── agentops-overview.png │ ├── agentops-replay.png │ ├── agentops-session.png │ ├── asset.png │ ├── complexity_precision.png │ ├── crewAI-mindmap.png │ ├── crew_only_logo.png │ ├── crewai-flow-1.png │ ├── crewai-flow-2.png │ ├── crewai-flow-3.png │ ├── crewai-flow-4.png │ ├── crewai-flow-5.png │ ├── crewai-flow-6.png │ ├── crewai-flow-7.png │ ├── crewai-flow-8.png │ ├── crewai-run-poetry-error.png │ ├── crewai-update.png │ ├── crewai_logo.png │ ├── crews.png │ ├── enterprise │ │ ├── activepieces-body.png │ │ ├── activepieces-email.png │ │ ├── activepieces-flow.png │ │ ├── activepieces-headers.png │ │ ├── activepieces-trigger.png │ │ ├── activepieces-webhook.png │ │ ├── add-role-modal.png │ │ ├── assign-role.png │ │ ├── azure-openai-studio.png │ │ ├── bearer-token.png │ │ ├── connect-github.png │ │ ├── connection-added.png │ │ ├── copy-task-id.png │ │ ├── crew-dashboard.png │ │ ├── crew-human-input.png │ │ ├── crew-resume-endpoint.png │ │ ├── crew-secrets.png │ │ ├── crew-studio-interface.png │ │ ├── crew-webhook-url.png │ │ ├── crewai-custom-gpt-1.png │ │ ├── crewai-custom-gpt-2.png │ │ ├── crewai-enterprise-dashboard.png │ │ ├── customise-react-component-2.png │ │ ├── customise-react-component.png │ │ ├── dall-e-image.png │ │ ├── deploy-progress.png │ │ ├── env-vars-button.png │ │ ├── export-react-component.png │ │ ├── failure.png │ │ ├── final-output.png │ │ ├── get-status.png │ │ ├── hubspot-workflow-1.png │ │ ├── hubspot-workflow-2.png │ │ ├── hubspot-workflow-3.png │ │ ├── kickoff-endpoint.png │ │ ├── kickoff-interface.png │ │ ├── kickoff-slack-crew-dropdown.png │ │ ├── kickoff-slack-crew-kickoff.png │ │ ├── kickoff-slack-crew-results.png │ │ ├── kickoff-slack-crew.png │ │ ├── llm-connection-config.png │ │ ├── llm-defaults.png │ │ ├── mcp-enterprise-download.png │ │ ├── member-accepted-invitation.png │ │ ├── members-tab.png │ │ ├── redeploy-button.png │ │ ├── reset-token.png │ │ ├── roles-tab.png │ │ ├── run-crew.png │ │ ├── select-repo.png │ │ ├── set-env-variables.png │ │ ├── settings-page.png │ │ ├── sfdcdemo-vini.mov │ │ ├── slack-integration.png │ │ ├── trace-detailed-task.png │ │ ├── trace-summary.png │ │ ├── trace-tasks.png │ │ ├── trace-timeline.png │ │ ├── traces-overview.png │ │ ├── update-env-vars.png │ │ ├── zapier-1.png │ │ ├── zapier-2.png │ │ ├── zapier-3.png │ │ ├── zapier-4.png │ │ ├── zapier-5.png │ │ ├── zapier-6.png │ │ ├── zapier-7.png │ │ ├── zapier-7b.png │ │ ├── zapier-8.png │ │ └── zapier-9.png │ ├── favicon.svg │ ├── flows.png │ ├── langtrace1.png │ ├── langtrace2.png │ ├── langtrace3.png │ ├── mlflow-tracing.gif │ ├── mlflow1.png │ ├── openlit1.png │ ├── openlit2.png │ ├── openlit3.png │ ├── opik-crewai-dashboard.png │ ├── releases │ │ ├── v01000.png │ │ ├── v01020.png │ │ ├── v01050.png │ │ ├── v01080.png │ │ ├── v01140.png │ │ ├── v01170.png │ │ ├── v01171.png │ │ ├── v01180.png │ │ ├── v01190.png │ │ ├── v01200.png │ │ ├── v01201.png │ │ ├── v01210.png │ │ ├── v0850.png │ │ ├── v0860.png │ │ ├── v0950.png │ │ └── v0980.png │ ├── weave-tracing.gif │ └── weave-tracing.png ├── installation.mdx ├── introduction.mdx ├── learn │ ├── before-and-after-kickoff-hooks.mdx │ ├── bring-your-own-agent.mdx │ ├── coding-agents.mdx │ ├── conditional-tasks.mdx │ ├── create-custom-tools.mdx │ ├── custom-llm.mdx │ ├── custom-manager-agent.mdx │ ├── customizing-agents.mdx │ ├── dalle-image-generation.mdx │ ├── force-tool-output-as-result.mdx │ ├── hierarchical-process.mdx │ ├── human-in-the-loop.mdx │ ├── human-input-on-execution.mdx │ ├── kickoff-async.mdx │ ├── kickoff-for-each.mdx │ ├── llm-connections.mdx │ ├── multimodal-agents.mdx │ ├── overview.mdx │ ├── replay-tasks-from-latest-crew-kickoff.mdx │ ├── sequential-process.mdx │ └── using-annotations.mdx ├── mcp │ ├── multiple-servers.mdx │ ├── overview.mdx │ ├── security.mdx │ ├── sse.mdx │ ├── stdio.mdx │ └── streamable-http.mdx ├── observability │ ├── agentops.mdx │ ├── arize-phoenix.mdx │ ├── langfuse.mdx │ ├── langtrace.mdx │ ├── mlflow.mdx │ ├── openlit.mdx │ ├── opik.mdx │ ├── overview.mdx │ ├── patronus-evaluation.mdx │ ├── portkey.mdx │ └── weave.mdx ├── quickstart.mdx ├── snippets │ └── snippet-intro.mdx ├── telemetry.mdx └── tools │ ├── ai-ml │ ├── aimindtool.mdx │ ├── codeinterpretertool.mdx │ ├── dalletool.mdx │ ├── langchaintool.mdx │ ├── llamaindextool.mdx │ ├── overview.mdx │ ├── ragtool.mdx │ └── visiontool.mdx │ ├── automation │ ├── apifyactorstool.mdx │ ├── composiotool.mdx │ ├── multiontool.mdx │ └── overview.mdx │ ├── cloud-storage │ ├── bedrockinvokeagenttool.mdx │ ├── bedrockkbretriever.mdx │ ├── overview.mdx │ ├── s3readertool.mdx │ └── s3writertool.mdx │ ├── database-data │ ├── mysqltool.mdx │ ├── nl2sqltool.mdx │ ├── overview.mdx │ ├── pgsearchtool.mdx │ ├── qdrantvectorsearchtool.mdx │ ├── snowflakesearchtool.mdx │ └── weaviatevectorsearchtool.mdx │ ├── file-document │ ├── csvsearchtool.mdx │ ├── directoryreadtool.mdx │ ├── directorysearchtool.mdx │ ├── docxsearchtool.mdx │ ├── filereadtool.mdx │ ├── filewritetool.mdx │ ├── jsonsearchtool.mdx │ ├── mdxsearchtool.mdx │ ├── overview.mdx │ ├── pdfsearchtool.mdx │ ├── txtsearchtool.mdx │ └── xmlsearchtool.mdx │ ├── overview.mdx │ ├── search-research │ ├── bravesearchtool.mdx │ ├── codedocssearchtool.mdx │ ├── exasearchtool.mdx │ ├── githubsearchtool.mdx │ ├── linkupsearchtool.mdx │ ├── overview.mdx │ ├── serperdevtool.mdx │ ├── websitesearchtool.mdx │ ├── youtubechannelsearchtool.mdx │ └── youtubevideosearchtool.mdx │ └── web-scraping │ ├── browserbaseloadtool.mdx │ ├── firecrawlcrawlwebsitetool.mdx │ ├── firecrawlscrapewebsitetool.mdx │ ├── firecrawlsearchtool.mdx │ ├── hyperbrowserloadtool.mdx │ ├── overview.mdx │ ├── scrapeelementfromwebsitetool.mdx │ ├── scrapegraphscrapetool.mdx │ ├── scrapewebsitetool.mdx │ ├── scrapflyscrapetool.mdx │ ├── seleniumscrapingtool.mdx │ ├── spidertool.mdx │ └── stagehandtool.mdx ├── mkdocs.yml ├── pyproject.toml ├── src └── crewai │ ├── __init__.py │ ├── agent.py │ ├── agents │ ├── __init__.py │ ├── agent_adapters │ │ ├── __init__.py │ │ ├── base_agent_adapter.py │ │ ├── base_converter_adapter.py │ │ ├── base_tool_adapter.py │ │ ├── langgraph │ │ │ ├── __init__.py │ │ │ ├── langgraph_adapter.py │ │ │ ├── langgraph_tool_adapter.py │ │ │ └── structured_output_converter.py │ │ └── openai_agents │ │ │ ├── __init__.py │ │ │ ├── openai_adapter.py │ │ │ ├── openai_agent_tool_adapter.py │ │ │ └── structured_output_converter.py │ ├── agent_builder │ │ ├── __init__.py │ │ ├── base_agent.py │ │ ├── base_agent_executor_mixin.py │ │ └── utilities │ │ │ ├── __init__.py │ │ │ ├── base_output_converter.py │ │ │ └── base_token_process.py │ ├── cache │ │ ├── __init__.py │ │ └── cache_handler.py │ ├── crew_agent_executor.py │ ├── parser.py │ └── tools_handler.py │ ├── cli │ ├── __init__.py │ ├── add_crew_to_flow.py │ ├── authentication │ │ ├── __init__.py │ │ ├── constants.py │ │ ├── main.py │ │ ├── token.py │ │ └── utils.py │ ├── cli.py │ ├── command.py │ ├── config.py │ ├── constants.py │ ├── create_crew.py │ ├── create_flow.py │ ├── crew_chat.py │ ├── deploy │ │ ├── __init__.py │ │ └── main.py │ ├── evaluate_crew.py │ ├── git.py │ ├── install_crew.py │ ├── kickoff_flow.py │ ├── plot_flow.py │ ├── plus_api.py │ ├── provider.py │ ├── replay_from_task.py │ ├── reset_memories_command.py │ ├── run_crew.py │ ├── templates │ │ ├── __init__.py │ │ ├── crew │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── config │ │ │ │ ├── agents.yaml │ │ │ │ └── tasks.yaml │ │ │ ├── crew.py │ │ │ ├── knowledge │ │ │ │ └── user_preference.txt │ │ │ ├── main.py │ │ │ ├── pyproject.toml │ │ │ └── tools │ │ │ │ ├── __init__.py │ │ │ │ └── custom_tool.py │ │ ├── flow │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── __init__.py │ │ │ ├── crews │ │ │ │ └── poem_crew │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── config │ │ │ │ │ ├── agents.yaml │ │ │ │ │ └── tasks.yaml │ │ │ │ │ └── poem_crew.py │ │ │ ├── main.py │ │ │ ├── pyproject.toml │ │ │ └── tools │ │ │ │ ├── __init__.py │ │ │ │ └── custom_tool.py │ │ └── tool │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ ├── pyproject.toml │ │ │ └── src │ │ │ └── {{folder_name}} │ │ │ ├── __init__.py │ │ │ └── tool.py │ ├── tools │ │ ├── __init__.py │ │ └── main.py │ ├── train_crew.py │ ├── update_crew.py │ ├── utils.py │ └── version.py │ ├── crew.py │ ├── crews │ ├── __init__.py │ └── crew_output.py │ ├── flow │ ├── __init__.py │ ├── assets │ │ ├── crewai_flow_visual_template.html │ │ └── crewai_logo.svg │ ├── config.py │ ├── flow.py │ ├── flow_trackable.py │ ├── flow_visualizer.py │ ├── html_template_handler.py │ ├── legend_generator.py │ ├── path_utils.py │ ├── persistence │ │ ├── __init__.py │ │ ├── base.py │ │ ├── decorators.py │ │ └── sqlite.py │ ├── utils.py │ └── visualization_utils.py │ ├── knowledge │ ├── __init__.py │ ├── embedder │ │ ├── __init__.py │ │ └── base_embedder.py │ ├── knowledge.py │ ├── knowledge_config.py │ ├── source │ │ ├── __init__.py │ │ ├── base_file_knowledge_source.py │ │ ├── base_knowledge_source.py │ │ ├── crew_docling_source.py │ │ ├── csv_knowledge_source.py │ │ ├── excel_knowledge_source.py │ │ ├── json_knowledge_source.py │ │ ├── pdf_knowledge_source.py │ │ ├── string_knowledge_source.py │ │ └── text_file_knowledge_source.py │ ├── storage │ │ ├── __init__.py │ │ ├── base_knowledge_storage.py │ │ └── knowledge_storage.py │ └── utils │ │ ├── __init__.py │ │ └── knowledge_utils.py │ ├── lite_agent.py │ ├── llm.py │ ├── llms │ ├── __init__.py │ ├── base_llm.py │ └── third_party │ │ ├── __init__.py │ │ └── ai_suite.py │ ├── memory │ ├── __init__.py │ ├── contextual │ │ ├── __init__.py │ │ └── contextual_memory.py │ ├── entity │ │ ├── __init__.py │ │ ├── entity_memory.py │ │ └── entity_memory_item.py │ ├── external │ │ ├── __init__.py │ │ ├── external_memory.py │ │ └── external_memory_item.py │ ├── long_term │ │ ├── __init__.py │ │ ├── long_term_memory.py │ │ └── long_term_memory_item.py │ ├── memory.py │ ├── short_term │ │ ├── __init__.py │ │ ├── short_term_memory.py │ │ └── short_term_memory_item.py │ ├── storage │ │ ├── __init__.py │ │ ├── base_rag_storage.py │ │ ├── interface.py │ │ ├── kickoff_task_outputs_storage.py │ │ ├── ltm_sqlite_storage.py │ │ ├── mem0_storage.py │ │ └── rag_storage.py │ └── user │ │ ├── __init__.py │ │ ├── user_memory.py │ │ └── user_memory_item.py │ ├── process.py │ ├── project │ ├── __init__.py │ ├── annotations.py │ ├── crew_base.py │ └── utils.py │ ├── security │ ├── __init__.py │ ├── fingerprint.py │ └── security_config.py │ ├── task.py │ ├── tasks │ ├── __init__.py │ ├── conditional_task.py │ ├── guardrail_result.py │ ├── hallucination_guardrail.py │ ├── llm_guardrail.py │ ├── output_format.py │ └── task_output.py │ ├── telemetry │ ├── __init__.py │ ├── constants.py │ └── telemetry.py │ ├── tools │ ├── __init__.py │ ├── agent_tools │ │ ├── __init__.py │ │ ├── add_image_tool.py │ │ ├── agent_tools.py │ │ ├── ask_question_tool.py │ │ ├── base_agent_tools.py │ │ └── delegate_work_tool.py │ ├── base_tool.py │ ├── cache_tools │ │ ├── __init__.py │ │ └── cache_tools.py │ ├── structured_tool.py │ ├── tool_calling.py │ ├── tool_types.py │ └── tool_usage.py │ ├── translations │ └── en.json │ ├── types │ ├── __init__.py │ ├── crew_chat.py │ └── usage_metrics.py │ └── utilities │ ├── __init__.py │ ├── agent_utils.py │ ├── chromadb.py │ ├── config.py │ ├── constants.py │ ├── converter.py │ ├── crew_json_encoder.py │ ├── crew_pydantic_output_parser.py │ ├── embedding_configurator.py │ ├── errors.py │ ├── evaluators │ ├── __init__.py │ ├── crew_evaluator_handler.py │ └── task_evaluator.py │ ├── events │ ├── __init__.py │ ├── agent_events.py │ ├── base_event_listener.py │ ├── base_events.py │ ├── crew_events.py │ ├── crewai_event_bus.py │ ├── event_listener.py │ ├── event_types.py │ ├── flow_events.py │ ├── knowledge_events.py │ ├── llm_events.py │ ├── llm_guardrail_events.py │ ├── reasoning_events.py │ ├── task_events.py │ ├── third_party │ │ ├── __init__.py │ │ └── agentops_listener.py │ ├── tool_usage_events.py │ └── utils │ │ ├── __init__.py │ │ └── console_formatter.py │ ├── exceptions │ ├── __init__.py │ └── context_window_exceeding_exception.py │ ├── file_handler.py │ ├── formatter.py │ ├── i18n.py │ ├── internal_instructor.py │ ├── llm_utils.py │ ├── logger.py │ ├── parser.py │ ├── paths.py │ ├── planning_handler.py │ ├── printer.py │ ├── prompts.py │ ├── pydantic_schema_parser.py │ ├── reasoning_handler.py │ ├── rpm_controller.py │ ├── serialization.py │ ├── string_utils.py │ ├── task_output_storage_handler.py │ ├── token_counter_callback.py │ ├── tool_utils.py │ └── training_handler.py ├── tests ├── __init__.py ├── agent_reasoning_test.py ├── agent_test.py ├── agents │ ├── __init__.py │ ├── agent_adapters │ │ ├── __init__.py │ │ ├── test_base_agent_adapter.py │ │ └── test_base_tool_adapter.py │ ├── agent_builder │ │ ├── __init__.py │ │ └── base_agent_test.py │ └── test_crew_agent_parser.py ├── cassettes │ ├── test_after_crew_modification.yaml │ ├── test_after_kickoff_modification.yaml │ ├── test_agent_custom_max_iterations.yaml │ ├── test_agent_error_on_parsing_tool.yaml │ ├── test_agent_execute_task_basic.yaml │ ├── test_agent_execute_task_with_context.yaml │ ├── test_agent_execute_task_with_custom_llm.yaml │ ├── test_agent_execute_task_with_ollama.yaml │ ├── test_agent_execute_task_with_tool.yaml │ ├── test_agent_execution.yaml │ ├── test_agent_execution_with_specific_tools.yaml │ ├── test_agent_execution_with_tools.yaml │ ├── test_agent_function_calling_llm.yaml │ ├── test_agent_moved_on_after_max_iterations.yaml │ ├── test_agent_powered_by_new_o_model_family_that_allows_skipping_tool.yaml │ ├── test_agent_powered_by_new_o_model_family_that_uses_tool.yaml │ ├── test_agent_remembers_output_format_after_using_tools_too_many_times.yaml │ ├── test_agent_repeated_tool_usage.yaml │ ├── test_agent_repeated_tool_usage_check_even_with_disabled_cache.yaml │ ├── test_agent_respect_the_max_rpm_set.yaml │ ├── test_agent_respect_the_max_rpm_set_over_crew_rpm.yaml │ ├── test_agent_step_callback.yaml │ ├── test_agent_usage_metrics_are_captured_for_hierarchical_process.yaml │ ├── test_agent_use_specific_tasks_output_as_context.yaml │ ├── test_agent_with_knowledge_sources.yaml │ ├── test_agent_with_knowledge_sources_extensive_role.yaml │ ├── test_agent_with_knowledge_sources_generate_search_query.yaml │ ├── test_agent_with_knowledge_sources_with_query_limit_and_score_threshold.yaml │ ├── test_agent_with_knowledge_sources_with_query_limit_and_score_threshold_default.yaml │ ├── test_agent_with_knowledge_sources_works_with_copy.yaml │ ├── test_agent_with_ollama_llama3.yaml │ ├── test_agent_without_max_rpm_respects_crew_rpm.yaml │ ├── test_agent_without_max_rpm_respet_crew_rpm.yaml │ ├── test_agents_do_not_get_delegation_tools_with_there_is_only_one_agent.yaml │ ├── test_api_calls_throttling.yaml │ ├── test_before_crew_modification.yaml │ ├── test_before_crew_with_none_input.yaml │ ├── test_before_kickoff_callback.yaml │ ├── test_before_kickoff_modification.yaml │ ├── test_before_kickoff_with_none_input.yaml │ ├── test_before_kickoff_without_inputs.yaml │ ├── test_cache_hitting.yaml │ ├── test_cache_hitting_between_agents.yaml │ ├── test_conditional_task_last_task_when_conditional_is_false.yaml │ ├── test_conditional_task_last_task_when_conditional_is_true.yaml │ ├── test_crew_creation.yaml │ ├── test_crew_does_not_interpolate_without_inputs.yaml │ ├── test_crew_external_memory_save.yaml │ ├── test_crew_external_memory_save_using_crew_without_memory_flag[save].yaml │ ├── test_crew_external_memory_save_using_crew_without_memory_flag[search].yaml │ ├── test_crew_external_memory_save_with_memory_flag[save].yaml │ ├── test_crew_external_memory_save_with_memory_flag[search].yaml │ ├── test_crew_external_memory_search.yaml │ ├── test_crew_function_calling_llm.yaml │ ├── test_crew_kickoff_streaming_usage_metrics.yaml │ ├── test_crew_kickoff_usage_metrics.yaml │ ├── test_crew_log_file_output.yaml │ ├── test_crew_output_file_end_to_end.yaml │ ├── test_crew_verbose_output.yaml │ ├── test_crew_with_delegating_agents.yaml │ ├── test_crew_with_delegating_agents_should_not_override_agent_tools.yaml │ ├── test_crew_with_delegating_agents_should_not_override_task_tools.yaml │ ├── test_crew_with_failing_task_guardrails.yaml │ ├── test_crew_with_knowledge_sources_works_with_copy.yaml │ ├── test_custom_converter_cls.yaml │ ├── test_custom_llm_implementation.yaml │ ├── test_custom_llm_within_crew.yaml │ ├── test_deepseek_r1_with_open_router.yaml │ ├── test_delegation_is_not_enabled_if_there_are_only_one_agent.yaml │ ├── test_disabled_memory_using_contextual_memory.yaml │ ├── test_disabling_cache_for_agent.yaml │ ├── test_docling_source.yaml │ ├── test_gemini_models[gemini-gemini-2.0-flash-001].yaml │ ├── test_gemini_models[gemini-gemini-2.0-flash-lite-001].yaml │ ├── test_gemini_models[gemini-gemini-2.0-flash-thinking-exp-01-21].yaml │ ├── test_gemini_models[gemini-gemini-2.5-flash-preview-04-17].yaml │ ├── test_gemini_models[gemini-gemini-2.5-pro-exp-03-25].yaml │ ├── test_gemma3[gemini-gemma-3-12b-it].yaml │ ├── test_gemma3[gemini-gemma-3-1b-it].yaml │ ├── test_gemma3[gemini-gemma-3-27b-it].yaml │ ├── test_gemma3[gemini-gemma-3-4b-it].yaml │ ├── test_get_knowledge_search_query.yaml │ ├── test_gpt_4_1[gpt-4.1-mini-2025-04-14].yaml │ ├── test_gpt_4_1[gpt-4.1-nano-2025-04-14].yaml │ ├── test_gpt_4_1[gpt-4.1].yaml │ ├── test_guardrail_emits_events.yaml │ ├── test_guardrail_when_an_error_occurs.yaml │ ├── test_handle_context_length_exceeds_limit.yaml │ ├── test_handle_context_length_exceeds_limit_cli_no.yaml │ ├── test_handle_streaming_tool_calls.yaml │ ├── test_handle_streaming_tool_calls_no_available_functions.yaml │ ├── test_handle_streaming_tool_calls_no_tools.yaml │ ├── test_handle_streaming_tool_calls_with_error.yaml │ ├── test_hierarchical_crew_creation_tasks_with_agents.yaml │ ├── test_hierarchical_crew_creation_tasks_with_async_execution.yaml │ ├── test_hierarchical_crew_creation_tasks_with_sync_last.yaml │ ├── test_hierarchical_process.yaml │ ├── test_hierarchical_verbose_false_manager_agent.yaml │ ├── test_hierarchical_verbose_manager_agent.yaml │ ├── test_increment_delegations_for_hierarchical_process.yaml │ ├── test_increment_delegations_for_sequential_process.yaml │ ├── test_increment_tool_errors.yaml │ ├── test_inject_date.yaml │ ├── test_inject_date_custom_format.yaml │ ├── test_json_property_without_output_json.yaml │ ├── test_kickoff_for_each_error_handling.yaml │ ├── test_kickoff_for_each_multiple_inputs.yaml │ ├── test_kickoff_for_each_single_input.yaml │ ├── test_lite_agent_created_with_correct_parameters[False].yaml │ ├── test_lite_agent_created_with_correct_parameters[True].yaml │ ├── test_lite_agent_returns_usage_metrics.yaml │ ├── test_lite_agent_returns_usage_metrics_async.yaml │ ├── test_lite_agent_structured_output.yaml │ ├── test_lite_agent_with_tools.yaml │ ├── test_llm_call.yaml │ ├── test_llm_call_with_all_attributes.yaml │ ├── test_llm_call_with_message_list.yaml │ ├── test_llm_call_with_ollama_llama3.yaml │ ├── test_llm_call_with_string_input.yaml │ ├── test_llm_call_with_string_input_and_callbacks.yaml │ ├── test_llm_call_with_tool_and_message_list.yaml │ ├── test_llm_call_with_tool_and_string_input.yaml │ ├── test_llm_callback_replacement.yaml │ ├── test_logging_tool_usage.yaml │ ├── test_long_term_memory_with_memory_flag.yaml │ ├── test_manager_agent_delegating_to_all_agents.yaml │ ├── test_manager_agent_delegating_to_assigned_task_agent.yaml │ ├── test_multimodal_agent_describing_image_successfully.yaml │ ├── test_multimodal_agent_live_image_analysis.yaml │ ├── test_multiple_before_after_crew.yaml │ ├── test_multiple_before_after_kickoff.yaml │ ├── test_multiple_docling_sources.yaml │ ├── test_no_inject_date.yaml │ ├── test_o3_mini_reasoning_effort_high.yaml │ ├── test_o3_mini_reasoning_effort_low.yaml │ ├── test_o3_mini_reasoning_effort_medium.yaml │ ├── test_output_json_dict_hierarchical.yaml │ ├── test_output_json_dict_sequential.yaml │ ├── test_output_json_hierarchical.yaml │ ├── test_output_json_sequential.yaml │ ├── test_output_json_to_another_task.yaml │ ├── test_output_pydantic_hierarchical.yaml │ ├── test_output_pydantic_sequential.yaml │ ├── test_output_pydantic_to_another_task.yaml │ ├── test_replay_interpolates_inputs_properly.yaml │ ├── test_replay_setup_context.yaml │ ├── test_replay_with_context.yaml │ ├── test_save_task_json_output.yaml │ ├── test_save_task_output.yaml │ ├── test_save_task_pydantic_output.yaml │ ├── test_sequential_async_task_execution_completion.yaml │ ├── test_single_task_with_async_execution.yaml │ ├── test_task_execution_times.yaml │ ├── test_task_guardrail_process_output.yaml │ ├── test_task_interpolation_with_hyphens.yaml │ ├── test_task_tools_override_agent_tools.yaml │ ├── test_task_with_max_execution_time.yaml │ ├── test_task_with_max_execution_time_exceeded.yaml │ ├── test_task_with_no_arguments.yaml │ ├── test_telemetry_fails_due_connect_timeout.yaml │ ├── test_tool_result_as_answer_is_the_final_answer_for_the_agent.yaml │ ├── test_tool_usage_information_is_appended_to_agent.yaml │ ├── test_tools_with_custom_caching.yaml │ ├── test_using_contextual_memory.yaml │ ├── test_using_contextual_memory_with_long_term_memory.yaml │ ├── test_using_contextual_memory_with_short_term_memory.yaml │ └── test_warning_long_term_memory_without_entity_memory.yaml ├── cli │ ├── __init__.py │ ├── authentication │ │ ├── __init__.py │ │ ├── test_auth_main.py │ │ └── test_utils.py │ ├── cli_test.py │ ├── config_test.py │ ├── deploy │ │ ├── __init__.py │ │ └── test_deploy_main.py │ ├── test_constants.py │ ├── test_crew_test.py │ ├── test_git.py │ ├── test_plus_api.py │ ├── test_utils.py │ ├── tools │ │ ├── __init__.py │ │ └── test_main.py │ └── train_crew_test.py ├── config │ ├── agents.yaml │ └── tasks.yaml ├── conftest.py ├── crew_test.py ├── custom_llm_test.py ├── flow_test.py ├── imports_test.py ├── knowledge │ ├── __init__.py │ ├── crewai_quickstart.pdf │ └── knowledge_test.py ├── llm_test.py ├── memory │ ├── __init__.py │ ├── external_memory_test.py │ ├── long_term_memory_test.py │ ├── short_term_memory_test.py │ └── user_memory_test.py ├── pipeline │ ├── __init__.py │ └── cassettes │ │ └── test_router_with_empty_input.yaml ├── project_test.py ├── security │ ├── __init__.py │ ├── test_deterministic_fingerprints.py │ ├── test_examples.py │ ├── test_fingerprint.py │ ├── test_integration.py │ └── test_security_config.py ├── storage │ ├── __init__.py │ └── test_mem0_storage.py ├── task_test.py ├── telemetry │ ├── __init__.py │ ├── test_telemetry.py │ └── test_telemetry_disable.py ├── test_agent_inject_date.py ├── test_flow_default_override.py ├── test_flow_persistence.py ├── test_hallucination_guardrail.py ├── test_lite_agent.py ├── test_markdown_task.py ├── test_multimodal_validation.py ├── test_task_guardrails.py ├── tools │ ├── __init__.py │ ├── agent_tools │ │ ├── __init__.py │ │ ├── agent_tools_test.py │ │ └── cassettes │ │ │ ├── test_ask_question.yaml │ │ │ ├── test_ask_question_with_coworker_as_array.yaml │ │ │ ├── test_ask_question_with_wrong_co_worker_variable.yaml │ │ │ ├── test_delegate_work.yaml │ │ │ ├── test_delegate_work_with_wrong_co_worker_variable.yaml │ │ │ └── test_delegate_work_withwith_coworker_as_array.yaml │ ├── test_base_tool.py │ ├── test_structured_tool.py │ ├── test_tool_usage.py │ └── test_tool_usage_limit.py └── utilities │ ├── __init__.py │ ├── cassettes │ ├── test_agent_emits_execution_started_and_completed_events.yaml │ ├── test_convert_with_instructions.yaml │ ├── test_converter_with_llama3_1_model.yaml │ ├── test_converter_with_llama3_2_model.yaml │ ├── test_converter_with_nested_model.yaml │ ├── test_crew_emits_end_kickoff_event.yaml │ ├── test_crew_emits_end_task_event.yaml │ ├── test_crew_emits_kickoff_events.yaml │ ├── test_crew_emits_start_kickoff_event.yaml │ ├── test_crew_emits_start_task_event.yaml │ ├── test_crew_emits_task_failed_event.yaml │ ├── test_crew_emits_test_kickoff_type_event.yaml │ ├── test_llm_emits_call_failed_event.yaml │ ├── test_llm_emits_call_started_event.yaml │ ├── test_llm_emits_stream_chunk_events.yaml │ ├── test_llm_no_stream_chunks_when_streaming_disabled.yaml │ ├── test_multiple_handlers_for_same_event.yaml │ ├── test_register_handler_adds_new_handler.yaml │ ├── test_task_emits_failed_event_on_execution_error.yaml │ ├── test_tools_emits_error_events.yaml │ └── test_tools_emits_finished_events.yaml │ ├── evaluators │ ├── __init__.py │ ├── test_crew_evaluator_handler.py │ └── test_task_evaluator.py │ ├── events │ ├── __init__.py │ └── test_crewai_event_bus.py │ ├── prompts.json │ ├── test_chromadb_utils.py │ ├── test_converter.py │ ├── test_events.py │ ├── test_file_handler.py │ ├── test_i18n.py │ ├── test_knowledge_planning.py │ ├── test_llm_utils.py │ ├── test_planning_handler.py │ ├── test_pydantic_schema_parser.py │ ├── test_serialization.py │ ├── test_string_utils.py │ └── test_training_handler.py └── uv.lock /.cache/plugin/social/0b649b356e60b558dfaafe8bb095862e.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/0b649b356e60b558dfaafe8bb095862e.png -------------------------------------------------------------------------------- /.cache/plugin/social/0cce129b2747506603c430fd3fe2b3d6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/0cce129b2747506603c430fd3fe2b3d6.png -------------------------------------------------------------------------------- /.cache/plugin/social/0f18d6e26b8551d3f42ef92b0f786024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/0f18d6e26b8551d3f42ef92b0f786024.png -------------------------------------------------------------------------------- /.cache/plugin/social/14c48b40955d6021b47ae973d9aef723.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/14c48b40955d6021b47ae973d9aef723.png -------------------------------------------------------------------------------- /.cache/plugin/social/17484ad7f45b09a1db146ba3ad3df79a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/17484ad7f45b09a1db146ba3ad3df79a.png -------------------------------------------------------------------------------- /.cache/plugin/social/1d935acb34360e4768e35ae13479bbf9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/1d935acb34360e4768e35ae13479bbf9.png -------------------------------------------------------------------------------- /.cache/plugin/social/216220c022e734cc7999210b48c9fb59.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/216220c022e734cc7999210b48c9fb59.png -------------------------------------------------------------------------------- /.cache/plugin/social/246dcba6c47283feac354f5871842fe8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/246dcba6c47283feac354f5871842fe8.png -------------------------------------------------------------------------------- /.cache/plugin/social/259ba94ac7e93bd9f968c57ec4a15fe5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/259ba94ac7e93bd9f968c57ec4a15fe5.png -------------------------------------------------------------------------------- /.cache/plugin/social/288fd82ce2209be4864d19bd50b21474.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/288fd82ce2209be4864d19bd50b21474.png -------------------------------------------------------------------------------- /.cache/plugin/social/28a844df4871a1cdfcba05fdc87bb3e8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/28a844df4871a1cdfcba05fdc87bb3e8.png -------------------------------------------------------------------------------- /.cache/plugin/social/40770a96ef2fb657a7aa16a9facf702f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/40770a96ef2fb657a7aa16a9facf702f.png -------------------------------------------------------------------------------- /.cache/plugin/social/4747e68a5e5c0f0994cdc5b37682a37c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/4747e68a5e5c0f0994cdc5b37682a37c.png -------------------------------------------------------------------------------- /.cache/plugin/social/4809f4ae19b6e78539b900da82d8a1f6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/4809f4ae19b6e78539b900da82d8a1f6.png -------------------------------------------------------------------------------- /.cache/plugin/social/481b171eb3fe3dec67ca86d2d923f598.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/481b171eb3fe3dec67ca86d2d923f598.png -------------------------------------------------------------------------------- /.cache/plugin/social/4ae47a8f7da894db700b2f29242cd0c5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/4ae47a8f7da894db700b2f29242cd0c5.png -------------------------------------------------------------------------------- /.cache/plugin/social/4c1fb3bfd02d6b1317779fe5101058a7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/4c1fb3bfd02d6b1317779fe5101058a7.png -------------------------------------------------------------------------------- /.cache/plugin/social/56e240bc0124af182495bc59877d8d11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/56e240bc0124af182495bc59877d8d11.png -------------------------------------------------------------------------------- /.cache/plugin/social/5d2431971fcde0af2c84e4680a4227a7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/5d2431971fcde0af2c84e4680a4227a7.png -------------------------------------------------------------------------------- /.cache/plugin/social/69bcd9a2304ea69e1244a7ac510dd98d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/69bcd9a2304ea69e1244a7ac510dd98d.png -------------------------------------------------------------------------------- /.cache/plugin/social/6b49f5ef597c15cabc3df9bac4fbcf44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/6b49f5ef597c15cabc3df9bac4fbcf44.png -------------------------------------------------------------------------------- /.cache/plugin/social/7296e2d6c7b2c713ed7b2e4546e3acdb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/7296e2d6c7b2c713ed7b2e4546e3acdb.png -------------------------------------------------------------------------------- /.cache/plugin/social/805d7c5662a45ca18b52554eecbc34af.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/805d7c5662a45ca18b52554eecbc34af.png -------------------------------------------------------------------------------- /.cache/plugin/social/80f1492950494de7a34a1f20f6dd4368.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/80f1492950494de7a34a1f20f6dd4368.png -------------------------------------------------------------------------------- /.cache/plugin/social/834ad7f8096fa4c92637b815777bf2bd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/834ad7f8096fa4c92637b815777bf2bd.png -------------------------------------------------------------------------------- /.cache/plugin/social/8b089bdf12d22c016f481d654be39eb1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/8b089bdf12d22c016f481d654be39eb1.png -------------------------------------------------------------------------------- /.cache/plugin/social/96f1c198bf51f822eb04a25adf7ca20c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/96f1c198bf51f822eb04a25adf7ca20c.png -------------------------------------------------------------------------------- /.cache/plugin/social/9f88e9bd3010b149e527e0600c2e438c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/9f88e9bd3010b149e527e0600c2e438c.png -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-Black.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-BlackItalic.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-Bold.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-BoldItalic.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-Italic.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-Light.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-LightItalic.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-Medium.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-MediumItalic.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-Regular.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-Thin.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/Roboto-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/Roboto-ThinItalic.ttf -------------------------------------------------------------------------------- /.cache/plugin/social/a0c21e9a7250afebc533da92c7050bed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/a0c21e9a7250afebc533da92c7050bed.png -------------------------------------------------------------------------------- /.cache/plugin/social/a19c79f0bc7a3e5ffc6b511a68273e5d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/a19c79f0bc7a3e5ffc6b511a68273e5d.png -------------------------------------------------------------------------------- /.cache/plugin/social/a1d83c5e1feb928b579ad122a8d3786d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/a1d83c5e1feb928b579ad122a8d3786d.png -------------------------------------------------------------------------------- /.cache/plugin/social/a3d8476a7b5c6630a5f91aed8c210173.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/a3d8476a7b5c6630a5f91aed8c210173.png -------------------------------------------------------------------------------- /.cache/plugin/social/ac9c4b6558565d4c349355101e95c74a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/ac9c4b6558565d4c349355101e95c74a.png -------------------------------------------------------------------------------- /.cache/plugin/social/b417e4353162a563e70f1350a2777e2c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/b417e4353162a563e70f1350a2777e2c.png -------------------------------------------------------------------------------- /.cache/plugin/social/b84a1e5d0534be3c31f04a7d4a98b515.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/b84a1e5d0534be3c31f04a7d4a98b515.png -------------------------------------------------------------------------------- /.cache/plugin/social/bca675d7c3c82f52ebd329487fb9ade1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/bca675d7c3c82f52ebd329487fb9ade1.png -------------------------------------------------------------------------------- /.cache/plugin/social/bdf46ef3b5230ebb45ef648933f54fa2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/bdf46ef3b5230ebb45ef648933f54fa2.png -------------------------------------------------------------------------------- /.cache/plugin/social/beacb748aad822c66a972b39186dbef1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/beacb748aad822c66a972b39186dbef1.png -------------------------------------------------------------------------------- /.cache/plugin/social/caa7abb72303dbe5a02ec11e6f1eba6b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/caa7abb72303dbe5a02ec11e6f1eba6b.png -------------------------------------------------------------------------------- /.cache/plugin/social/cff5eb5aae0959e143c12945428558bc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/cff5eb5aae0959e143c12945428558bc.png -------------------------------------------------------------------------------- /.cache/plugin/social/d01b95e8266a0d2c5f825b88d98a97a1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/d01b95e8266a0d2c5f825b88d98a97a1.png -------------------------------------------------------------------------------- /.cache/plugin/social/d7db21df76b132d3ca3ae4313e23f77d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/d7db21df76b132d3ca3ae4313e23f77d.png -------------------------------------------------------------------------------- /.cache/plugin/social/d87db72302152f8c0953d7105c28a206.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/d87db72302152f8c0953d7105c28a206.png -------------------------------------------------------------------------------- /.cache/plugin/social/e580fe32a1d3f15fc89057d053ae3e52.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/e580fe32a1d3f15fc89057d053ae3e52.png -------------------------------------------------------------------------------- /.cache/plugin/social/e9111c93e01f7c1dfec7bbab69843076.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/e9111c93e01f7c1dfec7bbab69843076.png -------------------------------------------------------------------------------- /.cache/plugin/social/ebf70df39c2bfd2c4a89d70846a516ff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/ebf70df39c2bfd2c4a89d70846a516ff.png -------------------------------------------------------------------------------- /.cache/plugin/social/ed5690e7952bdee0372c8d3f1f5d98d7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/ed5690e7952bdee0372c8d3f1f5d98d7.png -------------------------------------------------------------------------------- /.cache/plugin/social/f6d08b81ae945faa6c4a436de48d2da6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/f6d08b81ae945faa6c4a436de48d2da6.png -------------------------------------------------------------------------------- /.cache/plugin/social/f875c8d6b0cd71d9ae38300c82361d77.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/f875c8d6b0cd71d9ae38300c82361d77.png -------------------------------------------------------------------------------- /.cache/plugin/social/fc9a9f44881519178d4000f24000ef9d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/.cache/plugin/social/fc9a9f44881519178d4000f24000ef9d.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # .editorconfig 2 | root = true 3 | 4 | # All files 5 | [*] 6 | charset = utf-8 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | # Python files 12 | [*.py] 13 | indent_style = space 14 | indent_size = 2 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /.github/security.md: -------------------------------------------------------------------------------- 1 | ## CrewAI Security Vulnerability Reporting Policy 2 | 3 | CrewAI prioritizes the security of our software products, services, and GitHub repositories. To promptly address vulnerabilities, follow these steps for reporting security issues: 4 | 5 | ### Reporting Process 6 | Do **not** report vulnerabilities via public GitHub issues. 7 | 8 | Email all vulnerability reports directly to: 9 | **security@crewai.com** 10 | 11 | ### Required Information 12 | To help us quickly validate and remediate the issue, your report must include: 13 | 14 | - **Vulnerability Type:** Clearly state the vulnerability type (e.g., SQL injection, XSS, privilege escalation). 15 | - **Affected Source Code:** Provide full file paths and direct URLs (branch, tag, or commit). 16 | - **Reproduction Steps:** Include detailed, step-by-step instructions. Screenshots are recommended. 17 | - **Special Configuration:** Document any special settings or configurations required to reproduce. 18 | - **Proof-of-Concept (PoC):** Provide exploit or PoC code (if available). 19 | - **Impact Assessment:** Clearly explain the severity and potential exploitation scenarios. 20 | 21 | ### Our Response 22 | - We will acknowledge receipt of your report promptly via your provided email. 23 | - Confirmed vulnerabilities will receive priority remediation based on severity. 24 | - Patches will be released as swiftly as possible following verification. 25 | 26 | ### Reward Notice 27 | Currently, we do not offer a bug bounty program. Rewards, if issued, are discretionary. 28 | -------------------------------------------------------------------------------- /.github/workflows/linter.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | lint: 7 | runs-on: ubuntu-latest 8 | env: 9 | TARGET_BRANCH: ${{ github.event.pull_request.base.ref }} 10 | steps: 11 | - uses: actions/checkout@v4 12 | with: 13 | fetch-depth: 0 14 | 15 | - name: Fetch Target Branch 16 | run: git fetch origin $TARGET_BRANCH --depth=1 17 | 18 | - name: Install Ruff 19 | run: pip install ruff 20 | 21 | - name: Get Changed Python Files 22 | id: changed-files 23 | run: | 24 | merge_base=$(git merge-base origin/"$TARGET_BRANCH" HEAD) 25 | changed_files=$(git diff --name-only --diff-filter=ACMRTUB "$merge_base" | grep '\.py$' || true) 26 | echo "files<> $GITHUB_OUTPUT 27 | echo "$changed_files" >> $GITHUB_OUTPUT 28 | echo "EOF" >> $GITHUB_OUTPUT 29 | 30 | - name: Run Ruff on Changed Files 31 | if: ${{ steps.changed-files.outputs.files != '' }} 32 | run: | 33 | echo "${{ steps.changed-files.outputs.files }}" \ 34 | | tr ' ' '\n' \ 35 | | grep -v 'src/crewai/cli/templates/' \ 36 | | xargs -I{} ruff check "{}" 37 | -------------------------------------------------------------------------------- /.github/workflows/mkdocs.yml: -------------------------------------------------------------------------------- 1 | name: Deploy MkDocs 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | permissions: 8 | contents: write 9 | 10 | jobs: 11 | deploy: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - name: Checkout code 16 | uses: actions/checkout@v4 17 | 18 | - name: Setup Python 19 | uses: actions/setup-python@v5 20 | with: 21 | python-version: '3.10' 22 | 23 | - name: Calculate requirements hash 24 | id: req-hash 25 | run: echo "::set-output name=hash::$(sha256sum requirements-doc.txt | awk '{print $1}')" 26 | 27 | - name: Setup cache 28 | uses: actions/cache@v4 29 | with: 30 | key: mkdocs-material-${{ steps.req-hash.outputs.hash }} 31 | path: .cache 32 | restore-keys: | 33 | mkdocs-material- 34 | 35 | - name: Install Requirements 36 | run: | 37 | sudo apt-get update && 38 | sudo apt-get install pngquant && 39 | pip install mkdocs-material mkdocs-material-extensions pillow cairosvg 40 | 41 | env: 42 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 43 | 44 | - name: Build and deploy MkDocs 45 | run: mkdocs gh-deploy --force 46 | -------------------------------------------------------------------------------- /.github/workflows/notify-downstream.yml: -------------------------------------------------------------------------------- 1 | name: Notify Downstream 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | permissions: 9 | contents: read 10 | 11 | jobs: 12 | notify-downstream: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Generate GitHub App token 17 | id: app-token 18 | uses: tibdex/github-app-token@v2 19 | with: 20 | app_id: ${{ secrets.OSS_SYNC_APP_ID }} 21 | private_key: ${{ secrets.OSS_SYNC_APP_PRIVATE_KEY }} 22 | 23 | - name: Notify Repo B 24 | uses: peter-evans/repository-dispatch@v3 25 | with: 26 | token: ${{ steps.app-token.outputs.token }} 27 | repository: ${{ secrets.OSS_SYNC_DOWNSTREAM_REPO }} 28 | event-type: upstream-commit 29 | client-payload: | 30 | { 31 | "commit_sha": "${{ github.sha }}" 32 | } 33 | 34 | -------------------------------------------------------------------------------- /.github/workflows/security-checker.yml: -------------------------------------------------------------------------------- 1 | name: Security Checker 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | security-check: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout code 11 | uses: actions/checkout@v4 12 | 13 | - name: Set up Python 14 | uses: actions/setup-python@v5 15 | with: 16 | python-version: "3.11.9" 17 | 18 | - name: Install dependencies 19 | run: pip install bandit 20 | 21 | - name: Run Bandit 22 | run: bandit -c pyproject.toml -r src/ -ll 23 | 24 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: Mark stale issues and pull requests 2 | 3 | permissions: 4 | contents: write 5 | issues: write 6 | pull-requests: write 7 | 8 | on: 9 | schedule: 10 | - cron: '10 12 * * *' 11 | workflow_dispatch: 12 | 13 | jobs: 14 | stale: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/stale@v9 18 | with: 19 | repo-token: ${{ secrets.GITHUB_TOKEN }} 20 | stale-issue-label: 'no-issue-activity' 21 | stale-issue-message: 'This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' 22 | close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' 23 | days-before-issue-stale: 30 24 | days-before-issue-close: 5 25 | stale-pr-label: 'no-pr-activity' 26 | stale-pr-message: 'This PR is stale because it has been open for 45 days with no activity.' 27 | days-before-pr-stale: 45 28 | days-before-pr-close: -1 29 | operations-per-run: 1200 30 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Run Tests 2 | 3 | on: [pull_request] 4 | 5 | permissions: 6 | contents: write 7 | 8 | env: 9 | OPENAI_API_KEY: fake-api-key 10 | 11 | jobs: 12 | tests: 13 | runs-on: ubuntu-latest 14 | timeout-minutes: 15 15 | strategy: 16 | matrix: 17 | python-version: ['3.10', '3.11', '3.12', '3.13'] 18 | steps: 19 | - name: Checkout code 20 | uses: actions/checkout@v4 21 | 22 | - name: Install uv 23 | uses: astral-sh/setup-uv@v3 24 | with: 25 | enable-cache: true 26 | 27 | - name: Set up Python ${{ matrix.python-version }} 28 | run: uv python install ${{ matrix.python-version }} 29 | 30 | - name: Install the project 31 | run: uv sync --dev --all-extras 32 | 33 | - name: Run tests 34 | run: uv run pytest --block-network --timeout=60 -vv 35 | -------------------------------------------------------------------------------- /.github/workflows/type-checker.yml: -------------------------------------------------------------------------------- 1 | name: Run Type Checks 2 | 3 | on: [pull_request] 4 | 5 | permissions: 6 | contents: write 7 | 8 | jobs: 9 | type-checker: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout code 14 | uses: actions/checkout@v4 15 | 16 | - name: Setup Python 17 | uses: actions/setup-python@v5 18 | with: 19 | python-version: "3.11.9" 20 | 21 | - name: Install Requirements 22 | run: | 23 | pip install mypy 24 | 25 | - name: Run type checks 26 | run: mypy src 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .pytest_cache 3 | __pycache__ 4 | dist/ 5 | lib/ 6 | .env 7 | assets/* 8 | .idea 9 | test/ 10 | docs_crew/ 11 | chroma.sqlite3 12 | old_en.json 13 | db/ 14 | test.py 15 | rc-tests/* 16 | *.pkl 17 | temp/* 18 | .vscode/* 19 | crew_tasks_output.json 20 | .codesight 21 | .mypy_cache 22 | .ruff_cache 23 | .venv 24 | agentops.log 25 | test_flow.html 26 | crewairules.mdc 27 | plan.md 28 | conceptual_plan.md 29 | build_image -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/astral-sh/ruff-pre-commit 3 | rev: v0.8.2 4 | hooks: 5 | - id: ruff 6 | args: ["--fix"] 7 | - id: ruff-format 8 | -------------------------------------------------------------------------------- /.ruff.toml: -------------------------------------------------------------------------------- 1 | exclude = [ 2 | "templates", 3 | "__init__.py", 4 | ] 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2025 crewAI, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /docs/common-room-tracking.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | if (typeof window === 'undefined') return; 3 | if (typeof window.signals !== 'undefined') return; 4 | var script = document.createElement('script'); 5 | script.src = 'https://cdn.cr-relay.com/v1/site/883520f4-c431-44be-80e7-e123a1ee7a2b/signals.js'; 6 | script.async = true; 7 | window.signals = Object.assign( 8 | [], 9 | ['page', 'identify', 'form'].reduce(function (acc, method){ 10 | acc[method] = function () { 11 | signals.push([method, arguments]); 12 | return signals; 13 | }; 14 | return acc; 15 | }, {}) 16 | ); 17 | document.head.appendChild(script); 18 | })(); -------------------------------------------------------------------------------- /docs/enterprise/guides/build-crew.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Build Crew" 3 | description: "A Crew is a group of agents that work together to complete a task." 4 | icon: "people-arrows" 5 | --- 6 | 7 | ## Overview 8 | 9 | [CrewAI Enterprise](https://app.crewai.com) streamlines the process of **creating**, **deploying**, and **managing** your AI agents in production environments. 10 | 11 | ## Getting Started 12 | 13 | 23 | 24 | ### Installation and Setup 25 | 26 | 27 | Follow our standard installation guide to set up CrewAI CLI and create your first project. 28 | 29 | 30 | ### Building Your Crew 31 | 32 | 33 | Follow our quickstart guide to create your first agent crew using YAML configuration. 34 | 35 | 36 | ## Support and Resources 37 | 38 | For Enterprise-specific support or questions, contact our dedicated support team at [support@crewai.com](mailto:support@crewai.com). 39 | 40 | 41 | 42 | Book time with our team to learn more about Enterprise features and how they can benefit your organization. 43 | -------------------------------------------------------------------------------- /docs/examples/example.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: CrewAI Examples 3 | description: A collection of examples that show how to use CrewAI framework to automate workflows. 4 | icon: rocket-launch 5 | --- 6 | 7 | 8 | 15 | Automate marketing strategy creation with CrewAI. 16 | 17 | 24 | Create a surprise trip itinerary with CrewAI. 25 | 26 | 33 | Match a profile to jobpositions with CrewAI. 34 | 35 | 42 | Create a job posting with CrewAI. 43 | 44 | 51 | Create a game with CrewAI. 52 | 53 | 60 | Find job candidates with CrewAI. 61 | 62 | 63 | -------------------------------------------------------------------------------- /docs/images/agentops-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/agentops-overview.png -------------------------------------------------------------------------------- /docs/images/agentops-replay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/agentops-replay.png -------------------------------------------------------------------------------- /docs/images/agentops-session.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/agentops-session.png -------------------------------------------------------------------------------- /docs/images/asset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/asset.png -------------------------------------------------------------------------------- /docs/images/complexity_precision.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/complexity_precision.png -------------------------------------------------------------------------------- /docs/images/crewAI-mindmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewAI-mindmap.png -------------------------------------------------------------------------------- /docs/images/crew_only_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crew_only_logo.png -------------------------------------------------------------------------------- /docs/images/crewai-flow-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-flow-1.png -------------------------------------------------------------------------------- /docs/images/crewai-flow-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-flow-2.png -------------------------------------------------------------------------------- /docs/images/crewai-flow-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-flow-3.png -------------------------------------------------------------------------------- /docs/images/crewai-flow-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-flow-4.png -------------------------------------------------------------------------------- /docs/images/crewai-flow-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-flow-5.png -------------------------------------------------------------------------------- /docs/images/crewai-flow-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-flow-6.png -------------------------------------------------------------------------------- /docs/images/crewai-flow-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-flow-7.png -------------------------------------------------------------------------------- /docs/images/crewai-flow-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-flow-8.png -------------------------------------------------------------------------------- /docs/images/crewai-run-poetry-error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-run-poetry-error.png -------------------------------------------------------------------------------- /docs/images/crewai-update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai-update.png -------------------------------------------------------------------------------- /docs/images/crewai_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crewai_logo.png -------------------------------------------------------------------------------- /docs/images/crews.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/crews.png -------------------------------------------------------------------------------- /docs/images/enterprise/activepieces-body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/activepieces-body.png -------------------------------------------------------------------------------- /docs/images/enterprise/activepieces-email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/activepieces-email.png -------------------------------------------------------------------------------- /docs/images/enterprise/activepieces-flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/activepieces-flow.png -------------------------------------------------------------------------------- /docs/images/enterprise/activepieces-headers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/activepieces-headers.png -------------------------------------------------------------------------------- /docs/images/enterprise/activepieces-trigger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/activepieces-trigger.png -------------------------------------------------------------------------------- /docs/images/enterprise/activepieces-webhook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/activepieces-webhook.png -------------------------------------------------------------------------------- /docs/images/enterprise/add-role-modal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/add-role-modal.png -------------------------------------------------------------------------------- /docs/images/enterprise/assign-role.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/assign-role.png -------------------------------------------------------------------------------- /docs/images/enterprise/azure-openai-studio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/azure-openai-studio.png -------------------------------------------------------------------------------- /docs/images/enterprise/bearer-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/bearer-token.png -------------------------------------------------------------------------------- /docs/images/enterprise/connect-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/connect-github.png -------------------------------------------------------------------------------- /docs/images/enterprise/connection-added.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/connection-added.png -------------------------------------------------------------------------------- /docs/images/enterprise/copy-task-id.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/copy-task-id.png -------------------------------------------------------------------------------- /docs/images/enterprise/crew-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crew-dashboard.png -------------------------------------------------------------------------------- /docs/images/enterprise/crew-human-input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crew-human-input.png -------------------------------------------------------------------------------- /docs/images/enterprise/crew-resume-endpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crew-resume-endpoint.png -------------------------------------------------------------------------------- /docs/images/enterprise/crew-secrets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crew-secrets.png -------------------------------------------------------------------------------- /docs/images/enterprise/crew-studio-interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crew-studio-interface.png -------------------------------------------------------------------------------- /docs/images/enterprise/crew-webhook-url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crew-webhook-url.png -------------------------------------------------------------------------------- /docs/images/enterprise/crewai-custom-gpt-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crewai-custom-gpt-1.png -------------------------------------------------------------------------------- /docs/images/enterprise/crewai-custom-gpt-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crewai-custom-gpt-2.png -------------------------------------------------------------------------------- /docs/images/enterprise/crewai-enterprise-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/crewai-enterprise-dashboard.png -------------------------------------------------------------------------------- /docs/images/enterprise/customise-react-component-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/customise-react-component-2.png -------------------------------------------------------------------------------- /docs/images/enterprise/customise-react-component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/customise-react-component.png -------------------------------------------------------------------------------- /docs/images/enterprise/dall-e-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/dall-e-image.png -------------------------------------------------------------------------------- /docs/images/enterprise/deploy-progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/deploy-progress.png -------------------------------------------------------------------------------- /docs/images/enterprise/env-vars-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/env-vars-button.png -------------------------------------------------------------------------------- /docs/images/enterprise/export-react-component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/export-react-component.png -------------------------------------------------------------------------------- /docs/images/enterprise/failure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/failure.png -------------------------------------------------------------------------------- /docs/images/enterprise/final-output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/final-output.png -------------------------------------------------------------------------------- /docs/images/enterprise/get-status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/get-status.png -------------------------------------------------------------------------------- /docs/images/enterprise/hubspot-workflow-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/hubspot-workflow-1.png -------------------------------------------------------------------------------- /docs/images/enterprise/hubspot-workflow-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/hubspot-workflow-2.png -------------------------------------------------------------------------------- /docs/images/enterprise/hubspot-workflow-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/hubspot-workflow-3.png -------------------------------------------------------------------------------- /docs/images/enterprise/kickoff-endpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/kickoff-endpoint.png -------------------------------------------------------------------------------- /docs/images/enterprise/kickoff-interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/kickoff-interface.png -------------------------------------------------------------------------------- /docs/images/enterprise/kickoff-slack-crew-dropdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/kickoff-slack-crew-dropdown.png -------------------------------------------------------------------------------- /docs/images/enterprise/kickoff-slack-crew-kickoff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/kickoff-slack-crew-kickoff.png -------------------------------------------------------------------------------- /docs/images/enterprise/kickoff-slack-crew-results.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/kickoff-slack-crew-results.png -------------------------------------------------------------------------------- /docs/images/enterprise/kickoff-slack-crew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/kickoff-slack-crew.png -------------------------------------------------------------------------------- /docs/images/enterprise/llm-connection-config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/llm-connection-config.png -------------------------------------------------------------------------------- /docs/images/enterprise/llm-defaults.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/llm-defaults.png -------------------------------------------------------------------------------- /docs/images/enterprise/mcp-enterprise-download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/mcp-enterprise-download.png -------------------------------------------------------------------------------- /docs/images/enterprise/member-accepted-invitation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/member-accepted-invitation.png -------------------------------------------------------------------------------- /docs/images/enterprise/members-tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/members-tab.png -------------------------------------------------------------------------------- /docs/images/enterprise/redeploy-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/redeploy-button.png -------------------------------------------------------------------------------- /docs/images/enterprise/reset-token.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/reset-token.png -------------------------------------------------------------------------------- /docs/images/enterprise/roles-tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/roles-tab.png -------------------------------------------------------------------------------- /docs/images/enterprise/run-crew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/run-crew.png -------------------------------------------------------------------------------- /docs/images/enterprise/select-repo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/select-repo.png -------------------------------------------------------------------------------- /docs/images/enterprise/set-env-variables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/set-env-variables.png -------------------------------------------------------------------------------- /docs/images/enterprise/settings-page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/settings-page.png -------------------------------------------------------------------------------- /docs/images/enterprise/sfdcdemo-vini.mov: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/sfdcdemo-vini.mov -------------------------------------------------------------------------------- /docs/images/enterprise/slack-integration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/slack-integration.png -------------------------------------------------------------------------------- /docs/images/enterprise/trace-detailed-task.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/trace-detailed-task.png -------------------------------------------------------------------------------- /docs/images/enterprise/trace-summary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/trace-summary.png -------------------------------------------------------------------------------- /docs/images/enterprise/trace-tasks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/trace-tasks.png -------------------------------------------------------------------------------- /docs/images/enterprise/trace-timeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/trace-timeline.png -------------------------------------------------------------------------------- /docs/images/enterprise/traces-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/traces-overview.png -------------------------------------------------------------------------------- /docs/images/enterprise/update-env-vars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/update-env-vars.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-1.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-2.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-3.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-4.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-5.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-6.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-7.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-7b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-7b.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-8.png -------------------------------------------------------------------------------- /docs/images/enterprise/zapier-9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/enterprise/zapier-9.png -------------------------------------------------------------------------------- /docs/images/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 10 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /docs/images/flows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/flows.png -------------------------------------------------------------------------------- /docs/images/langtrace1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/langtrace1.png -------------------------------------------------------------------------------- /docs/images/langtrace2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/langtrace2.png -------------------------------------------------------------------------------- /docs/images/langtrace3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/langtrace3.png -------------------------------------------------------------------------------- /docs/images/mlflow-tracing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/mlflow-tracing.gif -------------------------------------------------------------------------------- /docs/images/mlflow1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/mlflow1.png -------------------------------------------------------------------------------- /docs/images/openlit1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/openlit1.png -------------------------------------------------------------------------------- /docs/images/openlit2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/openlit2.png -------------------------------------------------------------------------------- /docs/images/openlit3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/openlit3.png -------------------------------------------------------------------------------- /docs/images/opik-crewai-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/opik-crewai-dashboard.png -------------------------------------------------------------------------------- /docs/images/releases/v01000.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01000.png -------------------------------------------------------------------------------- /docs/images/releases/v01020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01020.png -------------------------------------------------------------------------------- /docs/images/releases/v01050.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01050.png -------------------------------------------------------------------------------- /docs/images/releases/v01080.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01080.png -------------------------------------------------------------------------------- /docs/images/releases/v01140.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01140.png -------------------------------------------------------------------------------- /docs/images/releases/v01170.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01170.png -------------------------------------------------------------------------------- /docs/images/releases/v01171.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01171.png -------------------------------------------------------------------------------- /docs/images/releases/v01180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01180.png -------------------------------------------------------------------------------- /docs/images/releases/v01190.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01190.png -------------------------------------------------------------------------------- /docs/images/releases/v01200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01200.png -------------------------------------------------------------------------------- /docs/images/releases/v01201.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01201.png -------------------------------------------------------------------------------- /docs/images/releases/v01210.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v01210.png -------------------------------------------------------------------------------- /docs/images/releases/v0850.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v0850.png -------------------------------------------------------------------------------- /docs/images/releases/v0860.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v0860.png -------------------------------------------------------------------------------- /docs/images/releases/v0950.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v0950.png -------------------------------------------------------------------------------- /docs/images/releases/v0980.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/releases/v0980.png -------------------------------------------------------------------------------- /docs/images/weave-tracing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/weave-tracing.gif -------------------------------------------------------------------------------- /docs/images/weave-tracing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/docs/images/weave-tracing.png -------------------------------------------------------------------------------- /docs/learn/kickoff-for-each.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Kickoff Crew for Each 3 | description: Kickoff Crew for Each Item in a List 4 | icon: at 5 | --- 6 | 7 | ## Introduction 8 | 9 | CrewAI provides the ability to kickoff a crew for each item in a list, allowing you to execute the crew for each item in the list. 10 | This feature is particularly useful when you need to perform the same set of tasks for multiple items. 11 | 12 | ## Kicking Off a Crew for Each Item 13 | 14 | To kickoff a crew for each item in a list, use the `kickoff_for_each()` method. 15 | This method executes the crew for each item in the list, allowing you to process multiple items efficiently. 16 | 17 | Here's an example of how to kickoff a crew for each item in a list: 18 | 19 | ```python Code 20 | from crewai import Crew, Agent, Task 21 | 22 | # Create an agent with code execution enabled 23 | coding_agent = Agent( 24 | role="Python Data Analyst", 25 | goal="Analyze data and provide insights using Python", 26 | backstory="You are an experienced data analyst with strong Python skills.", 27 | allow_code_execution=True 28 | ) 29 | 30 | # Create a task that requires code execution 31 | data_analysis_task = Task( 32 | description="Analyze the given dataset and calculate the average age of participants. Ages: {ages}", 33 | agent=coding_agent, 34 | expected_output="The average age calculated from the dataset" 35 | ) 36 | 37 | # Create a crew and add the task 38 | analysis_crew = Crew( 39 | agents=[coding_agent], 40 | tasks=[data_analysis_task], 41 | verbose=True, 42 | memory=False 43 | ) 44 | 45 | datasets = [ 46 | { "ages": [25, 30, 35, 40, 45] }, 47 | { "ages": [20, 25, 30, 35, 40] }, 48 | { "ages": [30, 35, 40, 45, 50] } 49 | ] 50 | 51 | # Execute the crew 52 | result = analysis_crew.kickoff_for_each(inputs=datasets) 53 | ``` -------------------------------------------------------------------------------- /docs/snippets/snippet-intro.mdx: -------------------------------------------------------------------------------- 1 | One of the core principles of software development is DRY (Don't Repeat 2 | Yourself). This is a principle that apply to documentation as 3 | well. If you find yourself repeating the same content in multiple places, you 4 | should consider creating a custom snippet to keep your content in sync. 5 | -------------------------------------------------------------------------------- /docs/tools/ai-ml/dalletool.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: DALL-E Tool 3 | description: The `DallETool` is a powerful tool designed for generating images from textual descriptions. 4 | icon: image 5 | --- 6 | 7 | # `DallETool` 8 | 9 | ## Description 10 | 11 | This tool is used to give the Agent the ability to generate images using the DALL-E model. It is a transformer-based model that generates images from textual descriptions. 12 | This tool allows the Agent to generate images based on the text input provided by the user. 13 | 14 | ## Installation 15 | 16 | Install the crewai_tools package 17 | ```shell 18 | pip install 'crewai[tools]' 19 | ``` 20 | 21 | ## Example 22 | 23 | Remember that when using this tool, the text must be generated by the Agent itself. The text must be a description of the image you want to generate. 24 | 25 | ```python Code 26 | from crewai_tools import DallETool 27 | 28 | Agent( 29 | ... 30 | tools=[DallETool()], 31 | ) 32 | ``` 33 | 34 | If needed you can also tweak the parameters of the DALL-E model by passing them as arguments to the `DallETool` class. For example: 35 | 36 | ```python Code 37 | from crewai_tools import DallETool 38 | 39 | dalle_tool = DallETool(model="dall-e-3", 40 | size="1024x1024", 41 | quality="standard", 42 | n=1) 43 | 44 | Agent( 45 | ... 46 | tools=[dalle_tool] 47 | ) 48 | ``` 49 | 50 | The parameters are based on the `client.images.generate` method from the OpenAI API. For more information on the parameters, 51 | please refer to the [OpenAI API documentation](https://platform.openai.com/docs/guides/images/introduction?lang=python). -------------------------------------------------------------------------------- /docs/tools/ai-ml/visiontool.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Vision Tool 3 | description: The `VisionTool` is designed to extract text from images. 4 | icon: eye 5 | --- 6 | 7 | # `VisionTool` 8 | 9 | ## Description 10 | 11 | This tool is used to extract text from images. When passed to the agent it will extract the text from the image and then use it to generate a response, report or any other output. 12 | The URL or the PATH of the image should be passed to the Agent. 13 | 14 | ## Installation 15 | 16 | Install the crewai_tools package 17 | 18 | ```shell 19 | pip install 'crewai[tools]' 20 | ``` 21 | 22 | ## Usage 23 | 24 | In order to use the VisionTool, the OpenAI API key should be set in the environment variable `OPENAI_API_KEY`. 25 | 26 | ```python Code 27 | from crewai_tools import VisionTool 28 | 29 | vision_tool = VisionTool() 30 | 31 | @agent 32 | def researcher(self) -> Agent: 33 | ''' 34 | This agent uses the VisionTool to extract text from images. 35 | ''' 36 | return Agent( 37 | config=self.agents_config["researcher"], 38 | allow_delegation=False, 39 | tools=[vision_tool] 40 | ) 41 | ``` 42 | 43 | ## Arguments 44 | 45 | The VisionTool requires the following arguments: 46 | 47 | | Argument | Type | Description | 48 | | :----------------- | :------- | :------------------------------------------------------------------------------- | 49 | | **image_path_url** | `string` | **Mandatory**. The path to the image file from which text needs to be extracted. | 50 | -------------------------------------------------------------------------------- /docs/tools/cloud-storage/overview.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Overview" 3 | description: "Interact with cloud services, storage systems, and cloud-based AI platforms" 4 | icon: "face-smile" 5 | --- 6 | 7 | These tools enable your agents to interact with cloud services, access cloud storage, and leverage cloud-based AI platforms for scalable operations. 8 | 9 | ## **Available Tools** 10 | 11 | 12 | 13 | Read files and data from Amazon S3 buckets. 14 | 15 | 16 | 17 | Write and upload files to Amazon S3 storage. 18 | 19 | 20 | 21 | Invoke Amazon Bedrock agents for AI-powered tasks. 22 | 23 | 24 | 25 | Retrieve information from Amazon Bedrock knowledge bases. 26 | 27 | 28 | 29 | ## **Common Use Cases** 30 | 31 | - **File Storage**: Store and retrieve files from cloud storage systems 32 | - **Data Backup**: Backup important data to cloud storage 33 | - **AI Services**: Access cloud-based AI models and services 34 | - **Knowledge Retrieval**: Query cloud-hosted knowledge bases 35 | - **Scalable Operations**: Leverage cloud infrastructure for processing 36 | 37 | ```python 38 | from crewai_tools import S3ReaderTool, S3WriterTool, BedrockInvokeAgentTool 39 | 40 | # Create cloud tools 41 | s3_reader = S3ReaderTool() 42 | s3_writer = S3WriterTool() 43 | bedrock_agent = BedrockInvokeAgentTool() 44 | 45 | # Add to your agent 46 | agent = Agent( 47 | role="Cloud Operations Specialist", 48 | tools=[s3_reader, s3_writer, bedrock_agent], 49 | goal="Manage cloud resources and AI services" 50 | ) -------------------------------------------------------------------------------- /docs/tools/file-document/filereadtool.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: File Read 3 | description: The `FileReadTool` is designed to read files from the local file system. 4 | icon: folders 5 | --- 6 | 7 | ## Overview 8 | 9 | 10 | We are still working on improving tools, so there might be unexpected behavior or changes in the future. 11 | 12 | 13 | The FileReadTool conceptually represents a suite of functionalities within the crewai_tools package aimed at facilitating file reading and content retrieval. 14 | This suite includes tools for processing batch text files, reading runtime configuration files, and importing data for analytics. 15 | It supports a variety of text-based file formats such as `.txt`, `.csv`, `.json`, and more. Depending on the file type, the suite offers specialized functionality, 16 | such as converting JSON content into a Python dictionary for ease of use. 17 | 18 | ## Installation 19 | 20 | To utilize the functionalities previously attributed to the FileReadTool, install the crewai_tools package: 21 | 22 | ```shell 23 | pip install 'crewai[tools]' 24 | ``` 25 | 26 | ## Usage Example 27 | 28 | To get started with the FileReadTool: 29 | 30 | ```python Code 31 | from crewai_tools import FileReadTool 32 | 33 | # Initialize the tool to read any files the agents knows or lean the path for 34 | file_read_tool = FileReadTool() 35 | 36 | # OR 37 | 38 | # Initialize the tool with a specific file path, so the agent can only read the content of the specified file 39 | file_read_tool = FileReadTool(file_path='path/to/your/file.txt') 40 | ``` 41 | 42 | ## Arguments 43 | 44 | - `file_path`: The path to the file you want to read. It accepts both absolute and relative paths. Ensure the file exists and you have the necessary permissions to access it. -------------------------------------------------------------------------------- /docs/tools/web-scraping/firecrawlscrapewebsitetool.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Firecrawl Scrape Website 3 | description: The `FirecrawlScrapeWebsiteTool` is designed to scrape websites and convert them into clean markdown or structured data. 4 | icon: fire-flame 5 | --- 6 | 7 | # `FirecrawlScrapeWebsiteTool` 8 | 9 | ## Description 10 | 11 | [Firecrawl](https://firecrawl.dev) is a platform for crawling and convert any website into clean markdown or structured data. 12 | 13 | ## Installation 14 | 15 | - Get an API key from [firecrawl.dev](https://firecrawl.dev) and set it in environment variables (`FIRECRAWL_API_KEY`). 16 | - Install the [Firecrawl SDK](https://github.com/mendableai/firecrawl) along with `crewai[tools]` package: 17 | 18 | ```shell 19 | pip install firecrawl-py 'crewai[tools]' 20 | ``` 21 | 22 | ## Example 23 | 24 | Utilize the FirecrawlScrapeWebsiteTool as follows to allow your agent to load websites: 25 | 26 | ```python Code 27 | from crewai_tools import FirecrawlScrapeWebsiteTool 28 | 29 | tool = FirecrawlScrapeWebsiteTool(url='firecrawl.dev') 30 | ``` 31 | 32 | ## Arguments 33 | 34 | - `api_key`: Optional. Specifies Firecrawl API key. Defaults is the `FIRECRAWL_API_KEY` environment variable. 35 | - `url`: The URL to scrape. 36 | - `page_options`: Optional. 37 | - `onlyMainContent`: Optional. Only return the main content of the page excluding headers, navs, footers, etc. 38 | - `includeHtml`: Optional. Include the raw HTML content of the page. Will output a html key in the response. 39 | - `extractor_options`: Optional. Options for LLM-based extraction of structured information from the page content 40 | - `mode`: The extraction mode to use, currently supports 'llm-extraction' 41 | - `extractionPrompt`: Optional. A prompt describing what information to extract from the page 42 | - `extractionSchema`: Optional. The schema for the data to be extracted 43 | - `timeout`: Optional. Timeout in milliseconds for the request 44 | -------------------------------------------------------------------------------- /docs/tools/web-scraping/firecrawlsearchtool.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Firecrawl Search 3 | description: The `FirecrawlSearchTool` is designed to search websites and convert them into clean markdown or structured data. 4 | icon: fire-flame 5 | --- 6 | 7 | # `FirecrawlSearchTool` 8 | 9 | ## Description 10 | 11 | [Firecrawl](https://firecrawl.dev) is a platform for crawling and convert any website into clean markdown or structured data. 12 | 13 | ## Installation 14 | 15 | - Get an API key from [firecrawl.dev](https://firecrawl.dev) and set it in environment variables (`FIRECRAWL_API_KEY`). 16 | - Install the [Firecrawl SDK](https://github.com/mendableai/firecrawl) along with `crewai[tools]` package: 17 | 18 | ```shell 19 | pip install firecrawl-py 'crewai[tools]' 20 | ``` 21 | 22 | ## Example 23 | 24 | Utilize the FirecrawlSearchTool as follows to allow your agent to load websites: 25 | 26 | ```python Code 27 | from crewai_tools import FirecrawlSearchTool 28 | 29 | tool = FirecrawlSearchTool(query='what is firecrawl?') 30 | ``` 31 | 32 | ## Arguments 33 | 34 | - `api_key`: Optional. Specifies Firecrawl API key. Defaults is the `FIRECRAWL_API_KEY` environment variable. 35 | - `query`: The search query string to be used for searching. 36 | - `page_options`: Optional. Options for result formatting. 37 | - `onlyMainContent`: Optional. Only return the main content of the page excluding headers, navs, footers, etc. 38 | - `includeHtml`: Optional. Include the raw HTML content of the page. Will output a html key in the response. 39 | - `fetchPageContent`: Optional. Fetch the full content of the page. 40 | - `search_options`: Optional. Options for controlling the crawling behavior. 41 | - `limit`: Optional. Maximum number of pages to crawl. -------------------------------------------------------------------------------- /docs/tools/web-scraping/scrapewebsitetool.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Scrape Website 3 | description: The `ScrapeWebsiteTool` is designed to extract and read the content of a specified website. 4 | icon: magnifying-glass-location 5 | --- 6 | 7 | # `ScrapeWebsiteTool` 8 | 9 | 10 | We are still working on improving tools, so there might be unexpected behavior or changes in the future. 11 | 12 | 13 | ## Description 14 | 15 | A tool designed to extract and read the content of a specified website. It is capable of handling various types of web pages by making HTTP requests and parsing the received HTML content. 16 | This tool can be particularly useful for web scraping tasks, data collection, or extracting specific information from websites. 17 | 18 | ## Installation 19 | 20 | Install the crewai_tools package 21 | 22 | ```shell 23 | pip install 'crewai[tools]' 24 | ``` 25 | 26 | ## Example 27 | 28 | ```python 29 | from crewai_tools import ScrapeWebsiteTool 30 | 31 | # To enable scrapping any website it finds during it's execution 32 | tool = ScrapeWebsiteTool() 33 | 34 | # Initialize the tool with the website URL, 35 | # so the agent can only scrap the content of the specified website 36 | tool = ScrapeWebsiteTool(website_url='https://www.example.com') 37 | 38 | # Extract the text from the site 39 | text = tool.run() 40 | print(text) 41 | ``` 42 | 43 | ## Arguments 44 | 45 | | Argument | Type | Description | 46 | |:---------------|:---------|:-------------------------------------------------------------------------------------------------------------------------------------| 47 | | **website_url** | `string` | **Mandatory** website URL to read the file. This is the primary input for the tool, specifying which website's content should be scraped and read. | 48 | -------------------------------------------------------------------------------- /src/crewai/__init__.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | 3 | from crewai.agent import Agent 4 | from crewai.crew import Crew 5 | from crewai.crews.crew_output import CrewOutput 6 | from crewai.flow.flow import Flow 7 | from crewai.knowledge.knowledge import Knowledge 8 | from crewai.llm import LLM 9 | from crewai.llms.base_llm import BaseLLM 10 | from crewai.process import Process 11 | from crewai.task import Task 12 | from crewai.tasks.llm_guardrail import LLMGuardrail 13 | from crewai.tasks.task_output import TaskOutput 14 | 15 | warnings.filterwarnings( 16 | "ignore", 17 | message="Pydantic serializer warnings:", 18 | category=UserWarning, 19 | module="pydantic.main", 20 | ) 21 | __version__ = "0.121.1" 22 | __all__ = [ 23 | "Agent", 24 | "Crew", 25 | "CrewOutput", 26 | "Process", 27 | "Task", 28 | "LLM", 29 | "BaseLLM", 30 | "Flow", 31 | "Knowledge", 32 | "TaskOutput", 33 | "LLMGuardrail", 34 | ] 35 | -------------------------------------------------------------------------------- /src/crewai/agents/__init__.py: -------------------------------------------------------------------------------- 1 | from .cache.cache_handler import CacheHandler 2 | from .parser import CrewAgentParser 3 | from .tools_handler import ToolsHandler 4 | 5 | __all__ = ["CacheHandler", "CrewAgentParser", "ToolsHandler"] 6 | -------------------------------------------------------------------------------- /src/crewai/agents/agent_adapters/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/agents/agent_adapters/__init__.py -------------------------------------------------------------------------------- /src/crewai/agents/agent_adapters/base_agent_adapter.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import Any, Dict, List, Optional 3 | 4 | from pydantic import PrivateAttr 5 | 6 | from crewai.agent import BaseAgent 7 | from crewai.tools import BaseTool 8 | 9 | 10 | class BaseAgentAdapter(BaseAgent, ABC): 11 | """Base class for all agent adapters in CrewAI. 12 | 13 | This abstract class defines the common interface and functionality that all 14 | agent adapters must implement. It extends BaseAgent to maintain compatibility 15 | with the CrewAI framework while adding adapter-specific requirements. 16 | """ 17 | 18 | adapted_structured_output: bool = False 19 | _agent_config: Optional[Dict[str, Any]] = PrivateAttr(default=None) 20 | 21 | model_config = {"arbitrary_types_allowed": True} 22 | 23 | def __init__(self, agent_config: Optional[Dict[str, Any]] = None, **kwargs: Any): 24 | super().__init__(adapted_agent=True, **kwargs) 25 | self._agent_config = agent_config 26 | 27 | @abstractmethod 28 | def configure_tools(self, tools: Optional[List[BaseTool]] = None) -> None: 29 | """Configure and adapt tools for the specific agent implementation. 30 | 31 | Args: 32 | tools: Optional list of BaseTool instances to be configured 33 | """ 34 | pass 35 | 36 | def configure_structured_output(self, structured_output: Any) -> None: 37 | """Configure the structured output for the specific agent implementation. 38 | 39 | Args: 40 | structured_output: The structured output to be configured 41 | """ 42 | pass 43 | -------------------------------------------------------------------------------- /src/crewai/agents/agent_adapters/base_converter_adapter.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | 3 | 4 | class BaseConverterAdapter(ABC): 5 | """Base class for all converter adapters in CrewAI. 6 | 7 | This abstract class defines the common interface and functionality that all 8 | converter adapters must implement for converting structured output. 9 | """ 10 | 11 | def __init__(self, agent_adapter): 12 | self.agent_adapter = agent_adapter 13 | 14 | @abstractmethod 15 | def configure_structured_output(self, task) -> None: 16 | """Configure agents to return structured output. 17 | Must support json and pydantic output. 18 | """ 19 | pass 20 | 21 | @abstractmethod 22 | def enhance_system_prompt(self, base_prompt: str) -> str: 23 | """Enhance the system prompt with structured output instructions.""" 24 | pass 25 | 26 | @abstractmethod 27 | def post_process_result(self, result: str) -> str: 28 | """Post-process the result to ensure it matches the expected format: string.""" 29 | pass 30 | -------------------------------------------------------------------------------- /src/crewai/agents/agent_adapters/base_tool_adapter.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import Any, List, Optional 3 | 4 | from crewai.tools.base_tool import BaseTool 5 | 6 | 7 | class BaseToolAdapter(ABC): 8 | """Base class for all tool adapters in CrewAI. 9 | 10 | This abstract class defines the common interface that all tool adapters 11 | must implement. It provides the structure for adapting CrewAI tools to 12 | different frameworks and platforms. 13 | """ 14 | 15 | original_tools: List[BaseTool] 16 | converted_tools: List[Any] 17 | 18 | def __init__(self, tools: Optional[List[BaseTool]] = None): 19 | self.original_tools = tools or [] 20 | self.converted_tools = [] 21 | 22 | @abstractmethod 23 | def configure_tools(self, tools: List[BaseTool]) -> None: 24 | """Configure and convert tools for the specific implementation. 25 | 26 | Args: 27 | tools: List of BaseTool instances to be configured and converted 28 | """ 29 | pass 30 | 31 | def tools(self) -> List[Any]: 32 | """Return all converted tools.""" 33 | return self.converted_tools 34 | 35 | def sanitize_tool_name(self, tool_name: str) -> str: 36 | """Sanitize tool name for API compatibility.""" 37 | return tool_name.replace(" ", "_") 38 | -------------------------------------------------------------------------------- /src/crewai/agents/agent_adapters/langgraph/__init__.py: -------------------------------------------------------------------------------- 1 | """LangGraph adapter for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/agents/agent_adapters/openai_agents/__init__.py: -------------------------------------------------------------------------------- 1 | """OpenAI agent adapters for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/agents/agent_builder/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/agents/agent_builder/__init__.py -------------------------------------------------------------------------------- /src/crewai/agents/agent_builder/utilities/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/agents/agent_builder/utilities/__init__.py -------------------------------------------------------------------------------- /src/crewai/agents/agent_builder/utilities/base_output_converter.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import Any, Optional 3 | 4 | from pydantic import BaseModel, Field 5 | 6 | 7 | class OutputConverter(BaseModel, ABC): 8 | """ 9 | Abstract base class for converting task results into structured formats. 10 | 11 | This class provides a framework for converting unstructured text into 12 | either Pydantic models or JSON, tailored for specific agent requirements. 13 | It uses a language model to interpret and structure the input text based 14 | on given instructions. 15 | 16 | Attributes: 17 | text (str): The input text to be converted. 18 | llm (Any): The language model used for conversion. 19 | model (Any): The target model for structuring the output. 20 | instructions (str): Specific instructions for the conversion process. 21 | max_attempts (int): Maximum number of conversion attempts (default: 3). 22 | """ 23 | 24 | text: str = Field(description="Text to be converted.") 25 | llm: Any = Field(description="The language model to be used to convert the text.") 26 | model: Any = Field(description="The model to be used to convert the text.") 27 | instructions: str = Field(description="Conversion instructions to the LLM.") 28 | max_attempts: int = Field( 29 | description="Max number of attempts to try to get the output formatted.", 30 | default=3, 31 | ) 32 | 33 | @abstractmethod 34 | def to_pydantic(self, current_attempt=1) -> BaseModel: 35 | """Convert text to pydantic.""" 36 | pass 37 | 38 | @abstractmethod 39 | def to_json(self, current_attempt=1) -> dict: 40 | """Convert text to json.""" 41 | pass 42 | -------------------------------------------------------------------------------- /src/crewai/agents/agent_builder/utilities/base_token_process.py: -------------------------------------------------------------------------------- 1 | from crewai.types.usage_metrics import UsageMetrics 2 | 3 | 4 | class TokenProcess: 5 | def __init__(self) -> None: 6 | self.total_tokens: int = 0 7 | self.prompt_tokens: int = 0 8 | self.cached_prompt_tokens: int = 0 9 | self.completion_tokens: int = 0 10 | self.successful_requests: int = 0 11 | 12 | def sum_prompt_tokens(self, tokens: int) -> None: 13 | self.prompt_tokens += tokens 14 | self.total_tokens += tokens 15 | 16 | def sum_completion_tokens(self, tokens: int) -> None: 17 | self.completion_tokens += tokens 18 | self.total_tokens += tokens 19 | 20 | def sum_cached_prompt_tokens(self, tokens: int) -> None: 21 | self.cached_prompt_tokens += tokens 22 | 23 | def sum_successful_requests(self, requests: int) -> None: 24 | self.successful_requests += requests 25 | 26 | def get_summary(self) -> UsageMetrics: 27 | return UsageMetrics( 28 | total_tokens=self.total_tokens, 29 | prompt_tokens=self.prompt_tokens, 30 | cached_prompt_tokens=self.cached_prompt_tokens, 31 | completion_tokens=self.completion_tokens, 32 | successful_requests=self.successful_requests, 33 | ) 34 | -------------------------------------------------------------------------------- /src/crewai/agents/cache/__init__.py: -------------------------------------------------------------------------------- 1 | from .cache_handler import CacheHandler 2 | 3 | __all__ = ["CacheHandler"] 4 | -------------------------------------------------------------------------------- /src/crewai/agents/cache/cache_handler.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, Optional 2 | 3 | from pydantic import BaseModel, PrivateAttr 4 | 5 | 6 | class CacheHandler(BaseModel): 7 | """Callback handler for tool usage.""" 8 | 9 | _cache: Dict[str, Any] = PrivateAttr(default_factory=dict) 10 | 11 | def add(self, tool, input, output): 12 | self._cache[f"{tool}-{input}"] = output 13 | 14 | def read(self, tool, input) -> Optional[str]: 15 | return self._cache.get(f"{tool}-{input}") 16 | -------------------------------------------------------------------------------- /src/crewai/agents/tools_handler.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Optional, Union 2 | 3 | from ..tools.cache_tools.cache_tools import CacheTools 4 | from ..tools.tool_calling import InstructorToolCalling, ToolCalling 5 | from .cache.cache_handler import CacheHandler 6 | 7 | 8 | class ToolsHandler: 9 | """Callback handler for tool usage.""" 10 | 11 | last_used_tool: ToolCalling = {} # type: ignore # BUG?: Incompatible types in assignment (expression has type "Dict[...]", variable has type "ToolCalling") 12 | cache: Optional[CacheHandler] 13 | 14 | def __init__(self, cache: Optional[CacheHandler] = None): 15 | """Initialize the callback handler.""" 16 | self.cache = cache 17 | self.last_used_tool = {} # type: ignore # BUG?: same as above 18 | 19 | def on_tool_use( 20 | self, 21 | calling: Union[ToolCalling, InstructorToolCalling], 22 | output: str, 23 | should_cache: bool = True, 24 | ) -> Any: 25 | """Run when tool ends running.""" 26 | self.last_used_tool = calling # type: ignore # BUG?: Incompatible types in assignment (expression has type "Union[ToolCalling, InstructorToolCalling]", variable has type "ToolCalling") 27 | if self.cache and should_cache and calling.tool_name != CacheTools().name: 28 | self.cache.add( 29 | tool=calling.tool_name, 30 | input=calling.arguments, 31 | output=output, 32 | ) 33 | -------------------------------------------------------------------------------- /src/crewai/cli/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/cli/__init__.py -------------------------------------------------------------------------------- /src/crewai/cli/authentication/__init__.py: -------------------------------------------------------------------------------- 1 | from .main import AuthenticationCommand 2 | 3 | __all__ = ["AuthenticationCommand"] 4 | -------------------------------------------------------------------------------- /src/crewai/cli/authentication/constants.py: -------------------------------------------------------------------------------- 1 | ALGORITHMS = ["RS256"] 2 | AUTH0_DOMAIN = "crewai.us.auth0.com" 3 | AUTH0_CLIENT_ID = "DEVC5Fw6NlRoSzmDCcOhVq85EfLBjKa8" 4 | AUTH0_AUDIENCE = "https://crewai.us.auth0.com/api/v2/" 5 | -------------------------------------------------------------------------------- /src/crewai/cli/authentication/token.py: -------------------------------------------------------------------------------- 1 | from .utils import TokenManager 2 | 3 | 4 | def get_auth_token() -> str: 5 | """Get the authentication token.""" 6 | access_token = TokenManager().get_token() 7 | if not access_token: 8 | raise Exception("No token found, make sure you are logged in") 9 | return access_token 10 | -------------------------------------------------------------------------------- /src/crewai/cli/config.py: -------------------------------------------------------------------------------- 1 | import json 2 | from pathlib import Path 3 | from typing import Optional 4 | 5 | from pydantic import BaseModel, Field 6 | 7 | DEFAULT_CONFIG_PATH = Path.home() / ".config" / "crewai" / "settings.json" 8 | 9 | 10 | class Settings(BaseModel): 11 | tool_repository_username: Optional[str] = Field( 12 | None, description="Username for interacting with the Tool Repository" 13 | ) 14 | tool_repository_password: Optional[str] = Field( 15 | None, description="Password for interacting with the Tool Repository" 16 | ) 17 | config_path: Path = Field(default=DEFAULT_CONFIG_PATH, exclude=True) 18 | 19 | def __init__(self, config_path: Path = DEFAULT_CONFIG_PATH, **data): 20 | """Load Settings from config path""" 21 | config_path.parent.mkdir(parents=True, exist_ok=True) 22 | 23 | file_data = {} 24 | if config_path.is_file(): 25 | try: 26 | with config_path.open("r") as f: 27 | file_data = json.load(f) 28 | except json.JSONDecodeError: 29 | file_data = {} 30 | 31 | merged_data = {**file_data, **data} 32 | super().__init__(config_path=config_path, **merged_data) 33 | 34 | def dump(self) -> None: 35 | """Save current settings to settings.json""" 36 | if self.config_path.is_file(): 37 | with self.config_path.open("r") as f: 38 | existing_data = json.load(f) 39 | else: 40 | existing_data = {} 41 | 42 | updated_data = {**existing_data, **self.model_dump(exclude_unset=True)} 43 | with self.config_path.open("w") as f: 44 | json.dump(updated_data, f, indent=4) 45 | -------------------------------------------------------------------------------- /src/crewai/cli/deploy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/cli/deploy/__init__.py -------------------------------------------------------------------------------- /src/crewai/cli/evaluate_crew.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | import click 4 | 5 | 6 | def evaluate_crew(n_iterations: int, model: str) -> None: 7 | """ 8 | Test and Evaluate the crew by running a command in the UV environment. 9 | 10 | Args: 11 | n_iterations (int): The number of iterations to test the crew. 12 | model (str): The model to test the crew with. 13 | """ 14 | command = ["uv", "run", "test", str(n_iterations), model] 15 | 16 | try: 17 | if n_iterations <= 0: 18 | raise ValueError("The number of iterations must be a positive integer.") 19 | 20 | result = subprocess.run(command, capture_output=False, text=True, check=True) 21 | 22 | if result.stderr: 23 | click.echo(result.stderr, err=True) 24 | 25 | except subprocess.CalledProcessError as e: 26 | click.echo(f"An error occurred while testing the crew: {e}", err=True) 27 | click.echo(e.output, err=True) 28 | 29 | except Exception as e: 30 | click.echo(f"An unexpected error occurred: {e}", err=True) 31 | -------------------------------------------------------------------------------- /src/crewai/cli/install_crew.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | import click 4 | 5 | 6 | # Be mindful about changing this. 7 | # on some environments we don't use this command but instead uv sync directly 8 | # so if you expect this to support more things you will need to replicate it there 9 | # ask @joaomdmoura if you are unsure 10 | def install_crew(proxy_options: list[str]) -> None: 11 | """ 12 | Install the crew by running the UV command to lock and install. 13 | """ 14 | try: 15 | command = ["uv", "sync"] + proxy_options 16 | subprocess.run(command, check=True, capture_output=False, text=True) 17 | 18 | except subprocess.CalledProcessError as e: 19 | click.echo(f"An error occurred while running the crew: {e}", err=True) 20 | click.echo(e.output, err=True) 21 | 22 | except Exception as e: 23 | click.echo(f"An unexpected error occurred: {e}", err=True) 24 | -------------------------------------------------------------------------------- /src/crewai/cli/kickoff_flow.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | import click 4 | 5 | 6 | def kickoff_flow() -> None: 7 | """ 8 | Kickoff the flow by running a command in the UV environment. 9 | """ 10 | command = ["uv", "run", "kickoff"] 11 | 12 | try: 13 | result = subprocess.run(command, capture_output=False, text=True, check=True) 14 | 15 | if result.stderr: 16 | click.echo(result.stderr, err=True) 17 | 18 | except subprocess.CalledProcessError as e: 19 | click.echo(f"An error occurred while running the flow: {e}", err=True) 20 | click.echo(e.output, err=True) 21 | 22 | except Exception as e: 23 | click.echo(f"An unexpected error occurred: {e}", err=True) 24 | -------------------------------------------------------------------------------- /src/crewai/cli/plot_flow.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | import click 4 | 5 | 6 | def plot_flow() -> None: 7 | """ 8 | Plot the flow by running a command in the UV environment. 9 | """ 10 | command = ["uv", "run", "plot"] 11 | 12 | try: 13 | result = subprocess.run(command, capture_output=False, text=True, check=True) 14 | 15 | if result.stderr: 16 | click.echo(result.stderr, err=True) 17 | 18 | except subprocess.CalledProcessError as e: 19 | click.echo(f"An error occurred while plotting the flow: {e}", err=True) 20 | click.echo(e.output, err=True) 21 | 22 | except Exception as e: 23 | click.echo(f"An unexpected error occurred: {e}", err=True) 24 | -------------------------------------------------------------------------------- /src/crewai/cli/replay_from_task.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | import click 4 | 5 | 6 | def replay_task_command(task_id: str) -> None: 7 | """ 8 | Replay the crew execution from a specific task. 9 | 10 | Args: 11 | task_id (str): The ID of the task to replay from. 12 | """ 13 | command = ["uv", "run", "replay", task_id] 14 | 15 | try: 16 | result = subprocess.run(command, capture_output=False, text=True, check=True) 17 | if result.stderr: 18 | click.echo(result.stderr, err=True) 19 | 20 | except subprocess.CalledProcessError as e: 21 | click.echo(f"An error occurred while replaying the task: {e}", err=True) 22 | click.echo(e.output, err=True) 23 | 24 | except Exception as e: 25 | click.echo(f"An unexpected error occurred: {e}", err=True) 26 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/cli/templates/__init__.py -------------------------------------------------------------------------------- /src/crewai/cli/templates/crew/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/crew/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/cli/templates/crew/__init__.py -------------------------------------------------------------------------------- /src/crewai/cli/templates/crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior Data Researcher 4 | goal: > 5 | Uncover cutting-edge developments in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | 11 | reporting_analyst: 12 | role: > 13 | {topic} Reporting Analyst 14 | goal: > 15 | Create detailed reports based on {topic} data analysis and research findings 16 | backstory: > 17 | You're a meticulous analyst with a keen eye for detail. You're known for 18 | your ability to turn complex data into clear and concise reports, making 19 | it easy for others to understand and act on the information you provide. -------------------------------------------------------------------------------- /src/crewai/cli/templates/crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Conduct a thorough research about {topic} 4 | Make sure you find any interesting and relevant information given 5 | the current year is {current_year}. 6 | expected_output: > 7 | A list with 10 bullet points of the most relevant information about {topic} 8 | agent: researcher 9 | 10 | reporting_task: 11 | description: > 12 | Review the context you got and expand each topic into a full section for a report. 13 | Make sure the report is detailed and contains any and all relevant information. 14 | expected_output: > 15 | A fully fledged report with the main topics, each with a full section of information. 16 | Formatted as markdown without '```' 17 | agent: reporting_analyst 18 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/crew/knowledge/user_preference.txt: -------------------------------------------------------------------------------- 1 | User name is John Doe. 2 | User is an AI Engineer. 3 | User is interested in AI Agents. 4 | User is based in San Francisco, California. 5 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/crew/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "{{folder_name}}" 3 | version = "0.1.0" 4 | description = "{{name}} using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.121.1,<1.0.0" 9 | ] 10 | 11 | [project.scripts] 12 | {{folder_name}} = "{{folder_name}}.main:run" 13 | run_crew = "{{folder_name}}.main:run" 14 | train = "{{folder_name}}.main:train" 15 | replay = "{{folder_name}}.main:replay" 16 | test = "{{folder_name}}.main:test" 17 | 18 | [build-system] 19 | requires = ["hatchling"] 20 | build-backend = "hatchling.build" 21 | 22 | [tool.crewai] 23 | type = "crew" 24 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/crew/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/cli/templates/crew/tools/__init__.py -------------------------------------------------------------------------------- /src/crewai/cli/templates/crew/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from crewai.tools import BaseTool 2 | from typing import Type 3 | from pydantic import BaseModel, Field 4 | 5 | 6 | class MyCustomToolInput(BaseModel): 7 | """Input schema for MyCustomTool.""" 8 | argument: str = Field(..., description="Description of the argument.") 9 | 10 | class MyCustomTool(BaseTool): 11 | name: str = "Name of my tool" 12 | description: str = ( 13 | "Clear description for what this tool is useful for, your agent will need this information to use it." 14 | ) 15 | args_schema: Type[BaseModel] = MyCustomToolInput 16 | 17 | def _run(self, argument: str) -> str: 18 | # Implementation goes here 19 | return "this is an example of a tool output, ignore it and move along." 20 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | __pycache__/ 3 | lib/ 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/cli/templates/flow/__init__.py -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/crews/poem_crew/__init__.py: -------------------------------------------------------------------------------- 1 | """Poem crew template.""" 2 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/crews/poem_crew/config/agents.yaml: -------------------------------------------------------------------------------- 1 | poem_writer: 2 | role: > 3 | CrewAI Poem Writer 4 | goal: > 5 | Generate a funny, light heartedpoem about how CrewAI 6 | is awesome with a sentence count of {sentence_count} 7 | backstory: > 8 | You're a creative poet with a talent for capturing the essence of any topic 9 | in a beautiful and engaging way. Known for your ability to craft poems that 10 | resonate with readers, you bring a unique perspective and artistic flair to 11 | every piece you write. 12 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/crews/poem_crew/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | write_poem: 2 | description: > 3 | Write a poem about how CrewAI is awesome. 4 | Ensure the poem is engaging and adheres to the specified sentence count of {sentence_count}. 5 | expected_output: > 6 | A beautifully crafted poem about CrewAI, with exactly {sentence_count} sentences. 7 | agent: poem_writer 8 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/main.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from random import randint 3 | 4 | from pydantic import BaseModel 5 | 6 | from crewai.flow import Flow, listen, start 7 | 8 | from {{folder_name}}.crews.poem_crew.poem_crew import PoemCrew 9 | 10 | 11 | class PoemState(BaseModel): 12 | sentence_count: int = 1 13 | poem: str = "" 14 | 15 | 16 | class PoemFlow(Flow[PoemState]): 17 | 18 | @start() 19 | def generate_sentence_count(self): 20 | print("Generating sentence count") 21 | self.state.sentence_count = randint(1, 5) 22 | 23 | @listen(generate_sentence_count) 24 | def generate_poem(self): 25 | print("Generating poem") 26 | result = ( 27 | PoemCrew() 28 | .crew() 29 | .kickoff(inputs={"sentence_count": self.state.sentence_count}) 30 | ) 31 | 32 | print("Poem generated", result.raw) 33 | self.state.poem = result.raw 34 | 35 | @listen(generate_poem) 36 | def save_poem(self): 37 | print("Saving poem") 38 | with open("poem.txt", "w") as f: 39 | f.write(self.state.poem) 40 | 41 | 42 | def kickoff(): 43 | poem_flow = PoemFlow() 44 | poem_flow.kickoff() 45 | 46 | 47 | def plot(): 48 | poem_flow = PoemFlow() 49 | poem_flow.plot() 50 | 51 | 52 | if __name__ == "__main__": 53 | kickoff() 54 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "{{folder_name}}" 3 | version = "0.1.0" 4 | description = "{{name}} using crewAI" 5 | authors = [{ name = "Your Name", email = "you@example.com" }] 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.121.1,<1.0.0", 9 | ] 10 | 11 | [project.scripts] 12 | kickoff = "{{folder_name}}.main:kickoff" 13 | run_crew = "{{folder_name}}.main:kickoff" 14 | plot = "{{folder_name}}.main:plot" 15 | 16 | [build-system] 17 | requires = ["hatchling"] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.crewai] 21 | type = "flow" 22 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/cli/templates/flow/tools/__init__.py -------------------------------------------------------------------------------- /src/crewai/cli/templates/flow/tools/custom_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Type 2 | 3 | from crewai.tools import BaseTool 4 | from pydantic import BaseModel, Field 5 | 6 | 7 | class MyCustomToolInput(BaseModel): 8 | """Input schema for MyCustomTool.""" 9 | 10 | argument: str = Field(..., description="Description of the argument.") 11 | 12 | 13 | class MyCustomTool(BaseTool): 14 | name: str = "Name of my tool" 15 | description: str = ( 16 | "Clear description for what this tool is useful for, your agent will need this information to use it." 17 | ) 18 | args_schema: Type[BaseModel] = MyCustomToolInput 19 | 20 | def _run(self, argument: str) -> str: 21 | # Implementation goes here 22 | return "this is an example of a tool output, ignore it and move along." 23 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/tool/.gitignore: -------------------------------------------------------------------------------- 1 | # Python-generated files 2 | __pycache__/ 3 | *.py[oc] 4 | build/ 5 | dist/ 6 | wheels/ 7 | *.egg-info 8 | 9 | # Virtual environments 10 | .venv 11 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/tool/README.md: -------------------------------------------------------------------------------- 1 | # {{folder_name}} 2 | 3 | {{folder_name}} is a CrewAI Tool. This template is designed to help you create 4 | custom tools to power up your crews. 5 | 6 | ## Installing 7 | 8 | Ensure you have Python >=3.10 <3.13 installed on your system. This project 9 | uses [UV](https://docs.astral.sh/uv/) for dependency management and package 10 | handling, offering a seamless setup and execution experience. 11 | 12 | First, if you haven't already, install `uv`: 13 | 14 | ```bash 15 | pip install uv 16 | ``` 17 | 18 | Next, navigate to your project directory and install the dependencies with: 19 | 20 | ```bash 21 | crewai install 22 | ``` 23 | 24 | ## Publishing 25 | 26 | Collaborate by sharing tools within your organization, or publish them publicly 27 | to contribute with the community. 28 | 29 | ```bash 30 | crewai tool publish {{tool_name}} 31 | ``` 32 | 33 | Others may install your tool in their crews running: 34 | 35 | ```bash 36 | crewai tool install {{tool_name}} 37 | ``` 38 | 39 | ## Support 40 | 41 | For support, questions, or feedback regarding the {{crew_name}} tool or CrewAI. 42 | 43 | - Visit our [documentation](https://docs.crewai.com) 44 | - Reach out to us through our [GitHub repository](https://github.com/joaomdmoura/crewai) 45 | - [Join our Discord](https://discord.com/invite/X4JWnZnxPb) 46 | - [Chat with our docs](https://chatg.pt/DWjSBZn) 47 | 48 | Let's create wonders together with the power and simplicity of crewAI. 49 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/tool/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "{{folder_name}}" 3 | version = "0.1.0" 4 | description = "Power up your crews with {{folder_name}}" 5 | readme = "README.md" 6 | requires-python = ">=3.10,<3.13" 7 | dependencies = [ 8 | "crewai[tools]>=0.121.1" 9 | ] 10 | 11 | [tool.crewai] 12 | type = "tool" 13 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/tool/src/{{folder_name}}/__init__.py: -------------------------------------------------------------------------------- 1 | from .tool import {{class_name}} 2 | 3 | __all__ = ["{{class_name}}"] 4 | -------------------------------------------------------------------------------- /src/crewai/cli/templates/tool/src/{{folder_name}}/tool.py: -------------------------------------------------------------------------------- 1 | from crewai.tools import BaseTool 2 | 3 | 4 | class {{class_name}}(BaseTool): 5 | name: str = "Name of my tool" 6 | description: str = "What this tool does. It's vital for effective utilization." 7 | 8 | def _run(self, argument: str) -> str: 9 | # Your tool's logic here 10 | return "Tool's result" 11 | -------------------------------------------------------------------------------- /src/crewai/cli/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/cli/tools/__init__.py -------------------------------------------------------------------------------- /src/crewai/cli/train_crew.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | import click 4 | 5 | 6 | def train_crew(n_iterations: int, filename: str) -> None: 7 | """ 8 | Train the crew by running a command in the UV environment. 9 | 10 | Args: 11 | n_iterations (int): The number of iterations to train the crew. 12 | """ 13 | command = ["uv", "run", "train", str(n_iterations), filename] 14 | 15 | try: 16 | if n_iterations <= 0: 17 | raise ValueError("The number of iterations must be a positive integer.") 18 | 19 | if not filename.endswith(".pkl"): 20 | raise ValueError("The filename must not end with .pkl") 21 | 22 | result = subprocess.run(command, capture_output=False, text=True, check=True) 23 | 24 | if result.stderr: 25 | click.echo(result.stderr, err=True) 26 | 27 | except subprocess.CalledProcessError as e: 28 | click.echo(f"An error occurred while training the crew: {e}", err=True) 29 | click.echo(e.output, err=True) 30 | 31 | except Exception as e: 32 | click.echo(f"An unexpected error occurred: {e}", err=True) 33 | -------------------------------------------------------------------------------- /src/crewai/cli/version.py: -------------------------------------------------------------------------------- 1 | import importlib.metadata 2 | 3 | 4 | def get_crewai_version() -> str: 5 | """Get the version number of CrewAI running the CLI""" 6 | return importlib.metadata.version("crewai") 7 | -------------------------------------------------------------------------------- /src/crewai/crews/__init__.py: -------------------------------------------------------------------------------- 1 | from .crew_output import CrewOutput 2 | 3 | __all__ = ["CrewOutput"] 4 | -------------------------------------------------------------------------------- /src/crewai/flow/__init__.py: -------------------------------------------------------------------------------- 1 | from crewai.flow.flow import Flow, start, listen, or_, and_, router 2 | from crewai.flow.persistence import persist 3 | 4 | __all__ = ["Flow", "start", "listen", "or_", "and_", "router", "persist"] 5 | 6 | -------------------------------------------------------------------------------- /src/crewai/flow/config.py: -------------------------------------------------------------------------------- 1 | DARK_GRAY = "#333333" 2 | CREWAI_ORANGE = "#FF5A50" 3 | GRAY = "#666666" 4 | WHITE = "#FFFFFF" 5 | BLACK = "#000000" 6 | 7 | COLORS = { 8 | "bg": WHITE, 9 | "start": CREWAI_ORANGE, 10 | "method": DARK_GRAY, 11 | "router": DARK_GRAY, 12 | "router_border": CREWAI_ORANGE, 13 | "edge": GRAY, 14 | "router_edge": CREWAI_ORANGE, 15 | "text": WHITE, 16 | } 17 | 18 | NODE_STYLES = { 19 | "start": { 20 | "color": CREWAI_ORANGE, 21 | "shape": "box", 22 | "font": {"color": WHITE}, 23 | "margin": {"top": 10, "bottom": 8, "left": 10, "right": 10}, 24 | }, 25 | "method": { 26 | "color": DARK_GRAY, 27 | "shape": "box", 28 | "font": {"color": WHITE}, 29 | "margin": {"top": 10, "bottom": 8, "left": 10, "right": 10}, 30 | }, 31 | "router": { 32 | "color": { 33 | "background": DARK_GRAY, 34 | "border": CREWAI_ORANGE, 35 | "highlight": { 36 | "border": CREWAI_ORANGE, 37 | "background": DARK_GRAY, 38 | }, 39 | }, 40 | "shape": "box", 41 | "font": {"color": WHITE}, 42 | "borderWidth": 3, 43 | "borderWidthSelected": 4, 44 | "shapeProperties": {"borderDashes": [5, 5]}, 45 | "margin": {"top": 10, "bottom": 8, "left": 10, "right": 10}, 46 | }, 47 | "crew": { 48 | "color": { 49 | "background": WHITE, 50 | "border": CREWAI_ORANGE, 51 | }, 52 | "shape": "box", 53 | "font": {"color": BLACK}, 54 | "borderWidth": 3, 55 | "borderWidthSelected": 4, 56 | "shapeProperties": {"borderDashes": False}, 57 | "margin": {"top": 10, "bottom": 8, "left": 10, "right": 10}, 58 | }, 59 | } 60 | -------------------------------------------------------------------------------- /src/crewai/flow/flow_trackable.py: -------------------------------------------------------------------------------- 1 | import inspect 2 | from typing import Optional 3 | 4 | from pydantic import BaseModel, Field, InstanceOf, model_validator 5 | 6 | from crewai.flow import Flow 7 | 8 | 9 | class FlowTrackable(BaseModel): 10 | """Mixin that tracks the Flow instance that instantiated the object, e.g. a 11 | Flow instance that created a Crew or Agent. 12 | 13 | Automatically finds and stores a reference to the parent Flow instance by 14 | inspecting the call stack. 15 | """ 16 | 17 | parent_flow: Optional[InstanceOf[Flow]] = Field( 18 | default=None, 19 | description="The parent flow of the instance, if it was created inside a flow.", 20 | ) 21 | 22 | @model_validator(mode="after") 23 | def _set_parent_flow(self, max_depth: int = 5) -> "FlowTrackable": 24 | frame = inspect.currentframe() 25 | 26 | try: 27 | if frame is None: 28 | return self 29 | 30 | frame = frame.f_back 31 | for _ in range(max_depth): 32 | if frame is None: 33 | break 34 | 35 | candidate = frame.f_locals.get("self") 36 | if isinstance(candidate, Flow): 37 | self.parent_flow = candidate 38 | break 39 | 40 | frame = frame.f_back 41 | finally: 42 | del frame 43 | 44 | return self 45 | -------------------------------------------------------------------------------- /src/crewai/flow/persistence/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | CrewAI Flow Persistence. 3 | 4 | This module provides interfaces and implementations for persisting flow states. 5 | """ 6 | 7 | from typing import Any, Dict, TypeVar, Union 8 | 9 | from pydantic import BaseModel 10 | 11 | from crewai.flow.persistence.base import FlowPersistence 12 | from crewai.flow.persistence.decorators import persist 13 | from crewai.flow.persistence.sqlite import SQLiteFlowPersistence 14 | 15 | __all__ = ["FlowPersistence", "persist", "SQLiteFlowPersistence"] 16 | 17 | StateType = TypeVar('StateType', bound=Union[Dict[str, Any], BaseModel]) 18 | DictStateType = Dict[str, Any] 19 | -------------------------------------------------------------------------------- /src/crewai/flow/persistence/base.py: -------------------------------------------------------------------------------- 1 | """Base class for flow state persistence.""" 2 | 3 | import abc 4 | from typing import Any, Dict, Optional, Union 5 | 6 | from pydantic import BaseModel 7 | 8 | 9 | class FlowPersistence(abc.ABC): 10 | """Abstract base class for flow state persistence. 11 | 12 | This class defines the interface that all persistence implementations must follow. 13 | It supports both structured (Pydantic BaseModel) and unstructured (dict) states. 14 | """ 15 | 16 | @abc.abstractmethod 17 | def init_db(self) -> None: 18 | """Initialize the persistence backend. 19 | 20 | This method should handle any necessary setup, such as: 21 | - Creating tables 22 | - Establishing connections 23 | - Setting up indexes 24 | """ 25 | pass 26 | 27 | @abc.abstractmethod 28 | def save_state( 29 | self, 30 | flow_uuid: str, 31 | method_name: str, 32 | state_data: Union[Dict[str, Any], BaseModel] 33 | ) -> None: 34 | """Persist the flow state after method completion. 35 | 36 | Args: 37 | flow_uuid: Unique identifier for the flow instance 38 | method_name: Name of the method that just completed 39 | state_data: Current state data (either dict or Pydantic model) 40 | """ 41 | pass 42 | 43 | @abc.abstractmethod 44 | def load_state(self, flow_uuid: str) -> Optional[Dict[str, Any]]: 45 | """Load the most recent state for a given flow UUID. 46 | 47 | Args: 48 | flow_uuid: Unique identifier for the flow instance 49 | 50 | Returns: 51 | The most recent state as a dictionary, or None if no state exists 52 | """ 53 | pass 54 | -------------------------------------------------------------------------------- /src/crewai/knowledge/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/knowledge/__init__.py -------------------------------------------------------------------------------- /src/crewai/knowledge/embedder/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/knowledge/embedder/__init__.py -------------------------------------------------------------------------------- /src/crewai/knowledge/embedder/base_embedder.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import List 3 | 4 | import numpy as np 5 | 6 | 7 | class BaseEmbedder(ABC): 8 | """ 9 | Abstract base class for text embedding models 10 | """ 11 | 12 | @abstractmethod 13 | def embed_chunks(self, chunks: List[str]) -> np.ndarray: 14 | """ 15 | Generate embeddings for a list of text chunks 16 | 17 | Args: 18 | chunks: List of text chunks to embed 19 | 20 | Returns: 21 | Array of embeddings 22 | """ 23 | pass 24 | 25 | @abstractmethod 26 | def embed_texts(self, texts: List[str]) -> np.ndarray: 27 | """ 28 | Generate embeddings for a list of texts 29 | 30 | Args: 31 | texts: List of texts to embed 32 | 33 | Returns: 34 | Array of embeddings 35 | """ 36 | pass 37 | 38 | @abstractmethod 39 | def embed_text(self, text: str) -> np.ndarray: 40 | """ 41 | Generate embedding for a single text 42 | 43 | Args: 44 | text: Text to embed 45 | 46 | Returns: 47 | Embedding array 48 | """ 49 | pass 50 | 51 | @property 52 | @abstractmethod 53 | def dimension(self) -> int: 54 | """Get the dimension of the embeddings""" 55 | pass 56 | -------------------------------------------------------------------------------- /src/crewai/knowledge/knowledge_config.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel, Field 2 | 3 | 4 | class KnowledgeConfig(BaseModel): 5 | """Configuration for knowledge retrieval. 6 | 7 | Args: 8 | results_limit (int): The number of relevant documents to return. 9 | score_threshold (float): The minimum score for a document to be considered relevant. 10 | """ 11 | 12 | results_limit: int = Field(default=3, description="The number of results to return") 13 | score_threshold: float = Field( 14 | default=0.35, 15 | description="The minimum score for a result to be considered relevant", 16 | ) 17 | -------------------------------------------------------------------------------- /src/crewai/knowledge/source/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/knowledge/source/__init__.py -------------------------------------------------------------------------------- /src/crewai/knowledge/source/csv_knowledge_source.py: -------------------------------------------------------------------------------- 1 | import csv 2 | from pathlib import Path 3 | from typing import Dict, List 4 | 5 | from crewai.knowledge.source.base_file_knowledge_source import BaseFileKnowledgeSource 6 | 7 | 8 | class CSVKnowledgeSource(BaseFileKnowledgeSource): 9 | """A knowledge source that stores and queries CSV file content using embeddings.""" 10 | 11 | def load_content(self) -> Dict[Path, str]: 12 | """Load and preprocess CSV file content.""" 13 | content_dict = {} 14 | for file_path in self.safe_file_paths: 15 | with open(file_path, "r", encoding="utf-8") as csvfile: 16 | reader = csv.reader(csvfile) 17 | content = "" 18 | for row in reader: 19 | content += " ".join(row) + "\n" 20 | content_dict[file_path] = content 21 | return content_dict 22 | 23 | def add(self) -> None: 24 | """ 25 | Add CSV file content to the knowledge source, chunk it, compute embeddings, 26 | and save the embeddings. 27 | """ 28 | content_str = ( 29 | str(self.content) if isinstance(self.content, dict) else self.content 30 | ) 31 | new_chunks = self._chunk_text(content_str) 32 | self.chunks.extend(new_chunks) 33 | self._save_documents() 34 | 35 | def _chunk_text(self, text: str) -> List[str]: 36 | """Utility method to split text into chunks.""" 37 | return [ 38 | text[i : i + self.chunk_size] 39 | for i in range(0, len(text), self.chunk_size - self.chunk_overlap) 40 | ] 41 | -------------------------------------------------------------------------------- /src/crewai/knowledge/source/string_knowledge_source.py: -------------------------------------------------------------------------------- 1 | from typing import List, Optional 2 | 3 | from pydantic import Field 4 | 5 | from crewai.knowledge.source.base_knowledge_source import BaseKnowledgeSource 6 | 7 | 8 | class StringKnowledgeSource(BaseKnowledgeSource): 9 | """A knowledge source that stores and queries plain text content using embeddings.""" 10 | 11 | content: str = Field(...) 12 | collection_name: Optional[str] = Field(default=None) 13 | 14 | def model_post_init(self, _): 15 | """Post-initialization method to validate content.""" 16 | self.validate_content() 17 | 18 | def validate_content(self): 19 | """Validate string content.""" 20 | if not isinstance(self.content, str): 21 | raise ValueError("StringKnowledgeSource only accepts string content") 22 | 23 | def add(self) -> None: 24 | """Add string content to the knowledge source, chunk it, compute embeddings, and save them.""" 25 | new_chunks = self._chunk_text(self.content) 26 | self.chunks.extend(new_chunks) 27 | self._save_documents() 28 | 29 | def _chunk_text(self, text: str) -> List[str]: 30 | """Utility method to split text into chunks.""" 31 | return [ 32 | text[i : i + self.chunk_size] 33 | for i in range(0, len(text), self.chunk_size - self.chunk_overlap) 34 | ] 35 | -------------------------------------------------------------------------------- /src/crewai/knowledge/source/text_file_knowledge_source.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | from typing import Dict, List 3 | 4 | from crewai.knowledge.source.base_file_knowledge_source import BaseFileKnowledgeSource 5 | 6 | 7 | class TextFileKnowledgeSource(BaseFileKnowledgeSource): 8 | """A knowledge source that stores and queries text file content using embeddings.""" 9 | 10 | def load_content(self) -> Dict[Path, str]: 11 | """Load and preprocess text file content.""" 12 | content = {} 13 | for path in self.safe_file_paths: 14 | path = self.convert_to_path(path) 15 | with open(path, "r", encoding="utf-8") as f: 16 | content[path] = f.read() 17 | return content 18 | 19 | def add(self) -> None: 20 | """ 21 | Add text file content to the knowledge source, chunk it, compute embeddings, 22 | and save the embeddings. 23 | """ 24 | for _, text in self.content.items(): 25 | new_chunks = self._chunk_text(text) 26 | self.chunks.extend(new_chunks) 27 | self._save_documents() 28 | 29 | def _chunk_text(self, text: str) -> List[str]: 30 | """Utility method to split text into chunks.""" 31 | return [ 32 | text[i : i + self.chunk_size] 33 | for i in range(0, len(text), self.chunk_size - self.chunk_overlap) 34 | ] 35 | -------------------------------------------------------------------------------- /src/crewai/knowledge/storage/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/knowledge/storage/__init__.py -------------------------------------------------------------------------------- /src/crewai/knowledge/storage/base_knowledge_storage.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from typing import Any, Dict, List, Optional 3 | 4 | 5 | class BaseKnowledgeStorage(ABC): 6 | """Abstract base class for knowledge storage implementations.""" 7 | 8 | @abstractmethod 9 | def search( 10 | self, 11 | query: List[str], 12 | limit: int = 3, 13 | filter: Optional[dict] = None, 14 | score_threshold: float = 0.35, 15 | ) -> List[Dict[str, Any]]: 16 | """Search for documents in the knowledge base.""" 17 | pass 18 | 19 | @abstractmethod 20 | def save( 21 | self, documents: List[str], metadata: Dict[str, Any] | List[Dict[str, Any]] 22 | ) -> None: 23 | """Save documents to the knowledge base.""" 24 | pass 25 | 26 | @abstractmethod 27 | def reset(self) -> None: 28 | """Reset the knowledge base.""" 29 | pass 30 | -------------------------------------------------------------------------------- /src/crewai/knowledge/utils/__init__.py: -------------------------------------------------------------------------------- 1 | """Knowledge utilities for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/knowledge/utils/knowledge_utils.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List 2 | 3 | 4 | def extract_knowledge_context(knowledge_snippets: List[Dict[str, Any]]) -> str: 5 | """Extract knowledge from the task prompt.""" 6 | valid_snippets = [ 7 | result["context"] 8 | for result in knowledge_snippets 9 | if result and result.get("context") 10 | ] 11 | snippet = "\n".join(valid_snippets) 12 | return f"Additional Information: {snippet}" if valid_snippets else "" 13 | -------------------------------------------------------------------------------- /src/crewai/llms/__init__.py: -------------------------------------------------------------------------------- 1 | """LLM implementations for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/llms/third_party/__init__.py: -------------------------------------------------------------------------------- 1 | """Third-party LLM implementations for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/llms/third_party/ai_suite.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List, Optional, Union 2 | 3 | import aisuite as ai 4 | 5 | from crewai.llms.base_llm import BaseLLM 6 | 7 | 8 | class AISuiteLLM(BaseLLM): 9 | def __init__(self, model: str, temperature: Optional[float] = None, **kwargs): 10 | super().__init__(model, temperature, **kwargs) 11 | self.client = ai.Client() 12 | 13 | def call( 14 | self, 15 | messages: Union[str, List[Dict[str, str]]], 16 | tools: Optional[List[dict]] = None, 17 | callbacks: Optional[List[Any]] = None, 18 | available_functions: Optional[Dict[str, Any]] = None, 19 | ) -> Union[str, Any]: 20 | completion_params = self._prepare_completion_params(messages, tools) 21 | response = self.client.chat.completions.create(**completion_params) 22 | 23 | return response.choices[0].message.content 24 | 25 | def _prepare_completion_params( 26 | self, 27 | messages: Union[str, List[Dict[str, str]]], 28 | tools: Optional[List[dict]] = None, 29 | ) -> Dict[str, Any]: 30 | return { 31 | "model": self.model, 32 | "messages": messages, 33 | "temperature": self.temperature, 34 | "tools": tools, 35 | } 36 | 37 | def supports_function_calling(self) -> bool: 38 | return False 39 | -------------------------------------------------------------------------------- /src/crewai/memory/__init__.py: -------------------------------------------------------------------------------- 1 | from .entity.entity_memory import EntityMemory 2 | from .long_term.long_term_memory import LongTermMemory 3 | from .short_term.short_term_memory import ShortTermMemory 4 | from .user.user_memory import UserMemory 5 | from .external.external_memory import ExternalMemory 6 | 7 | __all__ = [ 8 | "UserMemory", 9 | "EntityMemory", 10 | "LongTermMemory", 11 | "ShortTermMemory", 12 | "ExternalMemory", 13 | ] 14 | -------------------------------------------------------------------------------- /src/crewai/memory/contextual/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/memory/contextual/__init__.py -------------------------------------------------------------------------------- /src/crewai/memory/entity/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/memory/entity/__init__.py -------------------------------------------------------------------------------- /src/crewai/memory/entity/entity_memory_item.py: -------------------------------------------------------------------------------- 1 | class EntityMemoryItem: 2 | def __init__( 3 | self, 4 | name: str, 5 | type: str, 6 | description: str, 7 | relationships: str, 8 | ): 9 | self.name = name 10 | self.type = type 11 | self.description = description 12 | self.metadata = {"relationships": relationships} 13 | -------------------------------------------------------------------------------- /src/crewai/memory/external/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/memory/external/__init__.py -------------------------------------------------------------------------------- /src/crewai/memory/external/external_memory_item.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, Optional 2 | 3 | 4 | class ExternalMemoryItem: 5 | def __init__( 6 | self, 7 | value: Any, 8 | metadata: Optional[Dict[str, Any]] = None, 9 | agent: Optional[str] = None, 10 | ): 11 | self.value = value 12 | self.metadata = metadata 13 | self.agent = agent 14 | -------------------------------------------------------------------------------- /src/crewai/memory/long_term/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/memory/long_term/__init__.py -------------------------------------------------------------------------------- /src/crewai/memory/long_term/long_term_memory.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List 2 | 3 | from crewai.memory.long_term.long_term_memory_item import LongTermMemoryItem 4 | from crewai.memory.memory import Memory 5 | from crewai.memory.storage.ltm_sqlite_storage import LTMSQLiteStorage 6 | 7 | 8 | class LongTermMemory(Memory): 9 | """ 10 | LongTermMemory class for managing cross runs data related to overall crew's 11 | execution and performance. 12 | Inherits from the Memory class and utilizes an instance of a class that 13 | adheres to the Storage for data storage, specifically working with 14 | LongTermMemoryItem instances. 15 | """ 16 | 17 | def __init__(self, storage=None, path=None): 18 | if not storage: 19 | storage = LTMSQLiteStorage(db_path=path) if path else LTMSQLiteStorage() 20 | super().__init__(storage=storage) 21 | 22 | def save(self, item: LongTermMemoryItem) -> None: # type: ignore # BUG?: Signature of "save" incompatible with supertype "Memory" 23 | metadata = item.metadata 24 | metadata.update({"agent": item.agent, "expected_output": item.expected_output}) 25 | self.storage.save( # type: ignore # BUG?: Unexpected keyword argument "task_description","score","datetime" for "save" of "Storage" 26 | task_description=item.task, 27 | score=metadata["quality"], 28 | metadata=metadata, 29 | datetime=item.datetime, 30 | ) 31 | 32 | def search(self, task: str, latest_n: int = 3) -> List[Dict[str, Any]]: # type: ignore # signature of "search" incompatible with supertype "Memory" 33 | return self.storage.load(task, latest_n) # type: ignore # BUG?: "Storage" has no attribute "load" 34 | 35 | def reset(self) -> None: 36 | self.storage.reset() 37 | -------------------------------------------------------------------------------- /src/crewai/memory/long_term/long_term_memory_item.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, Optional, Union 2 | 3 | 4 | class LongTermMemoryItem: 5 | def __init__( 6 | self, 7 | agent: str, 8 | task: str, 9 | expected_output: str, 10 | datetime: str, 11 | quality: Optional[Union[int, float]] = None, 12 | metadata: Optional[Dict[str, Any]] = None, 13 | ): 14 | self.task = task 15 | self.agent = agent 16 | self.quality = quality 17 | self.datetime = datetime 18 | self.expected_output = expected_output 19 | self.metadata = metadata if metadata is not None else {} 20 | -------------------------------------------------------------------------------- /src/crewai/memory/memory.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List, Optional 2 | 3 | from pydantic import BaseModel 4 | 5 | 6 | class Memory(BaseModel): 7 | """ 8 | Base class for memory, now supporting agent tags and generic metadata. 9 | """ 10 | 11 | embedder_config: Optional[Dict[str, Any]] = None 12 | crew: Optional[Any] = None 13 | 14 | storage: Any 15 | 16 | def __init__(self, storage: Any, **data: Any): 17 | super().__init__(storage=storage, **data) 18 | 19 | def save( 20 | self, 21 | value: Any, 22 | metadata: Optional[Dict[str, Any]] = None, 23 | agent: Optional[str] = None, 24 | ) -> None: 25 | metadata = metadata or {} 26 | if agent: 27 | metadata["agent"] = agent 28 | 29 | self.storage.save(value, metadata) 30 | 31 | def search( 32 | self, 33 | query: str, 34 | limit: int = 3, 35 | score_threshold: float = 0.35, 36 | ) -> List[Any]: 37 | return self.storage.search( 38 | query=query, limit=limit, score_threshold=score_threshold 39 | ) 40 | 41 | def set_crew(self, crew: Any) -> "Memory": 42 | self.crew = crew 43 | return self 44 | -------------------------------------------------------------------------------- /src/crewai/memory/short_term/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/memory/short_term/__init__.py -------------------------------------------------------------------------------- /src/crewai/memory/short_term/short_term_memory_item.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, Optional 2 | 3 | 4 | class ShortTermMemoryItem: 5 | def __init__( 6 | self, 7 | data: Any, 8 | agent: Optional[str] = None, 9 | metadata: Optional[Dict[str, Any]] = None, 10 | ): 11 | self.data = data 12 | self.agent = agent 13 | self.metadata = metadata if metadata is not None else {} 14 | -------------------------------------------------------------------------------- /src/crewai/memory/storage/__init__.py: -------------------------------------------------------------------------------- 1 | """Memory storage implementations for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/memory/storage/interface.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List 2 | 3 | 4 | class Storage: 5 | """Abstract base class defining the storage interface""" 6 | 7 | def save(self, value: Any, metadata: Dict[str, Any]) -> None: 8 | pass 9 | 10 | def search( 11 | self, query: str, limit: int, score_threshold: float 12 | ) -> Dict[str, Any] | List[Any]: 13 | return {} 14 | 15 | def reset(self) -> None: 16 | pass 17 | -------------------------------------------------------------------------------- /src/crewai/memory/user/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/memory/user/__init__.py -------------------------------------------------------------------------------- /src/crewai/memory/user/user_memory_item.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, Optional 2 | 3 | 4 | class UserMemoryItem: 5 | def __init__(self, data: Any, user: str, metadata: Optional[Dict[str, Any]] = None): 6 | self.data = data 7 | self.user = user 8 | self.metadata = metadata if metadata is not None else {} 9 | -------------------------------------------------------------------------------- /src/crewai/process.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class Process(str, Enum): 5 | """ 6 | Class representing the different processes that can be used to tackle tasks 7 | """ 8 | 9 | sequential = "sequential" 10 | hierarchical = "hierarchical" 11 | # TODO: consensual = 'consensual' 12 | -------------------------------------------------------------------------------- /src/crewai/project/__init__.py: -------------------------------------------------------------------------------- 1 | from .annotations import ( 2 | after_kickoff, 3 | agent, 4 | before_kickoff, 5 | cache_handler, 6 | callback, 7 | crew, 8 | llm, 9 | output_json, 10 | output_pydantic, 11 | task, 12 | tool, 13 | ) 14 | from .crew_base import CrewBase 15 | 16 | __all__ = [ 17 | "agent", 18 | "crew", 19 | "task", 20 | "output_json", 21 | "output_pydantic", 22 | "tool", 23 | "callback", 24 | "CrewBase", 25 | "llm", 26 | "cache_handler", 27 | "before_kickoff", 28 | "after_kickoff", 29 | ] 30 | -------------------------------------------------------------------------------- /src/crewai/project/utils.py: -------------------------------------------------------------------------------- 1 | from functools import wraps 2 | 3 | 4 | def memoize(func): 5 | cache = {} 6 | 7 | @wraps(func) 8 | def memoized_func(*args, **kwargs): 9 | key = (args, tuple(kwargs.items())) 10 | if key not in cache: 11 | cache[key] = func(*args, **kwargs) 12 | return cache[key] 13 | 14 | return memoized_func 15 | -------------------------------------------------------------------------------- /src/crewai/security/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | CrewAI security module. 3 | 4 | This module provides security-related functionality for CrewAI, including: 5 | - Fingerprinting for component identity and tracking 6 | - Security configuration for controlling access and permissions 7 | - Future: authentication, scoping, and delegation mechanisms 8 | """ 9 | 10 | from crewai.security.fingerprint import Fingerprint 11 | from crewai.security.security_config import SecurityConfig 12 | 13 | __all__ = ["Fingerprint", "SecurityConfig"] 14 | -------------------------------------------------------------------------------- /src/crewai/tasks/__init__.py: -------------------------------------------------------------------------------- 1 | from crewai.tasks.output_format import OutputFormat 2 | from crewai.tasks.task_output import TaskOutput 3 | 4 | __all__ = ["OutputFormat", "TaskOutput"] 5 | -------------------------------------------------------------------------------- /src/crewai/tasks/conditional_task.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Callable 2 | 3 | from pydantic import Field 4 | 5 | from crewai.task import Task 6 | from crewai.tasks.output_format import OutputFormat 7 | from crewai.tasks.task_output import TaskOutput 8 | 9 | 10 | class ConditionalTask(Task): 11 | """ 12 | A task that can be conditionally executed based on the output of another task. 13 | Note: This cannot be the only task you have in your crew and cannot be the first since its needs context from the previous task. 14 | """ 15 | 16 | condition: Callable[[TaskOutput], bool] = Field( 17 | default=None, 18 | description="Maximum number of retries for an agent to execute a task when an error occurs.", 19 | ) 20 | 21 | def __init__( 22 | self, 23 | condition: Callable[[Any], bool], 24 | **kwargs, 25 | ): 26 | super().__init__(**kwargs) 27 | self.condition = condition 28 | 29 | def should_execute(self, context: TaskOutput) -> bool: 30 | """ 31 | Determines whether the conditional task should be executed based on the provided context. 32 | 33 | Args: 34 | context (Any): The context or output from the previous task that will be evaluated by the condition. 35 | 36 | Returns: 37 | bool: True if the task should be executed, False otherwise. 38 | """ 39 | return self.condition(context) 40 | 41 | def get_skipped_task_output(self): 42 | return TaskOutput( 43 | description=self.description, 44 | raw="", 45 | agent=self.agent.role if self.agent else "", 46 | output_format=OutputFormat.RAW, 47 | ) 48 | -------------------------------------------------------------------------------- /src/crewai/tasks/output_format.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class OutputFormat(str, Enum): 5 | """Enum that represents the output format of a task.""" 6 | 7 | JSON = "json" 8 | PYDANTIC = "pydantic" 9 | RAW = "raw" 10 | -------------------------------------------------------------------------------- /src/crewai/telemetry/__init__.py: -------------------------------------------------------------------------------- 1 | from .telemetry import Telemetry 2 | 3 | __all__ = ["Telemetry"] 4 | -------------------------------------------------------------------------------- /src/crewai/telemetry/constants.py: -------------------------------------------------------------------------------- 1 | CREWAI_TELEMETRY_BASE_URL: str = "https://telemetry.crewai.com:4319" 2 | CREWAI_TELEMETRY_SERVICE_NAME: str = "crewAI-telemetry" 3 | -------------------------------------------------------------------------------- /src/crewai/tools/__init__.py: -------------------------------------------------------------------------------- 1 | from .base_tool import BaseTool, tool, EnvVar 2 | 3 | __all__ = [ 4 | "BaseTool", 5 | "tool", 6 | "EnvVar", 7 | ] -------------------------------------------------------------------------------- /src/crewai/tools/agent_tools/__init__.py: -------------------------------------------------------------------------------- 1 | """Agent tools for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/tools/agent_tools/add_image_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Dict, Optional, Union 2 | 3 | from pydantic import BaseModel, Field 4 | 5 | from crewai.tools.base_tool import BaseTool 6 | from crewai.utilities import I18N 7 | 8 | i18n = I18N() 9 | 10 | 11 | class AddImageToolSchema(BaseModel): 12 | image_url: str = Field(..., description="The URL or path of the image to add") 13 | action: Optional[str] = Field( 14 | default=None, description="Optional context or question about the image" 15 | ) 16 | 17 | 18 | class AddImageTool(BaseTool): 19 | """Tool for adding images to the content""" 20 | 21 | name: str = Field(default_factory=lambda: i18n.tools("add_image")["name"]) # type: ignore 22 | description: str = Field(default_factory=lambda: i18n.tools("add_image")["description"]) # type: ignore 23 | args_schema: type[BaseModel] = AddImageToolSchema 24 | 25 | def _run( 26 | self, 27 | image_url: str, 28 | action: Optional[str] = None, 29 | **kwargs, 30 | ) -> dict: 31 | action = action or i18n.tools("add_image")["default_action"] # type: ignore 32 | content = [ 33 | {"type": "text", "text": action}, 34 | { 35 | "type": "image_url", 36 | "image_url": { 37 | "url": image_url, 38 | }, 39 | }, 40 | ] 41 | 42 | return {"role": "user", "content": content} 43 | -------------------------------------------------------------------------------- /src/crewai/tools/agent_tools/agent_tools.py: -------------------------------------------------------------------------------- 1 | from crewai.agents.agent_builder.base_agent import BaseAgent 2 | from crewai.tools.base_tool import BaseTool 3 | from crewai.utilities import I18N 4 | 5 | from .ask_question_tool import AskQuestionTool 6 | from .delegate_work_tool import DelegateWorkTool 7 | 8 | 9 | class AgentTools: 10 | """Manager class for agent-related tools""" 11 | 12 | def __init__(self, agents: list[BaseAgent], i18n: I18N = I18N()): 13 | self.agents = agents 14 | self.i18n = i18n 15 | 16 | def tools(self) -> list[BaseTool]: 17 | """Get all available agent tools""" 18 | coworkers = ", ".join([f"{agent.role}" for agent in self.agents]) 19 | 20 | delegate_tool = DelegateWorkTool( 21 | agents=self.agents, 22 | i18n=self.i18n, 23 | description=self.i18n.tools("delegate_work").format(coworkers=coworkers), # type: ignore 24 | ) 25 | 26 | ask_tool = AskQuestionTool( 27 | agents=self.agents, 28 | i18n=self.i18n, 29 | description=self.i18n.tools("ask_question").format(coworkers=coworkers), # type: ignore 30 | ) 31 | 32 | return [delegate_tool, ask_tool] 33 | -------------------------------------------------------------------------------- /src/crewai/tools/agent_tools/ask_question_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | from pydantic import BaseModel, Field 4 | 5 | from crewai.tools.agent_tools.base_agent_tools import BaseAgentTool 6 | 7 | 8 | class AskQuestionToolSchema(BaseModel): 9 | question: str = Field(..., description="The question to ask") 10 | context: str = Field(..., description="The context for the question") 11 | coworker: str = Field(..., description="The role/name of the coworker to ask") 12 | 13 | 14 | class AskQuestionTool(BaseAgentTool): 15 | """Tool for asking questions to coworkers""" 16 | 17 | name: str = "Ask question to coworker" 18 | args_schema: type[BaseModel] = AskQuestionToolSchema 19 | 20 | def _run( 21 | self, 22 | question: str, 23 | context: str, 24 | coworker: Optional[str] = None, 25 | **kwargs, 26 | ) -> str: 27 | coworker = self._get_coworker(coworker, **kwargs) 28 | return self._execute(coworker, question, context) 29 | -------------------------------------------------------------------------------- /src/crewai/tools/agent_tools/delegate_work_tool.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | from pydantic import BaseModel, Field 4 | 5 | from crewai.tools.agent_tools.base_agent_tools import BaseAgentTool 6 | 7 | 8 | class DelegateWorkToolSchema(BaseModel): 9 | task: str = Field(..., description="The task to delegate") 10 | context: str = Field(..., description="The context for the task") 11 | coworker: str = Field( 12 | ..., description="The role/name of the coworker to delegate to" 13 | ) 14 | 15 | 16 | class DelegateWorkTool(BaseAgentTool): 17 | """Tool for delegating work to coworkers""" 18 | 19 | name: str = "Delegate work to coworker" 20 | args_schema: type[BaseModel] = DelegateWorkToolSchema 21 | 22 | def _run( 23 | self, 24 | task: str, 25 | context: str, 26 | coworker: Optional[str] = None, 27 | **kwargs, 28 | ) -> str: 29 | coworker = self._get_coworker(coworker, **kwargs) 30 | return self._execute(coworker, task, context) 31 | -------------------------------------------------------------------------------- /src/crewai/tools/cache_tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/tools/cache_tools/__init__.py -------------------------------------------------------------------------------- /src/crewai/tools/cache_tools/cache_tools.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel, Field 2 | 3 | from crewai.agents.cache import CacheHandler 4 | from crewai.tools.structured_tool import CrewStructuredTool 5 | 6 | 7 | class CacheTools(BaseModel): 8 | """Default tools to hit the cache.""" 9 | 10 | name: str = "Hit Cache" 11 | cache_handler: CacheHandler = Field( 12 | description="Cache Handler for the crew", 13 | default_factory=CacheHandler, 14 | ) 15 | 16 | def tool(self): 17 | return CrewStructuredTool.from_function( 18 | func=self.hit_cache, 19 | name=self.name, 20 | description="Reads directly from the cache", 21 | ) 22 | 23 | def hit_cache(self, key): 24 | split = key.split("tool:") 25 | tool = split[1].split("|input:")[0].strip() 26 | tool_input = split[1].split("|input:")[1].strip() 27 | return self.cache_handler.read(tool, tool_input) 28 | -------------------------------------------------------------------------------- /src/crewai/tools/tool_calling.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, Optional 2 | 3 | from pydantic import BaseModel, Field 4 | from pydantic import BaseModel as PydanticBaseModel 5 | from pydantic import Field as PydanticField 6 | 7 | 8 | class ToolCalling(BaseModel): 9 | tool_name: str = Field(..., description="The name of the tool to be called.") 10 | arguments: Optional[Dict[str, Any]] = Field( 11 | ..., description="A dictionary of arguments to be passed to the tool." 12 | ) 13 | 14 | 15 | class InstructorToolCalling(PydanticBaseModel): 16 | tool_name: str = PydanticField( 17 | ..., description="The name of the tool to be called." 18 | ) 19 | arguments: Optional[Dict[str, Any]] = PydanticField( 20 | ..., description="A dictionary of arguments to be passed to the tool." 21 | ) 22 | -------------------------------------------------------------------------------- /src/crewai/tools/tool_types.py: -------------------------------------------------------------------------------- 1 | from dataclasses import dataclass 2 | 3 | 4 | @dataclass 5 | class ToolResult: 6 | """Result of tool execution.""" 7 | 8 | result: str 9 | result_as_answer: bool = False 10 | -------------------------------------------------------------------------------- /src/crewai/types/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/src/crewai/types/__init__.py -------------------------------------------------------------------------------- /src/crewai/types/crew_chat.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | from pydantic import BaseModel, Field 4 | 5 | 6 | class ChatInputField(BaseModel): 7 | """ 8 | Represents a single required input for the crew, with a name and short description. 9 | Example: 10 | { 11 | "name": "topic", 12 | "description": "The topic to focus on for the conversation" 13 | } 14 | """ 15 | 16 | name: str = Field(..., description="The name of the input field") 17 | description: str = Field(..., description="A short description of the input field") 18 | 19 | 20 | class ChatInputs(BaseModel): 21 | """ 22 | Holds a high-level crew_description plus a list of ChatInputFields. 23 | Example: 24 | { 25 | "crew_name": "topic-based-qa", 26 | "crew_description": "Use this crew for topic-based Q&A", 27 | "inputs": [ 28 | {"name": "topic", "description": "The topic to focus on"}, 29 | {"name": "username", "description": "Name of the user"}, 30 | ] 31 | } 32 | """ 33 | 34 | crew_name: str = Field(..., description="The name of the crew") 35 | crew_description: str = Field( 36 | ..., description="A description of the crew's purpose" 37 | ) 38 | inputs: List[ChatInputField] = Field( 39 | default_factory=list, description="A list of input fields for the crew" 40 | ) 41 | -------------------------------------------------------------------------------- /src/crewai/types/usage_metrics.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseModel, Field 2 | 3 | 4 | class UsageMetrics(BaseModel): 5 | """ 6 | Model to track usage metrics for the crew's execution. 7 | 8 | Attributes: 9 | total_tokens: Total number of tokens used. 10 | prompt_tokens: Number of tokens used in prompts. 11 | cached_prompt_tokens: Number of cached prompt tokens used. 12 | completion_tokens: Number of tokens used in completions. 13 | successful_requests: Number of successful requests made. 14 | """ 15 | 16 | total_tokens: int = Field(default=0, description="Total number of tokens used.") 17 | prompt_tokens: int = Field( 18 | default=0, description="Number of tokens used in prompts." 19 | ) 20 | cached_prompt_tokens: int = Field( 21 | default=0, description="Number of cached prompt tokens used." 22 | ) 23 | completion_tokens: int = Field( 24 | default=0, description="Number of tokens used in completions." 25 | ) 26 | successful_requests: int = Field( 27 | default=0, description="Number of successful requests made." 28 | ) 29 | 30 | def add_usage_metrics(self, usage_metrics: "UsageMetrics"): 31 | """ 32 | Add the usage metrics from another UsageMetrics object. 33 | 34 | Args: 35 | usage_metrics (UsageMetrics): The usage metrics to add. 36 | """ 37 | self.total_tokens += usage_metrics.total_tokens 38 | self.prompt_tokens += usage_metrics.prompt_tokens 39 | self.cached_prompt_tokens += usage_metrics.cached_prompt_tokens 40 | self.completion_tokens += usage_metrics.completion_tokens 41 | self.successful_requests += usage_metrics.successful_requests 42 | -------------------------------------------------------------------------------- /src/crewai/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | from .converter import Converter, ConverterError 2 | from .file_handler import FileHandler 3 | from .i18n import I18N 4 | from .internal_instructor import InternalInstructor 5 | from .logger import Logger 6 | from .parser import YamlParser 7 | from .printer import Printer 8 | from .prompts import Prompts 9 | from .rpm_controller import RPMController 10 | from .exceptions.context_window_exceeding_exception import ( 11 | LLMContextLengthExceededException, 12 | ) 13 | from .embedding_configurator import EmbeddingConfigurator 14 | 15 | __all__ = [ 16 | "Converter", 17 | "ConverterError", 18 | "FileHandler", 19 | "I18N", 20 | "InternalInstructor", 21 | "Logger", 22 | "Printer", 23 | "Prompts", 24 | "RPMController", 25 | "YamlParser", 26 | "LLMContextLengthExceededException", 27 | "EmbeddingConfigurator", 28 | ] 29 | -------------------------------------------------------------------------------- /src/crewai/utilities/config.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, Type 2 | 3 | from pydantic import BaseModel 4 | 5 | 6 | def process_config( 7 | values: Dict[str, Any], model_class: Type[BaseModel] 8 | ) -> Dict[str, Any]: 9 | """ 10 | Process the config dictionary and update the values accordingly. 11 | 12 | Args: 13 | values (Dict[str, Any]): The dictionary of values to update. 14 | model_class (Type[BaseModel]): The Pydantic model class to reference for field validation. 15 | 16 | Returns: 17 | Dict[str, Any]: The updated values dictionary. 18 | """ 19 | config = values.get("config", {}) 20 | if not config: 21 | return values 22 | 23 | # Copy values from config (originally from YAML) to the model's attributes. 24 | # Only copy if the attribute isn't already set, preserving any explicitly defined values. 25 | for key, value in config.items(): 26 | if key not in model_class.model_fields or values.get(key) is not None: 27 | continue 28 | 29 | if isinstance(value, dict): 30 | if isinstance(values.get(key), dict): 31 | values[key].update(value) 32 | else: 33 | values[key] = value 34 | else: 35 | values[key] = value 36 | 37 | # Remove the config from values to avoid duplicate processing 38 | values.pop("config", None) 39 | return values 40 | -------------------------------------------------------------------------------- /src/crewai/utilities/constants.py: -------------------------------------------------------------------------------- 1 | TRAINING_DATA_FILE = "training_data.pkl" 2 | TRAINED_AGENTS_DATA_FILE = "trained_agents_data.pkl" 3 | DEFAULT_SCORE_THRESHOLD = 0.35 4 | KNOWLEDGE_DIRECTORY = "knowledge" 5 | MAX_LLM_RETRY = 3 6 | MAX_FILE_NAME_LENGTH = 255 7 | EMITTER_COLOR = "bold_blue" 8 | 9 | 10 | class _NotSpecified: 11 | def __repr__(self): 12 | return "NOT_SPECIFIED" 13 | 14 | 15 | # Sentinel value used to detect when no value has been explicitly provided. 16 | # Unlike `None`, which might be a valid value from the user, `NOT_SPECIFIED` allows 17 | # us to distinguish between "not passed at all" and "explicitly passed None" or "[]". 18 | NOT_SPECIFIED = _NotSpecified() 19 | -------------------------------------------------------------------------------- /src/crewai/utilities/crew_json_encoder.py: -------------------------------------------------------------------------------- 1 | """JSON encoder for handling CrewAI specific types.""" 2 | 3 | import json 4 | from datetime import date, datetime 5 | from decimal import Decimal 6 | from enum import Enum 7 | from uuid import UUID 8 | 9 | from pydantic import BaseModel 10 | 11 | 12 | class CrewJSONEncoder(json.JSONEncoder): 13 | """Custom JSON encoder for CrewAI objects and special types.""" 14 | def default(self, obj): 15 | if isinstance(obj, BaseModel): 16 | return self._handle_pydantic_model(obj) 17 | elif isinstance(obj, UUID) or isinstance(obj, Decimal) or isinstance(obj, Enum): 18 | return str(obj) 19 | 20 | elif isinstance(obj, datetime) or isinstance(obj, date): 21 | return obj.isoformat() 22 | 23 | return super().default(obj) 24 | 25 | def _handle_pydantic_model(self, obj): 26 | try: 27 | data = obj.model_dump() 28 | # Remove circular references 29 | for key, value in data.items(): 30 | if isinstance(value, BaseModel): 31 | data[key] = str( 32 | value 33 | ) # Convert nested models to string representation 34 | return data 35 | except RecursionError: 36 | return str( 37 | obj 38 | ) # Fall back to string representation if circular reference is detected 39 | -------------------------------------------------------------------------------- /src/crewai/utilities/crew_pydantic_output_parser.py: -------------------------------------------------------------------------------- 1 | import json 2 | from typing import Any, Type 3 | 4 | import regex 5 | from pydantic import BaseModel, ValidationError 6 | 7 | from crewai.agents.parser import OutputParserException 8 | 9 | """Parser for converting text outputs into Pydantic models.""" 10 | 11 | class CrewPydanticOutputParser: 12 | """Parses text outputs into specified Pydantic models.""" 13 | 14 | pydantic_object: Type[BaseModel] 15 | 16 | def parse_result(self, result: str) -> Any: 17 | result = self._transform_in_valid_json(result) 18 | 19 | # Treating edge case of function calling llm returning the name instead of tool_name 20 | json_object = json.loads(result) 21 | if "tool_name" not in json_object: 22 | json_object["tool_name"] = json_object.get("name", "") 23 | result = json.dumps(json_object) 24 | 25 | try: 26 | return self.pydantic_object.model_validate(json_object) 27 | except ValidationError as e: 28 | name = self.pydantic_object.__name__ 29 | msg = f"Failed to parse {name} from completion {json_object}. Got: {e}" 30 | raise OutputParserException(error=msg) 31 | 32 | def _transform_in_valid_json(self, text) -> str: 33 | text = text.replace("```", "").replace("json", "") 34 | json_pattern = r"\{(?:[^{}]|(?R))*\}" 35 | matches = regex.finditer(json_pattern, text) 36 | 37 | for match in matches: 38 | try: 39 | # Attempt to parse the matched string as JSON 40 | json_obj = json.loads(match.group()) 41 | # Return the first successfully parsed JSON object 42 | json_obj = json.dumps(json_obj) 43 | return str(json_obj) 44 | except json.JSONDecodeError: 45 | # If parsing fails, skip to the next match 46 | continue 47 | return text 48 | -------------------------------------------------------------------------------- /src/crewai/utilities/errors.py: -------------------------------------------------------------------------------- 1 | """Error message definitions for CrewAI database operations.""" 2 | 3 | from typing import Optional 4 | 5 | 6 | class DatabaseOperationError(Exception): 7 | """Base exception class for database operation errors.""" 8 | 9 | def __init__(self, message: str, original_error: Optional[Exception] = None): 10 | """Initialize the database operation error. 11 | 12 | Args: 13 | message: The error message to display 14 | original_error: The original exception that caused this error, if any 15 | """ 16 | super().__init__(message) 17 | self.original_error = original_error 18 | 19 | 20 | class DatabaseError: 21 | """Standardized error message templates for database operations.""" 22 | 23 | INIT_ERROR: str = "Database initialization error: {}" 24 | SAVE_ERROR: str = "Error saving task outputs: {}" 25 | UPDATE_ERROR: str = "Error updating task outputs: {}" 26 | LOAD_ERROR: str = "Error loading task outputs: {}" 27 | DELETE_ERROR: str = "Error deleting task outputs: {}" 28 | 29 | @classmethod 30 | def format_error(cls, template: str, error: Exception) -> str: 31 | """Format an error message with the given template and error. 32 | 33 | Args: 34 | template: The error message template to use 35 | error: The exception to format into the template 36 | 37 | Returns: 38 | The formatted error message 39 | """ 40 | return template.format(str(error)) 41 | 42 | 43 | class AgentRepositoryError(Exception): 44 | """Exception raised when an agent repository is not found.""" 45 | 46 | ... 47 | -------------------------------------------------------------------------------- /src/crewai/utilities/evaluators/__init__.py: -------------------------------------------------------------------------------- 1 | """Evaluators for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/utilities/events/__init__.py: -------------------------------------------------------------------------------- 1 | from .crew_events import ( 2 | CrewKickoffStartedEvent, 3 | CrewKickoffCompletedEvent, 4 | CrewKickoffFailedEvent, 5 | CrewTrainStartedEvent, 6 | CrewTrainCompletedEvent, 7 | CrewTrainFailedEvent, 8 | CrewTestStartedEvent, 9 | CrewTestCompletedEvent, 10 | CrewTestFailedEvent, 11 | ) 12 | from .llm_guardrail_events import ( 13 | LLMGuardrailCompletedEvent, 14 | LLMGuardrailStartedEvent, 15 | ) 16 | from .agent_events import ( 17 | AgentExecutionStartedEvent, 18 | AgentExecutionCompletedEvent, 19 | AgentExecutionErrorEvent, 20 | ) 21 | from .task_events import ( 22 | TaskStartedEvent, 23 | TaskCompletedEvent, 24 | TaskFailedEvent, 25 | TaskEvaluationEvent, 26 | ) 27 | from .flow_events import ( 28 | FlowCreatedEvent, 29 | FlowStartedEvent, 30 | FlowFinishedEvent, 31 | FlowPlotEvent, 32 | MethodExecutionStartedEvent, 33 | MethodExecutionFinishedEvent, 34 | MethodExecutionFailedEvent, 35 | ) 36 | from .crewai_event_bus import CrewAIEventsBus, crewai_event_bus 37 | from .tool_usage_events import ( 38 | ToolUsageFinishedEvent, 39 | ToolUsageErrorEvent, 40 | ToolUsageStartedEvent, 41 | ToolExecutionErrorEvent, 42 | ToolSelectionErrorEvent, 43 | ToolUsageEvent, 44 | ToolValidateInputErrorEvent, 45 | ) 46 | from .llm_events import ( 47 | LLMCallCompletedEvent, 48 | LLMCallFailedEvent, 49 | LLMCallStartedEvent, 50 | LLMCallType, 51 | LLMStreamChunkEvent, 52 | ) 53 | 54 | # events 55 | from .event_listener import EventListener 56 | from .third_party.agentops_listener import agentops_listener 57 | -------------------------------------------------------------------------------- /src/crewai/utilities/events/base_event_listener.py: -------------------------------------------------------------------------------- 1 | from abc import ABC, abstractmethod 2 | from logging import Logger 3 | 4 | from crewai.utilities.events.crewai_event_bus import CrewAIEventsBus, crewai_event_bus 5 | 6 | 7 | class BaseEventListener(ABC): 8 | verbose: bool = False 9 | 10 | def __init__(self): 11 | super().__init__() 12 | self.setup_listeners(crewai_event_bus) 13 | 14 | @abstractmethod 15 | def setup_listeners(self, crewai_event_bus: CrewAIEventsBus): 16 | pass 17 | -------------------------------------------------------------------------------- /src/crewai/utilities/events/base_events.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from typing import Any, Dict, Optional 3 | 4 | from pydantic import BaseModel, Field 5 | 6 | from crewai.utilities.serialization import to_serializable 7 | 8 | 9 | class BaseEvent(BaseModel): 10 | """Base class for all events""" 11 | 12 | timestamp: datetime = Field(default_factory=datetime.now) 13 | type: str 14 | source_fingerprint: Optional[str] = None # UUID string of the source entity 15 | source_type: Optional[str] = None # "agent", "task", "crew" 16 | fingerprint_metadata: Optional[Dict[str, Any]] = None # Any relevant metadata 17 | 18 | def to_json(self, exclude: set[str] | None = None): 19 | """ 20 | Converts the event to a JSON-serializable dictionary. 21 | 22 | Args: 23 | exclude (set[str], optional): Set of keys to exclude from the result. Defaults to None. 24 | 25 | Returns: 26 | dict: A JSON-serializable dictionary. 27 | """ 28 | return to_serializable(self, exclude=exclude) 29 | -------------------------------------------------------------------------------- /src/crewai/utilities/events/knowledge_events.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING, Any 2 | 3 | from crewai.agents.agent_builder.base_agent import BaseAgent 4 | from crewai.utilities.events.base_events import BaseEvent 5 | 6 | if TYPE_CHECKING: 7 | from crewai.agents.agent_builder.base_agent import BaseAgent 8 | 9 | 10 | class KnowledgeRetrievalStartedEvent(BaseEvent): 11 | """Event emitted when a knowledge retrieval is started.""" 12 | 13 | type: str = "knowledge_search_query_started" 14 | agent: BaseAgent 15 | 16 | 17 | class KnowledgeRetrievalCompletedEvent(BaseEvent): 18 | """Event emitted when a knowledge retrieval is completed.""" 19 | 20 | query: str 21 | type: str = "knowledge_search_query_completed" 22 | agent: BaseAgent 23 | retrieved_knowledge: Any 24 | 25 | 26 | class KnowledgeQueryStartedEvent(BaseEvent): 27 | """Event emitted when a knowledge query is started.""" 28 | 29 | task_prompt: str 30 | type: str = "knowledge_query_started" 31 | agent: BaseAgent 32 | 33 | 34 | class KnowledgeQueryFailedEvent(BaseEvent): 35 | """Event emitted when a knowledge query fails.""" 36 | 37 | type: str = "knowledge_query_failed" 38 | agent: BaseAgent 39 | error: str 40 | 41 | 42 | class KnowledgeQueryCompletedEvent(BaseEvent): 43 | """Event emitted when a knowledge query is completed.""" 44 | 45 | query: str 46 | type: str = "knowledge_query_completed" 47 | agent: BaseAgent 48 | 49 | 50 | class KnowledgeSearchQueryFailedEvent(BaseEvent): 51 | """Event emitted when a knowledge search query fails.""" 52 | 53 | query: str 54 | type: str = "knowledge_search_query_failed" 55 | agent: BaseAgent 56 | error: str 57 | -------------------------------------------------------------------------------- /src/crewai/utilities/events/llm_events.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | from typing import Any, Dict, List, Optional, Union 3 | 4 | from pydantic import BaseModel 5 | 6 | from crewai.utilities.events.base_events import BaseEvent 7 | 8 | 9 | class LLMCallType(Enum): 10 | """Type of LLM call being made""" 11 | 12 | TOOL_CALL = "tool_call" 13 | LLM_CALL = "llm_call" 14 | 15 | 16 | class LLMCallStartedEvent(BaseEvent): 17 | """Event emitted when a LLM call starts 18 | 19 | Attributes: 20 | messages: Content can be either a string or a list of dictionaries that support 21 | multimodal content (text, images, etc.) 22 | """ 23 | 24 | type: str = "llm_call_started" 25 | messages: Union[str, List[Dict[str, Any]]] 26 | tools: Optional[List[dict]] = None 27 | callbacks: Optional[List[Any]] = None 28 | available_functions: Optional[Dict[str, Any]] = None 29 | 30 | 31 | class LLMCallCompletedEvent(BaseEvent): 32 | """Event emitted when a LLM call completes""" 33 | 34 | type: str = "llm_call_completed" 35 | response: Any 36 | call_type: LLMCallType 37 | 38 | 39 | class LLMCallFailedEvent(BaseEvent): 40 | """Event emitted when a LLM call fails""" 41 | 42 | error: str 43 | type: str = "llm_call_failed" 44 | 45 | 46 | class FunctionCall(BaseModel): 47 | arguments: str 48 | name: Optional[str] = None 49 | 50 | 51 | class ToolCall(BaseModel): 52 | id: Optional[str] = None 53 | function: FunctionCall 54 | type: Optional[str] = None 55 | index: int 56 | 57 | 58 | class LLMStreamChunkEvent(BaseEvent): 59 | """Event emitted when a streaming chunk is received""" 60 | 61 | type: str = "llm_stream_chunk" 62 | chunk: str 63 | tool_call: Optional[ToolCall] = None 64 | -------------------------------------------------------------------------------- /src/crewai/utilities/events/llm_guardrail_events.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Callable, Optional, Union 2 | 3 | from crewai.utilities.events.base_events import BaseEvent 4 | 5 | 6 | class LLMGuardrailStartedEvent(BaseEvent): 7 | """Event emitted when a guardrail task starts 8 | 9 | Attributes: 10 | guardrail: The guardrail callable or LLMGuardrail instance 11 | retry_count: The number of times the guardrail has been retried 12 | """ 13 | 14 | type: str = "llm_guardrail_started" 15 | guardrail: Union[str, Callable] 16 | retry_count: int 17 | 18 | def __init__(self, **data): 19 | from inspect import getsource 20 | 21 | from crewai.tasks.llm_guardrail import LLMGuardrail 22 | from crewai.tasks.hallucination_guardrail import HallucinationGuardrail 23 | 24 | super().__init__(**data) 25 | 26 | if isinstance(self.guardrail, LLMGuardrail) or isinstance( 27 | self.guardrail, HallucinationGuardrail 28 | ): 29 | self.guardrail = self.guardrail.description.strip() 30 | elif isinstance(self.guardrail, Callable): 31 | self.guardrail = getsource(self.guardrail).strip() 32 | 33 | 34 | class LLMGuardrailCompletedEvent(BaseEvent): 35 | """Event emitted when a guardrail task completes""" 36 | 37 | type: str = "llm_guardrail_completed" 38 | success: bool 39 | result: Any 40 | error: Optional[str] = None 41 | retry_count: int 42 | -------------------------------------------------------------------------------- /src/crewai/utilities/events/reasoning_events.py: -------------------------------------------------------------------------------- 1 | from crewai.utilities.events.base_events import BaseEvent 2 | 3 | 4 | class AgentReasoningStartedEvent(BaseEvent): 5 | """Event emitted when an agent starts reasoning about a task.""" 6 | 7 | type: str = "agent_reasoning_started" 8 | agent_role: str 9 | task_id: str 10 | attempt: int = 1 # The current reasoning/refinement attempt 11 | 12 | 13 | class AgentReasoningCompletedEvent(BaseEvent): 14 | """Event emitted when an agent finishes its reasoning process.""" 15 | 16 | type: str = "agent_reasoning_completed" 17 | agent_role: str 18 | task_id: str 19 | plan: str 20 | ready: bool 21 | attempt: int = 1 22 | 23 | 24 | class AgentReasoningFailedEvent(BaseEvent): 25 | """Event emitted when the reasoning process fails.""" 26 | 27 | type: str = "agent_reasoning_failed" 28 | agent_role: str 29 | task_id: str 30 | error: str 31 | attempt: int = 1 -------------------------------------------------------------------------------- /src/crewai/utilities/events/third_party/__init__.py: -------------------------------------------------------------------------------- 1 | from .agentops_listener import agentops_listener 2 | -------------------------------------------------------------------------------- /src/crewai/utilities/events/utils/__init__.py: -------------------------------------------------------------------------------- 1 | """Event utilities for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/utilities/exceptions/__init__.py: -------------------------------------------------------------------------------- 1 | """Exceptions for crewAI.""" 2 | -------------------------------------------------------------------------------- /src/crewai/utilities/exceptions/context_window_exceeding_exception.py: -------------------------------------------------------------------------------- 1 | class LLMContextLengthExceededException(Exception): 2 | CONTEXT_LIMIT_ERRORS = [ 3 | "expected a string with maximum length", 4 | "maximum context length", 5 | "context length exceeded", 6 | "context_length_exceeded", 7 | "context window full", 8 | "too many tokens", 9 | "input is too long", 10 | "exceeds token limit", 11 | ] 12 | 13 | def __init__(self, error_message: str): 14 | self.original_error_message = error_message 15 | super().__init__(self._get_error_message(error_message)) 16 | 17 | def _is_context_limit_error(self, error_message: str) -> bool: 18 | return any( 19 | phrase.lower() in error_message.lower() 20 | for phrase in self.CONTEXT_LIMIT_ERRORS 21 | ) 22 | 23 | def _get_error_message(self, error_message: str): 24 | return ( 25 | f"LLM context length exceeded. Original error: {error_message}\n" 26 | "Consider using a smaller input or implementing a text splitting strategy." 27 | ) 28 | -------------------------------------------------------------------------------- /src/crewai/utilities/formatter.py: -------------------------------------------------------------------------------- 1 | from typing import TYPE_CHECKING, List 2 | 3 | 4 | if TYPE_CHECKING: 5 | from crewai.task import Task 6 | from crewai.tasks.task_output import TaskOutput 7 | 8 | 9 | def aggregate_raw_outputs_from_task_outputs(task_outputs: List["TaskOutput"]) -> str: 10 | """Generate string context from the task outputs.""" 11 | dividers = "\n\n----------\n\n" 12 | 13 | # Join task outputs with dividers 14 | context = dividers.join(output.raw for output in task_outputs) 15 | return context 16 | 17 | 18 | def aggregate_raw_outputs_from_tasks(tasks: List["Task"]) -> str: 19 | """Generate string context from the tasks.""" 20 | 21 | task_outputs = ( 22 | [task.output for task in tasks if task.output is not None] 23 | if isinstance(tasks, list) 24 | else [] 25 | ) 26 | 27 | return aggregate_raw_outputs_from_task_outputs(task_outputs) 28 | -------------------------------------------------------------------------------- /src/crewai/utilities/internal_instructor.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | from typing import Any, Optional, Type 3 | 4 | 5 | class InternalInstructor: 6 | """Class that wraps an agent llm with instructor.""" 7 | 8 | def __init__( 9 | self, 10 | content: str, 11 | model: Type, 12 | agent: Optional[Any] = None, 13 | llm: Optional[str] = None, 14 | ): 15 | self.content = content 16 | self.agent = agent 17 | self.llm = llm 18 | self.model = model 19 | self._client = None 20 | self.set_instructor() 21 | 22 | def set_instructor(self): 23 | """Set instructor.""" 24 | if self.agent and not self.llm: 25 | self.llm = self.agent.function_calling_llm or self.agent.llm 26 | 27 | with warnings.catch_warnings(): 28 | warnings.simplefilter("ignore", UserWarning) 29 | import instructor 30 | from litellm import completion 31 | 32 | self._client = instructor.from_litellm(completion) 33 | 34 | def to_json(self): 35 | model = self.to_pydantic() 36 | return model.model_dump_json(indent=2) 37 | 38 | def to_pydantic(self): 39 | messages = [{"role": "user", "content": self.content}] 40 | model = self._client.chat.completions.create( 41 | model=self.llm.model, response_model=self.model, messages=messages 42 | ) 43 | return model 44 | -------------------------------------------------------------------------------- /src/crewai/utilities/logger.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | 3 | from pydantic import BaseModel, Field, PrivateAttr 4 | 5 | from crewai.utilities.printer import Printer 6 | 7 | 8 | class Logger(BaseModel): 9 | verbose: bool = Field(default=False) 10 | _printer: Printer = PrivateAttr(default_factory=Printer) 11 | default_color: str = Field(default="bold_yellow") 12 | 13 | def log(self, level, message, color=None): 14 | if color is None: 15 | color = self.default_color 16 | if self.verbose: 17 | timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") 18 | self._printer.print( 19 | f"\n[{timestamp}][{level.upper()}]: {message}", color=color 20 | ) 21 | -------------------------------------------------------------------------------- /src/crewai/utilities/parser.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | class YamlParser: 5 | @staticmethod 6 | def parse(file): 7 | """ 8 | Parses a YAML file, modifies specific patterns, and checks for unsupported 'context' usage. 9 | Args: 10 | file (file object): The YAML file to parse. 11 | Returns: 12 | str: The modified content of the YAML file. 13 | Raises: 14 | ValueError: If 'context:' is used incorrectly. 15 | """ 16 | content = file.read() 17 | 18 | # Replace single { and } with doubled ones, while leaving already doubled ones intact and the other special characters {# and {% 19 | modified_content = re.sub(r"(? str: 9 | """Returns the path for SQLite database storage. 10 | 11 | Returns: 12 | str: Full path to the SQLite database file 13 | """ 14 | app_name = get_project_directory_name() 15 | app_author = "CrewAI" 16 | 17 | data_dir = Path(appdirs.user_data_dir(app_name, app_author)) 18 | data_dir.mkdir(parents=True, exist_ok=True) 19 | return str(data_dir) 20 | 21 | 22 | def get_project_directory_name(): 23 | """Returns the current project directory name.""" 24 | project_directory_name = os.environ.get("CREWAI_STORAGE_DIR") 25 | 26 | if project_directory_name: 27 | return project_directory_name 28 | else: 29 | cwd = Path.cwd() 30 | project_directory_name = cwd.name 31 | return project_directory_name -------------------------------------------------------------------------------- /src/crewai/utilities/token_counter_callback.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | from typing import Any, Dict, Optional 3 | 4 | from litellm.integrations.custom_logger import CustomLogger 5 | from litellm.types.utils import Usage 6 | 7 | from crewai.agents.agent_builder.utilities.base_token_process import TokenProcess 8 | 9 | 10 | class TokenCalcHandler(CustomLogger): 11 | def __init__(self, token_cost_process: Optional[TokenProcess]): 12 | self.token_cost_process = token_cost_process 13 | 14 | def log_success_event( 15 | self, 16 | kwargs: Dict[str, Any], 17 | response_obj: Dict[str, Any], 18 | start_time: float, 19 | end_time: float, 20 | ) -> None: 21 | if self.token_cost_process is None: 22 | return 23 | 24 | with warnings.catch_warnings(): 25 | warnings.simplefilter("ignore", UserWarning) 26 | if isinstance(response_obj, dict) and "usage" in response_obj: 27 | usage: Usage = response_obj["usage"] 28 | if usage: 29 | self.token_cost_process.sum_successful_requests(1) 30 | if hasattr(usage, "prompt_tokens"): 31 | self.token_cost_process.sum_prompt_tokens(usage.prompt_tokens) 32 | if hasattr(usage, "completion_tokens"): 33 | self.token_cost_process.sum_completion_tokens( 34 | usage.completion_tokens 35 | ) 36 | if ( 37 | hasattr(usage, "prompt_tokens_details") 38 | and usage.prompt_tokens_details 39 | and usage.prompt_tokens_details.cached_tokens 40 | ): 41 | self.token_cost_process.sum_cached_prompt_tokens( 42 | usage.prompt_tokens_details.cached_tokens 43 | ) 44 | -------------------------------------------------------------------------------- /src/crewai/utilities/training_handler.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from crewai.utilities.file_handler import PickleHandler 4 | 5 | 6 | class CrewTrainingHandler(PickleHandler): 7 | def save_trained_data(self, agent_id: str, trained_data: dict) -> None: 8 | """ 9 | Save the trained data for a specific agent. 10 | 11 | Parameters: 12 | - agent_id (str): The ID of the agent. 13 | - trained_data (dict): The trained data to be saved. 14 | """ 15 | data = self.load() 16 | data[agent_id] = trained_data 17 | self.save(data) 18 | 19 | def append(self, train_iteration: int, agent_id: str, new_data) -> None: 20 | """ 21 | Append new data to the existing pickle file. 22 | 23 | Parameters: 24 | - new_data (object): The new data to be appended. 25 | """ 26 | data = self.load() 27 | 28 | if agent_id in data: 29 | data[agent_id][train_iteration] = new_data 30 | else: 31 | data[agent_id] = {train_iteration: new_data} 32 | 33 | self.save(data) 34 | 35 | def clear(self) -> None: 36 | """Clear the training data by removing the file or resetting its contents.""" 37 | if os.path.exists(self.file_path): 38 | self.save({}) 39 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/__init__.py -------------------------------------------------------------------------------- /tests/agents/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/agents/__init__.py -------------------------------------------------------------------------------- /tests/agents/agent_adapters/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for agent adapters.""" 2 | -------------------------------------------------------------------------------- /tests/agents/agent_builder/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for agent builder.""" 2 | -------------------------------------------------------------------------------- /tests/agents/agent_builder/base_agent_test.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | from typing import Any, List, Optional 3 | 4 | from pydantic import BaseModel 5 | 6 | from crewai.agents.agent_builder.base_agent import BaseAgent 7 | from crewai.tools.base_tool import BaseTool 8 | 9 | 10 | class MockAgent(BaseAgent): 11 | def execute_task( 12 | self, 13 | task: Any, 14 | context: Optional[str] = None, 15 | tools: Optional[List[BaseTool]] = None, 16 | ) -> str: 17 | return "" 18 | 19 | def create_agent_executor(self, tools=None) -> None: ... 20 | 21 | def get_delegation_tools(self, agents: List["BaseAgent"]): ... 22 | 23 | def get_output_converter( 24 | self, llm: Any, text: str, model: type[BaseModel] | None, instructions: str 25 | ): ... 26 | 27 | 28 | def test_key(): 29 | agent = MockAgent( 30 | role="test role", 31 | goal="test goal", 32 | backstory="test backstory", 33 | ) 34 | hash = hashlib.md5("test role|test goal|test backstory".encode()).hexdigest() 35 | assert agent.key == hash 36 | -------------------------------------------------------------------------------- /tests/cassettes/test_gemini_models[gemini-gemini-2.5-pro-exp-03-25].yaml: -------------------------------------------------------------------------------- 1 | interactions: 2 | - request: 3 | body: '{"contents": [{"role": "user", "parts": [{"text": "What is the capital 4 | of France?"}]}], "generationConfig": {"stop_sequences": []}}' 5 | headers: 6 | accept: 7 | - '*/*' 8 | accept-encoding: 9 | - gzip, deflate 10 | connection: 11 | - keep-alive 12 | content-length: 13 | - '131' 14 | content-type: 15 | - application/json 16 | host: 17 | - generativelanguage.googleapis.com 18 | user-agent: 19 | - litellm/1.60.2 20 | method: POST 21 | uri: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro-exp-03-25:generateContent 22 | response: 23 | body: 24 | string: !!binary | 25 | H4sIAAAAAAAC/12QT2uEMBDF7/kUIUepi2tZaHttu7fSpZVSKD0MOquhmkgygkX87o26cWM9SJj3 26 | 5s/7DYxzkYMqZAGEVjzwL1fhfJj/k6YVoSIn+JIrtmDo6l2+IXg7C2E/NYmsQp5DKwlqrs/8aEDl 27 | yKXlUXQCI20U7UTQOa7v75vrPqNrnIY1usDa20dvEGeppK3eEKxWk+09ez2JVZWqwN6VE+YXzKNF 28 | Z6HEFyRwyWHNJ1qjm5Yy/YPqUXdz8rtlVsBpI++T5GIg7WL+03xzMNc+ua2yDgkGcF1IqCX9zvSe 29 | PzMRgKDNWR4EC3gJqnRXVrQ98T5lF2ALww80Vi6wSmwcvjjdHWJ3Yox9Gye3cXoQbGR/TedYqx4C 30 | AAA= 31 | headers: 32 | Alt-Svc: 33 | - h3=":443"; ma=2592000,h3-29=":443"; ma=2592000 34 | Content-Encoding: 35 | - gzip 36 | Content-Type: 37 | - application/json; charset=UTF-8 38 | Date: 39 | - Tue, 22 Apr 2025 14:25:30 GMT 40 | Server: 41 | - scaffolding on HTTPServer2 42 | Server-Timing: 43 | - gfet4t7; dur=2418 44 | Transfer-Encoding: 45 | - chunked 46 | Vary: 47 | - Origin 48 | - X-Origin 49 | - Referer 50 | X-Content-Type-Options: 51 | - nosniff 52 | X-Frame-Options: 53 | - SAMEORIGIN 54 | X-XSS-Protection: 55 | - '0' 56 | status: 57 | code: 200 58 | message: OK 59 | version: 1 60 | -------------------------------------------------------------------------------- /tests/cli/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/cli/__init__.py -------------------------------------------------------------------------------- /tests/cli/authentication/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/cli/authentication/__init__.py -------------------------------------------------------------------------------- /tests/cli/deploy/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for CLI deploy.""" 2 | -------------------------------------------------------------------------------- /tests/cli/test_constants.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from crewai.cli.constants import ENV_VARS, MODELS, PROVIDERS 4 | 5 | 6 | def test_huggingface_in_providers(): 7 | """Test that Huggingface is in the PROVIDERS list.""" 8 | assert "huggingface" in PROVIDERS 9 | 10 | 11 | def test_huggingface_env_vars(): 12 | """Test that Huggingface environment variables are properly configured.""" 13 | assert "huggingface" in ENV_VARS 14 | assert any( 15 | detail.get("key_name") == "HF_TOKEN" 16 | for detail in ENV_VARS["huggingface"] 17 | ) 18 | 19 | 20 | def test_huggingface_models(): 21 | """Test that Huggingface models are properly configured.""" 22 | assert "huggingface" in MODELS 23 | assert len(MODELS["huggingface"]) > 0 24 | -------------------------------------------------------------------------------- /tests/cli/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/cli/tools/__init__.py -------------------------------------------------------------------------------- /tests/config/agents.yaml: -------------------------------------------------------------------------------- 1 | researcher: 2 | role: > 3 | {topic} Senior Data Researcher 4 | goal: > 5 | Uncover cutting-edge developments in {topic} 6 | backstory: > 7 | You're a seasoned researcher with a knack for uncovering the latest 8 | developments in {topic}. Known for your ability to find the most relevant 9 | information and present it in a clear and concise manner. 10 | verbose: true 11 | function_calling_llm: "local_llm" 12 | 13 | reporting_analyst: 14 | role: > 15 | {topic} Reporting Analyst 16 | goal: > 17 | Create detailed reports based on {topic} data analysis and research findings 18 | backstory: > 19 | You're a meticulous analyst with a keen eye for detail. You're known for 20 | your ability to turn complex data into clear and concise reports, making 21 | it easy for others to understand and act on the information you provide. 22 | verbose: true 23 | function_calling_llm: "online_llm" -------------------------------------------------------------------------------- /tests/config/tasks.yaml: -------------------------------------------------------------------------------- 1 | research_task: 2 | description: > 3 | Conduct a thorough research about {topic} 4 | Make sure you find any interesting and relevant information given 5 | the current year is 2025. 6 | expected_output: > 7 | A list with 10 bullet points of the most relevant information about {topic} 8 | agent: researcher 9 | guardrail: ensure each bullet contains its source 10 | 11 | reporting_task: 12 | description: > 13 | Review the context you got and expand each topic into a full section for a report. 14 | Make sure the report is detailed and contains any and all relevant information. 15 | expected_output: > 16 | A fully fledge reports with the mains topics, each with a full section of information. 17 | Formatted as markdown without '```' 18 | agent: reporting_analyst 19 | -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | # conftest.py 2 | import os 3 | import tempfile 4 | from pathlib import Path 5 | 6 | import pytest 7 | from dotenv import load_dotenv 8 | 9 | load_result = load_dotenv(override=True) 10 | 11 | 12 | @pytest.fixture(autouse=True) 13 | def setup_test_environment(): 14 | """Set up test environment with a temporary directory for SQLite storage.""" 15 | with tempfile.TemporaryDirectory() as temp_dir: 16 | # Create the directory with proper permissions 17 | storage_dir = Path(temp_dir) / "crewai_test_storage" 18 | storage_dir.mkdir(parents=True, exist_ok=True) 19 | 20 | # Validate that the directory was created successfully 21 | if not storage_dir.exists() or not storage_dir.is_dir(): 22 | raise RuntimeError( 23 | f"Failed to create test storage directory: {storage_dir}" 24 | ) 25 | 26 | # Verify directory permissions 27 | try: 28 | # Try to create a test file to verify write permissions 29 | test_file = storage_dir / ".permissions_test" 30 | test_file.touch() 31 | test_file.unlink() 32 | except (OSError, IOError) as e: 33 | raise RuntimeError( 34 | f"Test storage directory {storage_dir} is not writable: {e}" 35 | ) 36 | 37 | # Set environment variable to point to the test storage directory 38 | os.environ["CREWAI_STORAGE_DIR"] = str(storage_dir) 39 | 40 | yield 41 | 42 | # Cleanup is handled automatically when tempfile context exits 43 | 44 | 45 | @pytest.fixture(scope="module") 46 | def vcr_config(request) -> dict: 47 | return { 48 | "cassette_library_dir": "tests/cassettes", 49 | "record_mode": "new_episodes", 50 | "filter_headers": [("authorization", "AUTHORIZATION-XXX")], 51 | } 52 | -------------------------------------------------------------------------------- /tests/imports_test.py: -------------------------------------------------------------------------------- 1 | """Test that all public API classes are properly importable.""" 2 | 3 | 4 | def test_task_output_import(): 5 | """Test that TaskOutput can be imported from crewai.""" 6 | from crewai import TaskOutput 7 | 8 | assert TaskOutput is not None 9 | 10 | 11 | def test_crew_output_import(): 12 | """Test that CrewOutput can be imported from crewai.""" 13 | from crewai import CrewOutput 14 | 15 | assert CrewOutput is not None 16 | -------------------------------------------------------------------------------- /tests/knowledge/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/knowledge/__init__.py -------------------------------------------------------------------------------- /tests/knowledge/crewai_quickstart.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/knowledge/crewai_quickstart.pdf -------------------------------------------------------------------------------- /tests/memory/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for memory.""" 2 | -------------------------------------------------------------------------------- /tests/memory/long_term_memory_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from crewai.memory.long_term.long_term_memory import LongTermMemory 4 | from crewai.memory.long_term.long_term_memory_item import LongTermMemoryItem 5 | 6 | 7 | @pytest.fixture 8 | def long_term_memory(): 9 | """Fixture to create a LongTermMemory instance""" 10 | return LongTermMemory() 11 | 12 | 13 | def test_save_and_search(long_term_memory): 14 | memory = LongTermMemoryItem( 15 | agent="test_agent", 16 | task="test_task", 17 | expected_output="test_output", 18 | datetime="test_datetime", 19 | quality=0.5, 20 | metadata={"task": "test_task", "quality": 0.5}, 21 | ) 22 | long_term_memory.save(memory) 23 | find = long_term_memory.search("test_task", latest_n=5)[0] 24 | assert find["score"] == 0.5 25 | assert find["datetime"] == "test_datetime" 26 | assert find["metadata"]["agent"] == "test_agent" 27 | assert find["metadata"]["quality"] == 0.5 28 | assert find["metadata"]["task"] == "test_task" 29 | assert find["metadata"]["expected_output"] == "test_output" 30 | -------------------------------------------------------------------------------- /tests/pipeline/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/pipeline/__init__.py -------------------------------------------------------------------------------- /tests/security/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/security/__init__.py -------------------------------------------------------------------------------- /tests/storage/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for storage.""" 2 | -------------------------------------------------------------------------------- /tests/telemetry/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/telemetry/__init__.py -------------------------------------------------------------------------------- /tests/telemetry/test_telemetry_disable.py: -------------------------------------------------------------------------------- 1 | import os 2 | from unittest.mock import patch 3 | 4 | import pytest 5 | 6 | from crewai.telemetry import Telemetry 7 | 8 | 9 | @pytest.mark.parametrize("env_var,value,expected_ready", [ 10 | ("OTEL_SDK_DISABLED", "true", False), 11 | ("OTEL_SDK_DISABLED", "TRUE", False), 12 | ("CREWAI_DISABLE_TELEMETRY", "true", False), 13 | ("CREWAI_DISABLE_TELEMETRY", "TRUE", False), 14 | ("OTEL_SDK_DISABLED", "false", True), 15 | ("CREWAI_DISABLE_TELEMETRY", "false", True), 16 | ]) 17 | def test_telemetry_environment_variables(env_var, value, expected_ready): 18 | """Test telemetry state with different environment variable configurations.""" 19 | with patch.dict(os.environ, {env_var: value}): 20 | with patch("crewai.telemetry.telemetry.TracerProvider"): 21 | telemetry = Telemetry() 22 | assert telemetry.ready is expected_ready 23 | 24 | 25 | def test_telemetry_enabled_by_default(): 26 | """Test that telemetry is enabled by default.""" 27 | with patch.dict(os.environ, {}, clear=True): 28 | with patch("crewai.telemetry.telemetry.TracerProvider"): 29 | telemetry = Telemetry() 30 | assert telemetry.ready is True 31 | -------------------------------------------------------------------------------- /tests/test_multimodal_validation.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | 5 | from crewai import LLM, Agent, Crew, Task 6 | 7 | 8 | @pytest.mark.skip(reason="Only run manually with valid API keys") 9 | def test_multimodal_agent_with_image_url(): 10 | """ 11 | Test that a multimodal agent can process images without validation errors. 12 | This test reproduces the scenario from issue #2475. 13 | """ 14 | OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") 15 | if not OPENAI_API_KEY: 16 | pytest.skip("OPENAI_API_KEY environment variable not set") 17 | 18 | llm = LLM( 19 | model="openai/gpt-4o", # model with vision capabilities 20 | api_key=OPENAI_API_KEY, 21 | temperature=0.7 22 | ) 23 | 24 | expert_analyst = Agent( 25 | role="Visual Quality Inspector", 26 | goal="Perform detailed quality analysis of product images", 27 | backstory="Senior quality control expert with expertise in visual inspection", 28 | llm=llm, 29 | verbose=True, 30 | allow_delegation=False, 31 | multimodal=True 32 | ) 33 | 34 | inspection_task = Task( 35 | description=""" 36 | Analyze the product image at https://www.us.maguireshoes.com/collections/spring-25/products/lucena-black-boot with focus on: 37 | 1. Quality of materials 38 | 2. Manufacturing defects 39 | 3. Compliance with standards 40 | Provide a detailed report highlighting any issues found. 41 | """, 42 | expected_output="A detailed report highlighting any issues found", 43 | agent=expert_analyst 44 | ) 45 | 46 | crew = Crew(agents=[expert_analyst], tasks=[inspection_task]) 47 | -------------------------------------------------------------------------------- /tests/tools/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for tools.""" 2 | -------------------------------------------------------------------------------- /tests/tools/agent_tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crewAIInc/crewAI/2bd6b72aaee7bb594a55ea32229b35599d335236/tests/tools/agent_tools/__init__.py -------------------------------------------------------------------------------- /tests/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for utilities.""" 2 | -------------------------------------------------------------------------------- /tests/utilities/evaluators/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for evaluators.""" 2 | -------------------------------------------------------------------------------- /tests/utilities/events/__init__.py: -------------------------------------------------------------------------------- 1 | """Tests for events.""" 2 | -------------------------------------------------------------------------------- /tests/utilities/events/test_crewai_event_bus.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import Mock 2 | 3 | from crewai.utilities.events.base_events import BaseEvent 4 | from crewai.utilities.events.crewai_event_bus import crewai_event_bus 5 | 6 | 7 | class TestEvent(BaseEvent): 8 | pass 9 | 10 | 11 | def test_specific_event_handler(): 12 | mock_handler = Mock() 13 | 14 | @crewai_event_bus.on(TestEvent) 15 | def handler(source, event): 16 | mock_handler(source, event) 17 | 18 | event = TestEvent(type="test_event") 19 | crewai_event_bus.emit("source_object", event) 20 | 21 | mock_handler.assert_called_once_with("source_object", event) 22 | 23 | 24 | def test_wildcard_event_handler(): 25 | mock_handler = Mock() 26 | 27 | @crewai_event_bus.on(BaseEvent) 28 | def handler(source, event): 29 | mock_handler(source, event) 30 | 31 | event = TestEvent(type="test_event") 32 | crewai_event_bus.emit("source_object", event) 33 | 34 | mock_handler.assert_called_once_with("source_object", event) 35 | 36 | 37 | def test_event_bus_error_handling(capfd): 38 | @crewai_event_bus.on(BaseEvent) 39 | def broken_handler(source, event): 40 | raise ValueError("Simulated handler failure") 41 | 42 | event = TestEvent(type="test_event") 43 | crewai_event_bus.emit("source_object", event) 44 | 45 | out, err = capfd.readouterr() 46 | assert "Simulated handler failure" in out 47 | assert "Handler 'broken_handler' failed" in out 48 | -------------------------------------------------------------------------------- /tests/utilities/prompts.json: -------------------------------------------------------------------------------- 1 | { 2 | "hierarchical_manager_agent": { 3 | "role": "Lorem ipsum dolor sit amet", 4 | "goal": "Lorem ipsum dolor sit amet", 5 | "backstory": "Lorem ipsum dolor sit amet." 6 | }, 7 | "planning_manager_agent": { 8 | "role": "Lorem ipsum dolor sit amet", 9 | "goal": "Lorem ipsum dolor sit amet", 10 | "backstory": "Lorem ipsum dolor sit amet." 11 | }, 12 | "slices": { 13 | "observation": "Lorem ipsum dolor sit amet", 14 | "task": "Lorem ipsum dolor sit amet", 15 | "memory": "Lorem ipsum dolor sit amet", 16 | "role_playing": "Lorem ipsum dolor sit amet", 17 | "tools": "Lorem ipsum dolor sit amet", 18 | "no_tools": "Lorem ipsum dolor sit amet", 19 | "format": "Lorem ipsum dolor sit amet", 20 | "final_answer_format": "Lorem ipsum dolor sit amet", 21 | "format_without_tools": "Lorem ipsum dolor sit amet", 22 | "task_with_context": "Lorem ipsum dolor sit amet", 23 | "expected_output": "Lorem ipsum dolor sit amet", 24 | "human_feedback": "Lorem ipsum dolor sit amet", 25 | "getting_input": "Lorem ipsum dolor sit amet " 26 | }, 27 | "errors": { 28 | "force_final_answer": "Lorem ipsum dolor sit amet", 29 | "agent_tool_unexisting_coworker": "Lorem ipsum dolor sit amet", 30 | "task_repeated_usage": "Lorem ipsum dolor sit amet", 31 | "tool_usage_error": "Lorem ipsum dolor sit amet", 32 | "tool_arguments_error": "Lorem ipsum dolor sit amet", 33 | "wrong_tool_name": "Lorem ipsum dolor sit amet", 34 | "tool_usage_exception": "Lorem ipsum dolor sit amet" 35 | }, 36 | "tools": { 37 | "delegate_work": "Lorem ipsum dolor sit amet", 38 | "ask_question": "Lorem ipsum dolor sit amet" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/utilities/test_file_handler.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | import pytest 5 | 6 | from crewai.utilities.file_handler import PickleHandler 7 | 8 | 9 | class TestPickleHandler(unittest.TestCase): 10 | def setUp(self): 11 | self.file_name = "test_data.pkl" 12 | self.file_path = os.path.join(os.getcwd(), self.file_name) 13 | self.handler = PickleHandler(self.file_name) 14 | 15 | def tearDown(self): 16 | if os.path.exists(self.file_path): 17 | os.remove(self.file_path) 18 | 19 | def test_initialize_file(self): 20 | assert os.path.exists(self.file_path) is False 21 | 22 | self.handler.initialize_file() 23 | 24 | assert os.path.exists(self.file_path) is True 25 | assert os.path.getsize(self.file_path) >= 0 26 | 27 | def test_save_and_load(self): 28 | data = {"key": "value"} 29 | self.handler.save(data) 30 | loaded_data = self.handler.load() 31 | assert loaded_data == data 32 | 33 | def test_load_empty_file(self): 34 | loaded_data = self.handler.load() 35 | assert loaded_data == {} 36 | 37 | def test_load_corrupted_file(self): 38 | with open(self.file_path, "wb") as file: 39 | file.write(b"corrupted data") 40 | 41 | with pytest.raises(Exception) as exc: 42 | self.handler.load() 43 | 44 | assert str(exc.value) == "pickle data was truncated" 45 | assert "" == str(exc.type) 46 | -------------------------------------------------------------------------------- /tests/utilities/test_i18n.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from crewai.utilities.i18n import I18N 4 | 5 | 6 | def test_load_prompts(): 7 | i18n = I18N() 8 | i18n.load_prompts() 9 | assert i18n._prompts is not None 10 | 11 | 12 | def test_slice(): 13 | i18n = I18N() 14 | i18n.load_prompts() 15 | assert isinstance(i18n.slice("role_playing"), str) 16 | 17 | 18 | def test_tools(): 19 | i18n = I18N() 20 | i18n.load_prompts() 21 | assert isinstance(i18n.tools("ask_question"), str) 22 | 23 | 24 | def test_retrieve(): 25 | i18n = I18N() 26 | i18n.load_prompts() 27 | assert isinstance(i18n.retrieve("slices", "role_playing"), str) 28 | 29 | 30 | def test_retrieve_not_found(): 31 | i18n = I18N() 32 | i18n.load_prompts() 33 | with pytest.raises(Exception): 34 | i18n.retrieve("nonexistent_kind", "nonexistent_key") 35 | 36 | 37 | def test_prompt_file(): 38 | import os 39 | 40 | path = os.path.join(os.path.dirname(__file__), "prompts.json") 41 | i18n = I18N(prompt_file=path) 42 | i18n.load_prompts() 43 | assert isinstance(i18n.retrieve("slices", "role_playing"), str) 44 | assert i18n.retrieve("slices", "role_playing") == "Lorem ipsum dolor sit amet" 45 | -------------------------------------------------------------------------------- /tests/utilities/test_training_handler.py: -------------------------------------------------------------------------------- 1 | import os 2 | import unittest 3 | 4 | from crewai.utilities.training_handler import CrewTrainingHandler 5 | 6 | 7 | class InternalCrewTrainingHandler(unittest.TestCase): 8 | def setUp(self): 9 | self.handler = CrewTrainingHandler("trained_data.pkl") 10 | 11 | def tearDown(self): 12 | os.remove("trained_data.pkl") 13 | del self.handler 14 | 15 | def test_save_trained_data(self): 16 | agent_id = "agent1" 17 | trained_data = {"param1": 1, "param2": 2} 18 | self.handler.save_trained_data(agent_id, trained_data) 19 | 20 | # Assert that the trained data is saved correctly 21 | data = self.handler.load() 22 | assert data[agent_id] == trained_data 23 | 24 | def test_append_existing_agent(self): 25 | train_iteration = 1 26 | agent_id = "agent1" 27 | new_data = {"param3": 3, "param4": 4} 28 | self.handler.append(train_iteration, agent_id, new_data) 29 | 30 | # Assert that the new data is appended correctly to the existing agent 31 | data = self.handler.load() 32 | assert data[agent_id][train_iteration] == new_data 33 | 34 | def test_append_new_agent(self): 35 | train_iteration = 1 36 | agent_id = "agent2" 37 | new_data = {"param5": 5, "param6": 6} 38 | self.handler.append(train_iteration, agent_id, new_data) 39 | 40 | # Assert that the new agent and data are appended correctly 41 | data = self.handler.load() 42 | assert data[agent_id][train_iteration] == new_data 43 | --------------------------------------------------------------------------------