Commit Graph

251 Commits

Author SHA1 Message Date
Greyson LaLonde
e2a5177da2 refactor: consolidate FileInput and MIME type definitions 2026-01-22 10:15:32 -05:00
Greyson LaLonde
da930fa1df refactor: extract helper functions to reduce code duplication 2026-01-22 09:52:23 -05:00
Greyson LaLonde
0a250a45ce refactor: fix IDE warnings and add Literal types to constraints
- Add Literal types for ImageFormat, AudioFormat, VideoFormat, ProviderName
- Convert methods to @staticmethod where appropriate
- Remove redundant default parameter values
- Fix variable shadowing in nested functions
- Make magic import optional with mimetypes fallback
- Add docstrings to inner functions
2026-01-22 02:54:29 -05:00
Greyson LaLonde
1353cb2a33 feat: add streaming uploads for large files
- OpenAI: Use Uploads API for files > 512MB with chunked streaming
- Gemini: Pass file path directly to SDK for FilePath sources
- Bedrock: Use upload_fileobj with TransferConfig for automatic multipart
2026-01-22 02:10:15 -05:00
Greyson LaLonde
5550c6df7e feat: promote files to first-class crewai.files package 2026-01-22 01:39:04 -05:00
lorenzejay
d9e4a2345b Remove debug print statements from AgentExecutor to clean up the code and improve readability. This change enhances the overall performance of the agent execution flow by eliminating unnecessary console output during LLM calls and iterations. 2026-01-21 17:53:35 -08:00
Greyson LaLonde
204a1cece7 chore: move file processing deps to optional dependencies 2026-01-21 20:52:15 -05:00
Greyson LaLonde
4c0d99601c chore: remove unnecessary comments and fix type errors
- Remove unnecessary block and inline comments from file utilities
- Fix mypy errors by using file.read() instead of file.source.read()
2026-01-21 20:40:13 -05:00
Greyson LaLonde
e2c517d0a2 feat: export file types and deprecate agent multimodal flag
- Export File type classes from crewai package
- Mark Agent.multimodal field as deprecated (use input_files instead)
2026-01-21 20:14:43 -05:00
Greyson LaLonde
af4523b2a1 chore: add file processing dependencies
- Add python-magic and aiocache to core dependencies
- Add optional image-processing group (Pillow)
- Add optional pdf-processing group (pypdf)
- Add optional file-processing group (both)
2026-01-21 20:13:26 -05:00
Greyson LaLonde
1fe020fa6f test: add file utilities tests
- Add tests for file processing constraints and validators
- Add tests for FileProcessor and FileResolver
- Add tests for resolved file types
- Add tests for file store operations
- Add unit tests for multimodal LLM support
2026-01-21 20:12:57 -05:00
Greyson LaLonde
b035aa8947 feat: add ReadFileTool for agent file access
- Create read_file tool for agents to access attached files
- Support reading by file name from crew/task file store
- Add unit tests for ReadFileTool
2026-01-21 20:12:11 -05:00
Greyson LaLonde
4ed5e4ca0e feat: add input_files support to Task and Crew
- Add input_files parameter to Task for file attachments
- Add file_handling mode to Crew for processing behavior
- Integrate file injection in CrewAgentExecutor
- Update prepare_kickoff to handle KickoffInputs type
2026-01-21 20:11:05 -05:00
Greyson LaLonde
771eccfcdf feat: add multimodal support to LLM providers
- Add format_multimodal_content() to all LLM providers
- Support inline base64 and file reference formats
- Add FileResolver integration for upload caching
- Add module exports for files package
2026-01-21 20:05:33 -05:00
Greyson LaLonde
50728b10e8 fix: resolve mypy type errors in file utilities 2026-01-21 19:43:46 -05:00
Greyson LaLonde
42ca4eacff feat: upgrade upload cache to aiocache with atexit cleanup 2026-01-21 19:35:56 -05:00
Greyson LaLonde
d8ebfe7ee0 feat: add module exports and file store 2026-01-21 19:28:40 -05:00
lorenzejay
422374a881 dropped unused 2026-01-21 16:06:33 -08:00
lorenzejay
659589e8ae organizae imports 2026-01-21 16:00:54 -08:00
lorenzejay
97766b3c58 fixing azure tests 2026-01-21 16:00:32 -08:00
Greyson LaLonde
8cf0cfa2b7 feat: add prompt caching support for Anthropic 2026-01-21 18:46:06 -05:00
Greyson LaLonde
3ad0af4934 feat: add file resolver for inline vs upload decisions 2026-01-21 18:41:34 -05:00
Greyson LaLonde
56946d309b feat: add provider file uploaders 2026-01-21 18:38:04 -05:00
Greyson LaLonde
5200ed4372 feat: add file upload cache 2026-01-21 18:37:22 -05:00
Greyson LaLonde
301a1da047 feat: add file processing infrastructure 2026-01-21 18:30:14 -05:00
Greyson LaLonde
22f1e21d69 feat: add core file types and content detection 2026-01-21 18:23:36 -05:00
lorenzejay
87088171d4 fix 2026-01-21 14:59:47 -08:00
lorenzejay
1757559a3d Merge branch 'main' of github.com:crewAIInc/crewAI into lorenze/imp/native-tool-calling 2026-01-21 13:59:44 -08:00
lorenzejay
6c5d6fb70c Update English translations for tool usage and reasoning instructions
- Revised the `post_tool_reasoning` message to clarify the analysis process after tool usage, emphasizing the need to provide only the final answer if requirements are met.
- Updated the `format` message to simplify the instructions for deciding between using a tool or providing a final answer, enhancing clarity for users.
- These changes improve the overall user experience by providing clearer guidance on task execution and response formatting.
2026-01-21 13:03:35 -08:00
lorenzejay
56dd2f82a4 Refactor AgentExecutor to support batch execution of native tool calls
- Updated the  method to process all tools from  in a single batch, enhancing efficiency and reducing the number of interactions with the LLM.
- Introduced a new utility function  to streamline the extraction of tool call details, improving compatibility with various tool formats.
- Removed the  parameter, simplifying the initialization of the .
- Enhanced logging and message handling to provide clearer insights during tool execution.
- This refactor improves the overall performance and usability of the agent execution flow.
2026-01-21 13:03:06 -08:00
lorenzejay
e562a06836 Add extract_tool_call_info function to handle various tool call formats
- Introduced a new utility function  to extract tool call ID, name, and arguments from different provider formats (OpenAI, Gemini, Anthropic, and dictionary).
- This enhancement improves the flexibility and compatibility of tool calls across multiple LLM providers, ensuring consistent handling of tool call information.
- The function returns a tuple containing the call ID, function name, and function arguments, or None if the format is unrecognized.
2026-01-21 13:02:22 -08:00
lorenzejay
edd1fd73cd for fixing model dump with state 2026-01-21 13:01:42 -08:00
lorenzejay
b0abf169b0 drop max_tools_iterations 2026-01-21 13:00:23 -08:00
lorenzejay
7d5a64af0d fix llm_call_completed event serialization issue 2026-01-21 12:59:28 -08:00
Greyson LaLonde
f997b73577 fix: bump mcp to ~=1.23.1
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Notify Downstream / notify-downstream (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
- resolves [cve](https://nvd.nist.gov/vuln/detail/CVE-2025-66416)
2026-01-21 12:43:48 -05:00
Greyson LaLonde
7a65baeb9c feat: add event ordering and parent-child hierarchy
adds emission sequencing, parent-child event hierarchy with scope management, and integrates both into the event bus. introduces flush() for deterministic handling, resets emission counters for test isolation, and adds chain tracking via previous_event_id/triggered_by_event_id plus context variables populated during emit and listener execution. includes tracing listener typing/sorting improvements, safer tool event pairing with try/finally, additional stack checks and cache-hit formatting, context isolation fixes, cassette regen/decoding, and test updates to handle vcr race conditions and flaky behavior.
2026-01-21 11:12:10 -05:00
lorenzejay
d6e04ba24d fix sync main issues 2026-01-21 07:40:27 -08:00
lorenzejay
1b67629149 Merge branch 'main' of github.com:crewAIInc/crewAI into lorenze/imp/native-tool-calling 2026-01-20 22:05:33 -08:00
Lorenze Jay
741bf12bf4 Lorenze/enh decouple executor from crew (#4209)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Notify Downstream / notify-downstream (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
* wip restrcuturing agent executor and liteagent

* fix: handle None task in AgentExecutor to prevent errors

Added a check to ensure that if the task is None, the method returns early without attempting to access task properties. This change improves the robustness of the AgentExecutor by preventing potential errors when the task is not set.

* refactor: streamline AgentExecutor initialization by removing redundant parameters

Updated the Agent class to simplify the initialization of the AgentExecutor by removing unnecessary task and crew parameters in standalone mode. This change enhances code clarity and maintains backward compatibility by ensuring that the executor is correctly configured without redundant assignments.

* ensure executors work inside a flow due to flow in flow async structure

* refactor: enhance agent kickoff preparation by separating common logic

Updated the Agent class to introduce a new private method  that consolidates the common setup logic for both synchronous and asynchronous kickoff executions. This change improves code clarity and maintainability by reducing redundancy in the kickoff process, while ensuring that the agent can still execute effectively within both standalone and flow contexts.

* linting and tests

* fix test

* refactor: improve test for Agent kickoff parameters

Updated the test for the Agent class to ensure that the kickoff method correctly preserves parameters. The test now verifies the configuration of the agent after kickoff, enhancing clarity and maintainability. Additionally, the test for asynchronous kickoff within a flow context has been updated to reflect the Agent class instead of LiteAgent.

* refactor: update test task guardrail process output for improved validation

Refactored the test for task guardrail process output to enhance the validation of the output against the OpenAPI schema. The changes include a more structured request body and updated response handling to ensure compliance with the guardrail requirements. This update aims to improve the clarity and reliability of the test cases, ensuring that task outputs are correctly validated and feedback is appropriately provided.

* test fix cassette

* test fix cassette

* working

* working cassette

* refactor: streamline agent execution and enhance flow compatibility

Refactored the Agent class to simplify the execution method by removing the event loop check and clarifying the behavior when called from synchronous and asynchronous contexts. The changes ensure that the method operates seamlessly within flow methods, improving clarity in the documentation. Additionally, updated the AgentExecutor to set the response model to None, enhancing flexibility. New test cassettes were added to validate the functionality of agents within flow contexts, ensuring robust testing for both synchronous and asynchronous operations.

* fixed cassette

* Enhance Flow Execution Logic

- Introduced conditional execution for start methods in the Flow class.
- Unconditional start methods are prioritized during kickoff, while conditional starts are executed only if no unconditional starts are present.
- Improved handling of cyclic flows by allowing re-execution of conditional start methods triggered by routers.
- Added checks to continue execution chains for completed conditional starts.

These changes improve the flexibility and control of flow execution, ensuring that the correct methods are triggered based on the defined conditions.

* Enhance Agent and Flow Execution Logic

- Updated the Agent class to automatically detect the event loop and return a coroutine when called within a Flow, simplifying async handling for users.
- Modified Flow class to execute listeners sequentially, preventing race conditions on shared state during listener execution.
- Improved handling of coroutine results from synchronous methods, ensuring proper execution flow and state management.

These changes enhance the overall execution logic and user experience when working with agents and flows in CrewAI.

* Enhance Flow Listener Logic and Agent Imports

- Updated the Flow class to track fired OR listeners, ensuring that multi-source OR listeners only trigger once during execution. This prevents redundant executions and improves flow efficiency.
- Cleared fired OR listeners during cyclic flow resets to allow re-execution in new cycles.
- Modified the Agent class imports to include Coroutine from collections.abc, enhancing type handling for asynchronous operations.

These changes improve the control and performance of flow execution in CrewAI, ensuring more predictable behavior in complex scenarios.

* adjusted test due to new cassette

* ensure we dont finalize batch on just a liteagent finishing

* feat: cancellable parallelized flow methods

* feat: allow methods to be cancelled & run parallelized

* feat: ensure state is thread safe through proxy

* fix: check for proxy state

* fix: mimic BaseModel method

* chore: update final attr checks; test

* better description

* fix test

* chore: update test assumptions

* extra

---------

Co-authored-by: Greyson LaLonde <greyson.r.lalonde@gmail.com>
2026-01-20 21:44:45 -08:00
lorenzejay
b49e42af05 max tools per turn wip and ensure we drop print times 2026-01-20 16:46:38 -08:00
lorenzejay
3472cb4f8a Merge branch 'lorenze/enh-decouple-executor-from-crew' into lorenze/imp/native-tool-calling 2026-01-20 13:26:08 -08:00
lorenzejay
63a33cf01c ensure we dont finalize batch on just a liteagent finishing 2026-01-20 13:23:27 -08:00
lorenzejay
9de0e7cb13 Enhance Tool Name Handling for LLM Compatibility
- Added a new function  to replace invalid characters in function names with underscores, ensuring compatibility with LLM providers.
- Updated the  function to sanitize tool names before validation.
- Modified the  function to use sanitized names for tool registration.

These changes improve the robustness of tool name handling, preventing potential issues with invalid characters in function names.
2026-01-20 13:17:25 -08:00
lorenzejay
4c1f86b32f ensure response model is respected 2026-01-20 11:11:56 -08:00
lorenzejay
822d1f9997 ensure native tool calling works with liteagent 2026-01-20 10:59:57 -08:00
lorenzejay
bfc15ef4bd merged lorenze/enh-decouple-executor-from-crew 2026-01-20 10:41:28 -08:00
lorenzejay
edcf3e3e36 Merge branch 'main' of github.com:crewAIInc/crewAI into lorenze/imp/native-tool-calling 2026-01-20 10:20:18 -08:00
lorenzejay
33d87bdf0f adjusted test due to new cassette 2026-01-20 10:16:00 -08:00
lorenzejay
c16f1dd801 Merge branch 'main' of github.com:crewAIInc/crewAI into lorenze/enh-decouple-executor-from-crew 2026-01-20 10:02:33 -08:00
Lorenze Jay
b267bb4054 Lorenze/fix google vertex api using api keys (#4243)
Some checks failed
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Notify Downstream / notify-downstream (push) Has been cancelled
Check Documentation Broken Links / Check broken links (push) Has been cancelled
Build uv cache / build-cache (3.12) (push) Has been cancelled
Build uv cache / build-cache (3.13) (push) Has been cancelled
Build uv cache / build-cache (3.10) (push) Has been cancelled
Build uv cache / build-cache (3.11) (push) Has been cancelled
* supporting vertex through api key use - expo mode

* docs update here

* docs translations

---------

Co-authored-by: Greyson LaLonde <greyson.r.lalonde@gmail.com>
2026-01-20 09:34:36 -08:00