* test: add tests to test get_crews
* feat: improve Crew search while resetting their memories
Some memories couldn't be reset due to their reliance on relative external sources like `PDFKnowledge`. This was caused by the need to run the reset memories command from the `src` directory, which could break when external files weren't accessible from that path.
This commit allows the reset command to be executed from the root of the project — the same location typically used to run a crew — improving compatibility and reducing friction.
* feat: skip cli/templates folder while looking for Crew
* refactor: use console.print instead of print
* fix: possible fix for Thinking stuck
* feat: add agent logging events for execution tracking
- Introduced AgentLogsStartedEvent and AgentLogsExecutionEvent to enhance logging capabilities during agent execution.
- Updated CrewAgentExecutor to emit these events at the start and during execution, respectively.
- Modified EventListener to handle the new logging events and format output accordingly in the console.
- Enhanced ConsoleFormatter to display agent logs in a structured format, improving visibility of agent actions and outputs.
* drop emoji
* refactor: improve code structure and logging in LiteAgent and ConsoleFormatter
- Refactored imports in lite_agent.py for better readability.
- Enhanced guardrail property initialization in LiteAgent.
- Updated logging functionality to emit AgentLogsExecutionEvent for better tracking.
- Modified ConsoleFormatter to include tool arguments and final output in status updates.
- Improved output formatting for long text in ConsoleFormatter.
* fix tests
---------
Co-authored-by: Eduardo Chiarotti <dudumelgaco@hotmail.com>
* Fix issue 2993: Prevent Flow status logs from hiding human input
- Add pause_live_updates() and resume_live_updates() methods to ConsoleFormatter
- Modify _ask_human_input() to pause Flow status updates during human input
- Add comprehensive tests for pause/resume functionality and integration
- Ensure Live session is properly managed during human input prompts
- Fix prevents Flow status logs from overwriting user input prompts
Fixes#2993
Co-Authored-By: João <joao@crewai.com>
* Fix lint: Remove unused pytest import
- Remove unused pytest import from test_console_formatter_pause_resume.py
- Fixes F401 lint error identified in CI
Co-Authored-By: João <joao@crewai.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: João <joao@crewai.com>
* Fix telemetry singleton pattern to respect dynamic environment variables
- Modified Telemetry.__init__ to prevent re-initialization with _initialized flag
- Updated _safe_telemetry_operation to check _is_telemetry_disabled() dynamically
- Added comprehensive tests for environment variables set after singleton creation
- Fixed singleton contamination in existing tests by adding proper reset
- Resolves issue #2945 where CREWAI_DISABLE_TELEMETRY=true was ignored when set after import
Co-Authored-By: João <joao@crewai.com>
* Implement code review improvements
- Move _initialized flag to __new__ method for better encapsulation
- Add type hints to _safe_telemetry_operation method
- Consolidate telemetry execution checks into _should_execute_telemetry helper
- Add pytest fixtures to reduce test setup redundancy
- Enhanced documentation for singleton behavior
Co-Authored-By: João <joao@crewai.com>
* Fix mypy type-checker errors
- Add explicit bool type annotation to _initialized field
- Fix return value in task_started method to not return _safe_telemetry_operation result
- Simplify initialization logic to set _initialized once in __init__
Co-Authored-By: João <joao@crewai.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: João <joao@crewai.com>
Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>
* feat: add guardrail support for Agents when using direct kickoff calls
* refactor: expose guardrail func in a proper utils file
* fix: resolve Self import on python 3.10
* test: fix structured tool tests
No tests were being executed from this file
* feat: support to run async tool
Some Tool requires async execution. This commit allow us to collect tool result from coroutines
* docs: add docs about asynchronous tool support
* docs: add organization management in our CLI docs
* feat: improve user feedback when user is not authenticated
* feat: improve logging about current organization while publishing/install a Tool
* feat: improve logging when Agent repository is not found during fetch
* fix linter offences
* test: fix auth token error
* feat: support to list, switch and see your current organization
* feat: store the current org after logged in
* feat: filtering agents, tools and their actions by organization_uuid if present
* fix linter offenses
* refactor: propagate the current org thought Header instead of params
* refactor: rename org column name to ID instead of Handle
---------
Co-authored-by: Tony Kipkemboi <iamtonykipkemboi@gmail.com>
Previously, we only supported tools from the crewai-tools open-source repository. Now, we're introducing improved support for private tool repositories.
* feat: add capability to see and expose public Tool classes
* feat: persist available Tools from repository on publish
* ci: ignore explictly templates from ruff check
Ruff only applies --exclude to files it discovers itself. So we have to skip manually the same files excluded from `ruff.toml`
* sytle: fix linter issues
* refactor: renaming available_tools_classes by available_exports
* feat: provide more context about exportable tools
* feat: allow to install a Tool from pypi
* test: fix tests
* feat: add env_vars attribute to BaseTool
* remove TODO: security check since we are handle that on enterprise side
* Add usage limit feature to BaseTool class
- Add max_usage_count and current_usage_count attributes to BaseTool
- Implement usage limit checking in ToolUsage._use method
- Add comprehensive tests for usage limit functionality
- Maintain backward compatibility with None default for unlimited usage
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix CI failures and address code review feedback
- Add max_usage_count/current_usage_count to CrewStructuredTool
- Add input validation for positive max_usage_count
- Add reset_usage_count method to BaseTool
- Extract usage limit check into separate method
- Add comprehensive edge case tests
- Add proper type hints throughout
- Fix linting issues
Co-Authored-By: Joe Moura <joao@crewai.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
* feat: Add inject_date flag to Agent for automatic date injection
Co-Authored-By: Joe Moura <joao@crewai.com>
* feat: Add date_format parameter and error handling to inject_date feature
Co-Authored-By: Joe Moura <joao@crewai.com>
* fix: Update test implementation for inject_date feature
Co-Authored-By: Joe Moura <joao@crewai.com>
* fix: Add date format validation to prevent invalid formats
Co-Authored-By: Joe Moura <joao@crewai.com>
* docs: Update documentation for inject_date feature
Co-Authored-By: Joe Moura <joao@crewai.com>
* unnecesary
* new tests
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
Co-authored-by: João Moura <joaomdmoura@gmail.com>
- Add `HallucinationGuardrail` class as enterprise feature placeholder
- Update LLM guardrail events to support `HallucinationGuardrail` instances
- Add comprehensive tests for `HallucinationGuardrail` initialization and behavior
- Add integration tests for `HallucinationGuardrail` with task execution system
- Ensure no-op behavior always returns True
* Refactor Crew class memory initialization and enhance event handling
- Simplified the initialization of the external memory attribute in the Crew class.
- Updated memory system retrieval logic for consistency in key usage.
- Introduced a singleton pattern for the Telemetry class to ensure a single instance.
- Replaced telemetry usage in CrewEvaluator with event bus emissions for test results.
- Added new CrewTestResultEvent to handle crew test results more effectively.
- Updated event listener to process CrewTestResultEvent and log telemetry data accordingly.
- Enhanced tests to validate the singleton pattern in Telemetry and the new event handling logic.
* linted
* Remove unused telemetry attribute from Crew class memory initialization
* fix ordering of test
* Implement thread-safe singleton pattern in Telemetry class
- Introduced a threading lock to ensure safe instantiation of the Telemetry singleton.
- Updated the __new__ method to utilize double-checked locking for instance creation.
* Add reasoning attribute to Agent class
Co-Authored-By: Joe Moura <joao@crewai.com>
* Address PR feedback: improve type hints, error handling, refactor reasoning handler, and enhance tests and docs
Co-Authored-By: Joe Moura <joao@crewai.com>
* Implement function calling for reasoning and move prompts to translations
Co-Authored-By: Joe Moura <joao@crewai.com>
* Simplify function calling implementation with better error handling
Co-Authored-By: Joe Moura <joao@crewai.com>
* Enhance system prompts to leverage agent context (role, goal, backstory)
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix lint and type-checker issues
Co-Authored-By: Joe Moura <joao@crewai.com>
* Enhance system prompts to better leverage agent context
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix backstory access in reasoning handler for Python 3.12 compatibility
Co-Authored-By: Joe Moura <joao@crewai.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
Co-authored-by: João Moura <joaomdmoura@gmail.com>
* Add markdown attribute to Task class for formatting responses in Markdown
Co-Authored-By: Joe Moura <joao@crewai.com>
* Enhance markdown feature based on PR feedback
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix lint error and validation error in test_markdown_task.py
Co-Authored-By: Joe Moura <joao@crewai.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
* Changed test case
* Addd new interaction with llama
* fixed linting issue
* Gemma Flaky test case
* Gemma Flaky test case
* Minor change
* Minor change
* Dropped API key
* Removed falky test case check file
* Enhance string interpolation to support hyphens in variable names and add corresponding test cases. Update existing tests for consistency and formatting.
* Refactor tests in task_test.py by removing unused Task instances to streamline test cases for the interpolate_only method and related functions.
* CLI command added
* Added reset agent knowledge function
* Reduced verbose
* Added test cases
* Added docs
* Llama test case failing
* Changed _reset_agent_knowledge function
* Fixed new line error
* Added docs
* fixed the new line error
* Refractored
* Uncommmented some test cases
* ruff check fixed
* fixed run type checks
* fixed run type checks
* fixed run type checks
* Made reset_fn callable by casting to silence run type checks
* Changed the reset_knowledge as it expects only list of knowledge
* Fixed typo in docs
* Refractored the memory_system
* Minor Changes
* fixed test case
* Fixed linting issues
* Network test cases failing
---------
Co-authored-by: Lucas Gomide <lucaslg200@gmail.com>
* feat: implement knowledge retrieval events in Agent
This commit introduces a series of knowledge retrieval events in the Agent class, enhancing its ability to handle knowledge queries. New events include KnowledgeRetrievalStartedEvent, KnowledgeRetrievalCompletedEvent, KnowledgeQueryGeneratedEvent, KnowledgeQueryFailedEvent, and KnowledgeSearchQueryCompletedEvent. The Agent now emits these events during knowledge retrieval processes, allowing for better tracking and handling of knowledge queries. Additionally, the console formatter has been updated to handle these new events, providing visual feedback during knowledge retrieval operations.
* refactor: update knowledge query handling in Agent
This commit refines the knowledge query processing in the Agent class by renaming variables for clarity and optimizing the query rewriting logic. The system prompt has been updated in the translation file to enhance clarity and context for the query rewriting process. These changes aim to improve the overall readability and maintainability of the code.
* fix: add missing newline at end of en.json file
* fix broken tests
* refactor: rename knowledge query events and enhance retrieval handling
This commit renames the KnowledgeQueryGeneratedEvent to KnowledgeQueryStartedEvent to better reflect its purpose. It also updates the event handling in the EventListener and ConsoleFormatter classes to accommodate the new event structure. Additionally, the retrieval knowledge is now included in the KnowledgeRetrievalCompletedEvent, improving the overall knowledge retrieval process.
* docs for transparancy
* refactor: improve error handling in knowledge query processing
This commit refactors the knowledge query handling in the Agent class by changing the order of checks for LLM compatibility. It now logs a warning and emits a failure event if the LLM is not an instance of BaseLLM before attempting to call the LLM. Additionally, the task_prompt attribute has been removed from the KnowledgeQueryFailedEvent, simplifying the event structure.
* test: add unit test for knowledge search query and VCR cassette
This commit introduces a new test, `test_get_knowledge_search_query`, to verify that the `_get_knowledge_search_query` method in the Agent class correctly interacts with the LLM using the appropriate prompts. Additionally, a VCR cassette is added to record the interactions with the OpenAI API for this test, ensuring consistent and reliable test results.
This commit adds a new crew field called parent_flow, evaluated when the Crew
instance is instantiated. The stacktrace is traversed to look up if the caller
is an instance of Flow, and if so, it fills in the field.
Other alternatives were considered, such as a global context or even a new
field to be manually filled, however, this is the most magical solution that
was thread-safe and did not require public API changes.
* fix: support to reset memories after changing Crew's embedder
The sources must not be added while initializing the Knowledge otherwise we could not reset it
* chore: improve reset memory feedback
Previously, even when no memories were actually erased, we logged that they had been. From now on, the log will specify which memory has been reset.
* feat: improve get_crew discovery from a single file
Crew instances can now be discovered from any function or method with a return type annotation of -> Crew, as well as from module-level attributes assigned to a Crew instance. Additionally, crews can be retrieved from within a Flow
* refactor: make add_sources a public method from Knowledge
* build(dev): add pytest-randomly dependency
By randomizing the test execution order, this helps identify tests
that unintentionally depend on shared state or specific execution
order, which can lead to flaky or unreliable test behavior.
* build(dev): add pytest-timeout
This will prevent a test from running indefinitely
* test: block external requests in CI and set default 10s timeout per test
* test: adding missing cassettes
We notice that those cassettes are missing after enabling block-network on CI
* test: increase tests timeout on CI
* test: fix flaky test ValueError: Circular reference detected (id repeated)
* fix: prevent crash when event handler raises exception
Previously, if a registered event handler raised an exception during execution,
it could crash the entire application or interrupt the event dispatch process.
This change wraps handler execution in a try/except block within the `emit` method,
ensuring that exceptions are caught and logged without affecting other handlers or flow.
This improves the resilience of the event bus, especially when handling third-party
or temporary listeners.
* feat: support to define a guardrail task no-code
* feat: add auto-discovery for Guardrail code execution mode
* feat: handle malformed or invalid response from CodeInterpreterTool
* feat: allow to set unsafe_mode from Guardrail task
* feat: renaming GuardrailTask to TaskGuardrail
* feat: ensure guardrail is callable while initializing Task
* feat: remove Docker availability check from TaskGuardrail
The CodeInterpreterTool already ensures compliance with this requirement.
* refactor: replace if/raise with assert
For this use case `assert` is more appropriate choice
* test: remove useless or duplicated test
* fix: attempt to fix type-checker
* feat: support to define a task guardrail using YAML config
* refactor: simplify TaskGuardrail to use LLM for validation, no code generation
* docs: update TaskGuardrail doc strings
* refactor: drop task paramenter from TaskGuardrail
This parameter was used to get the model from the `task.agent` which is a quite bit redudant since we could propagate the llm directly
Add `__init__.py` files to 20 directories to conform with Python package standards. This ensures directories are properly recognized as packages, enabling cleaner imports.
* Fix issue #2402: Handle missing templates gracefully
Co-Authored-By: Joe Moura <joao@crewai.com>
* Fix import sorting in test files
Co-Authored-By: Joe Moura <joao@crewai.com>
* Bluit in top of devin-ai integration
* Fixed test cases
* Fixed test cases
* fixed linting issue
* Added docs
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Joe Moura <joao@crewai.com>
* added gpt4.1 models and gemini 2.0 and 2.5 models
* added flash model
* Updated test fun to all models
* Added Gemma3 test cases and passed all google test case
* added gemini 2.5 flash
* added gpt4.1 models and gemini 2.0 and 2.5 models
* added flash model
* Updated test fun to all models
* Added Gemma3 test cases and passed all google test case
* added gemini 2.5 flash
* added gpt4.1 models and gemini 2.0 and 2.5 models
* added flash model
* Updated test fun to all models
* Added Gemma3 test cases and passed all google test case
* added gemini 2.5 flash
* test: add missing cassettes
* test: ignore authorization key from gemini/gemma3 request
---------
Co-authored-by: Lucas Gomide <lucaslg200@gmail.com>
Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>
* Enhance knowledge management in CrewAI
- Added `KnowledgeConfig` class to configure knowledge retrieval parameters such as `limit` and `score_threshold`.
- Updated `Agent` and `Crew` classes to utilize the new knowledge configuration for querying knowledge sources.
- Enhanced documentation to clarify the addition of knowledge sources at both agent and crew levels.
- Introduced new tips in documentation to guide users on knowledge source management and configuration.
* Refactor knowledge configuration parameters in CrewAI
- Renamed `limit` to `results_limit` in `KnowledgeConfig`, `query_knowledge`, and `query` methods for consistency and clarity.
- Updated related documentation to reflect the new parameter name, ensuring users understand the configuration options for knowledge retrieval.
* Refactor agent tests to utilize mock knowledge storage
- Updated test cases in `agent_test.py` to use `KnowledgeStorage` for mocking knowledge sources, enhancing test reliability and clarity.
- Renamed `limit` to `results_limit` in `KnowledgeConfig` for consistency with recent changes.
- Ensured that knowledge queries are properly mocked to return expected results during tests.
* Add VCR support for agent tests with query limits and score thresholds
- Introduced `@pytest.mark.vcr` decorator in `agent_test.py` for tests involving knowledge sources, ensuring consistent recording of HTTP interactions.
- Added new YAML cassette files for `test_agent_with_knowledge_sources_with_query_limit_and_score_threshold` and `test_agent_with_knowledge_sources_with_query_limit_and_score_threshold_default`, capturing the expected API responses for these tests.
- Enhanced test reliability by utilizing VCR to manage external API calls during testing.
* Update documentation to format parameter names in code style
- Changed the formatting of `results_limit` and `score_threshold` in the documentation to use code style for better clarity and emphasis.
- Ensured consistency in documentation presentation to enhance user understanding of configuration options.
* Enhance KnowledgeConfig with field descriptions
- Updated `results_limit` and `score_threshold` in `KnowledgeConfig` to use Pydantic's `Field` for improved documentation and clarity.
- Added descriptions to both parameters to provide better context for their usage in knowledge retrieval configuration.
* docstrings added
* feat: add OpenAI agent adapter implementation
- Introduced OpenAIAgentAdapter class to facilitate interaction with OpenAI Assistants.
- Implemented methods for task execution, tool configuration, and response processing.
- Added support for converting CrewAI tools to OpenAI format and handling delegation tools.
* created an adapter for the delegate and ask_question tools
* delegate and ask_questions work and it delegates to crewai agents*
* refactor: introduce OpenAIAgentToolAdapter for tool management
- Created OpenAIAgentToolAdapter class to encapsulate tool configuration and conversion for OpenAI Assistant.
- Removed tool configuration logic from OpenAIAgentAdapter and integrated it into the new adapter.
- Enhanced the tool conversion process to ensure compatibility with OpenAI's requirements.
* feat: implement BaseAgentAdapter for agent integration
- Introduced BaseAgentAdapter as an abstract base class for agent adapters in CrewAI.
- Defined common interface and methods for configuring tools and structured output.
- Updated OpenAIAgentAdapter to inherit from BaseAgentAdapter, enhancing its structure and functionality.
* feat: add LangGraph agent and tool adapter for CrewAI integration
- Introduced LangGraphAgentAdapter to facilitate interaction with LangGraph agents.
- Implemented methods for task execution, context handling, and tool configuration.
- Created LangGraphToolAdapter to convert CrewAI tools into LangGraph-compatible format.
- Enhanced error handling and logging for task execution and streaming processes.
* feat: enhance LangGraphToolAdapter and improve conversion instructions
- Added type hints for better clarity and type checking in LangGraphToolAdapter.
- Updated conversion instructions to ensure compatibility with optional LLM checks.
* feat: integrate structured output handling in LangGraph and OpenAI agents
- Added LangGraphConverterAdapter for managing structured output in LangGraph agents.
- Enhanced LangGraphAgentAdapter to utilize the new converter for system prompt and task execution.
- Updated LangGraphToolAdapter to use StructuredTool for better compatibility.
- Introduced OpenAIConverterAdapter for structured output management in OpenAI agents.
- Improved task execution flow in OpenAIAgentAdapter to incorporate structured output configuration and post-processing.
* feat: implement BaseToolAdapter for tool integration
- Introduced BaseToolAdapter as an abstract base class for tool adapters in CrewAI.
- Updated LangGraphToolAdapter and OpenAIAgentToolAdapter to inherit from BaseToolAdapter, enhancing their structure and functionality.
- Improved tool configuration methods to support better integration with various frameworks.
- Added type hints and documentation for clarity and maintainability.
* feat: enhance OpenAIAgentAdapter with configurable agent properties
- Refactored OpenAIAgentAdapter to accept agent configuration as an argument.
- Introduced a method to build a system prompt for the OpenAI agent, improving task execution context.
- Updated initialization to utilize role, goal, and backstory from kwargs, enhancing flexibility in agent setup.
- Improved tool handling and integration within the adapter.
* feat: enhance agent adapters with structured output support
- Introduced BaseConverterAdapter as an abstract class for structured output handling.
- Implemented LangGraphConverterAdapter and OpenAIConverterAdapter to manage structured output in their respective agents.
- Updated BaseAgentAdapter to accept an agent configuration dictionary during initialization.
- Enhanced LangGraphAgentAdapter to utilize the new converter and improved tool handling.
- Added methods for configuring structured output and enhancing system prompts in converter adapters.
* refactor: remove _parse_tools method from OpenAIAgentAdapter and BaseAgent
- Eliminated the _parse_tools method from OpenAIAgentAdapter and its abstract declaration in BaseAgent.
- Cleaned up related test code in MockAgent to reflect the removal of the method.
* also removed _parse_tools here as not used
* feat: add dynamic import handling for LangGraph dependencies
- Implemented conditional imports for LangGraph components to handle ImportError gracefully.
- Updated LangGraphAgentAdapter initialization to check for LangGraph availability and raise an informative error if dependencies are missing.
- Enhanced the agent adapter's robustness by ensuring it only initializes components when the required libraries are present.
* fix: improve error handling for agent adapters
- Updated LangGraphAgentAdapter to raise an ImportError with a clear message if LangGraph dependencies are not installed.
- Refactored OpenAIAgentAdapter to include a similar check for OpenAI dependencies, ensuring robust initialization and user guidance for missing libraries.
- Enhanced overall error handling in agent adapters to prevent runtime issues when dependencies are unavailable.
* refactor: enhance tool handling in agent adapters
- Updated BaseToolAdapter to initialize original and converted tools in the constructor.
- Renamed method `all_tools` to `tools` for clarity in BaseToolAdapter.
- Added `sanitize_tool_name` method to ensure tool names are API compatible.
- Modified LangGraphAgentAdapter to utilize the updated tool handling and ensure proper tool configuration.
- Refactored LangGraphToolAdapter to streamline tool conversion and ensure consistent naming conventions.
* feat: emit AgentExecutionCompletedEvent in agent adapters
- Added emission of AgentExecutionCompletedEvent in both LangGraphAgentAdapter and OpenAIAgentAdapter to signal task completion.
- Enhanced event handling to include agent, task, and output details for better tracking of execution results.
* docs: Enhance BaseConverterAdapter documentation
- Added a detailed docstring to the BaseConverterAdapter class, outlining its purpose and the expected functionality for all converter adapters.
- Updated the post_process_result method's docstring to specify the expected format of the result as a string.
* docs: Add comprehensive guide for bringing custom agents into CrewAI
- Introduced a new documentation file detailing the process of integrating custom agents using the BaseAgentAdapter, BaseToolAdapter, and BaseConverter.
- Included step-by-step instructions for creating custom adapters, configuring tools, and handling structured output.
- Provided examples for implementing adapters for various frameworks, enhancing the usability of CrewAI for developers.
* feat: Introduce adapted_agent flag in BaseAgent and update BaseAgentAdapter initialization
- Added an `adapted_agent` boolean field to the BaseAgent class to indicate if the agent is adapted.
- Updated the BaseAgentAdapter's constructor to pass `adapted_agent=True` to the superclass, ensuring proper initialization of the new field.
* feat: Enhance LangGraphAgentAdapter to support optional agent configuration
- Updated LangGraphAgentAdapter to conditionally apply agent configuration when creating the agent graph, allowing for more flexible initialization.
- Modified LangGraphToolAdapter to ensure only instances of BaseTool are converted, improving tool compatibility and handling.
* feat: Introduce OpenAIConverterAdapter for structured output handling
- Added OpenAIConverterAdapter to manage structured output conversion for OpenAI agents, enhancing their ability to process and format results.
- Updated OpenAIAgentAdapter to utilize the new converter for configuring structured output and post-processing results.
- Removed the deprecated get_output_converter method from OpenAIAgentAdapter.
- Added unit tests for BaseAgentAdapter and BaseToolAdapter to ensure proper functionality and integration of new features.
* feat: Enhance tool adapters to support asynchronous execution
- Updated LangGraphToolAdapter and OpenAIAgentToolAdapter to handle asynchronous tool execution by checking if the output is awaitable.
- Introduced `inspect` import to facilitate the awaitability check.
- Refactored tool wrapper functions to ensure proper handling of both synchronous and asynchronous tool results.
* fix: Correct method definition syntax and enhance tool adapter implementation
- Updated the method definition for `configure_structured_output` to include the `def` keyword for clarity.
- Added an asynchronous tool wrapper to ensure tools can operate in both synchronous and asynchronous contexts.
- Modified the constructor of the custom converter adapter to directly assign the agent adapter, improving clarity and functionality.
* linted
* refactor: Improve tool processing logic in BaseAgent
- Added a check to return an empty list if no tools are provided.
- Simplified the tool attribute validation by using a list of required attributes.
- Removed commented-out abstract method definition for clarity.
* refactor: Simplify tool handling in agent adapters
- Changed default value of `tools` parameter in LangGraphAgentAdapter to None for better handling of empty tool lists.
- Updated tool initialization in both LangGraphAgentAdapter and OpenAIAgentAdapter to directly pass the `tools` parameter, removing unnecessary list handling.
- Cleaned up commented-out code in OpenAIConverterAdapter to improve readability.
* refactor: Remove unused stream_task method from LangGraphAgentAdapter
- Deleted the `stream_task` method from LangGraphAgentAdapter to streamline the code and eliminate unnecessary complexity.
- This change enhances maintainability by focusing on essential functionalities within the agent adapter.
* feat: unblock LLM(stream=True) to work with tools
* feat: replace pytest-vcr by pytest-recording
1. pytest-vcr does not support httpx - which LiteLLM uses for streaming responses.
2. pytest-vcr is no longer maintained, last commit 6 years ago :fist::skin-tone-4:
3. pytest-recording supports modern request libraries (including httpx) and actively maintained
* refactor: remove @skip_streaming_in_ci
Since we have fixed streaming response issue we can remove this @skip_streaming_in_ci
---------
Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>