This test verifies that the fix in _handle_agent_response_and_continue()
correctly rebuilds the AgentResponse model with both endpoints and skill IDs
for subsequent turns in multi-turn A2A conversations.
The test simulates a multi-turn scenario where:
1. First turn: LLM returns skill ID 'Research'
2. Second turn: LLM returns skill ID 'Writing' (different agent)
3. Third turn: LLM returns skill ID 'Research' again
All turns should accept skill IDs without validation errors.
Co-Authored-By: João <joao@crewai.com>
In multi-turn A2A conversations, the AgentResponse model was only rebuilt
in _execute_task_with_a2a() but not in subsequent turns handled by
_handle_agent_response_and_continue(). This meant that if the LLM returned
a skill ID on a later turn, it would fail validation.
This commit rebuilds the model in _handle_agent_response_and_continue()
using extract_agent_identifiers_from_cards() to include both endpoints
and skill IDs, ensuring all turns support skill ID resolution.
Co-Authored-By: João <joao@crewai.com>
This commit fixes issue #3897 where the LLM would return a skill.id
(e.g., 'Research') instead of the full endpoint URL, causing a
Pydantic validation error.
Changes:
- Added resolve_agent_identifier() function to map skill IDs to endpoints
- Added extract_agent_identifiers_from_cards() to collect both endpoints and skill IDs
- Modified _execute_task_with_a2a() to rebuild AgentResponse model after fetching AgentCards
- Updated _delegate_to_a2a() to use resolver for identifier resolution
- Updated _augment_prompt_with_a2a() to explicitly instruct LLM about both identifier types
- Added comprehensive unit tests for resolve_agent_identifier()
- Added integration tests replicating the exact issue from #3897
The fix allows the dynamic Pydantic model to accept both endpoint URLs
and skill IDs in the Literal constraint, then resolves skill IDs to
their canonical endpoints before delegation. This maintains backward
compatibility while fixing the validation error.
Fixes#3897
Co-Authored-By: João <joao@crewai.com>
- Added support for before and after LLM call hooks to allow modification of messages and responses during LLM interactions.
- Introduced LLMCallHookContext to provide hooks with access to the executor state, enabling in-place modifications of messages.
- Updated get_llm_response function to utilize the new hooks, ensuring that modifications persist across iterations.
- Enhanced tests to verify the functionality of the hooks and their error handling capabilities, ensuring robust execution flow.
* feat: add messages to task and agent outputs
- Introduced a new field in and to capture messages from the last task execution.
- Updated the class to store the last messages and provide a property for easy access.
- Enhanced the and classes to include messages in their outputs.
- Added tests to ensure that messages are correctly included in task outputs and agent outputs during execution.
* using typing_extensions for 3.10 compatability
* feat: add last_messages attribute to agent for improved task tracking
- Introduced a new `last_messages` attribute in the agent class to store messages from the last task execution.
- Updated the `Crew` class to handle the new messages attribute in task outputs.
- Enhanced existing tests to ensure that the `last_messages` attribute is correctly initialized and utilized across various guardrail scenarios.
* fix: add messages field to TaskOutput in tests for consistency
- Updated multiple test cases to include the new `messages` field in the `TaskOutput` instances.
- Ensured that all relevant tests reflect the latest changes in the TaskOutput structure, maintaining consistency across the test suite.
- This change aligns with the recent addition of the `last_messages` attribute in the agent class for improved task tracking.
* feat: preserve messages in task outputs during replay
- Added functionality to the Crew class to store and retrieve messages in task outputs.
- Enhanced the replay mechanism to ensure that messages from stored task outputs are preserved and accessible.
- Introduced a new test case to verify that messages are correctly stored and replayed, ensuring consistency in task execution and output handling.
- This change improves the overall tracking and context retention of task interactions within the CrewAI framework.
* fix original test, prev was debugging
- Added section on LLM-based guardrails, explaining their usage and requirements.
- Updated examples to demonstrate the implementation of multiple guardrails, including both function-based and LLM-based approaches.
- Clarified the distinction between single and multiple guardrails in task configurations.
- Improved explanations of guardrail functionality to ensure better understanding of validation processes.
- Enhanced the MCP tool execution in both synchronous and asynchronous contexts by utilizing for better event loop management.
- Updated error handling to provide clearer messages for connection issues and task cancellations.
- Added tests to validate MCP tool execution in both sync and async scenarios, ensuring robust functionality across different contexts.
* WIP transport support mcp
* refactor: streamline MCP tool loading and error handling
* linted
* Self type from typing with typing_extensions in MCP transport modules
* added tests for mcp setup
* added tests for mcp setup
* docs: enhance MCP overview with detailed integration examples and structured configurations
* feat: implement MCP event handling and logging in event listener and client
- Added MCP event types and handlers for connection and tool execution events.
- Enhanced MCPClient to emit events on connection status and tool execution.
- Updated ConsoleFormatter to handle MCP event logging.
- Introduced new MCP event types for better integration and monitoring.
* fix: update document ID handling in ChromaDB utility functions to use SHA-256 hashing and include index for uniqueness
* test: add tests for hash-based ID generation in ChromaDB utility functions
* drop idx for preventing dups, upsert should handle dups
* fix: update document ID extraction logic in ChromaDB utility functions to check for doc_id at the top level of the document
* fix: enhance document ID generation in ChromaDB utility functions to deduplicate documents and ensure unique hash-based IDs without suffixes
* fix: improve error handling and document ID generation in ChromaDB utility functions to ensure robust processing and uniqueness
fix: refine nested flow conditionals and ensure router methods and routes are fully parsed
fix: improve docstrings, typing, and logging coverage across all events
feat: update flow.plot feature with new UI enhancements
chore: apply Ruff linting, reorganize imports, and remove deprecated utilities/files
chore: split constants and utils, clean JS comments, and add typing for linters
tests: strengthen test coverage for flow execution paths and router logic
* fix: update default LLM model and improve error logging in LLM utilities
* Updated the default LLM model from "gpt-4o-mini" to "gpt-4.1-mini" for better performance.
* Enhanced error logging in the LLM utilities to use logger.error instead of logger.debug, ensuring that errors are properly reported and raised.
* Added tests to verify behavior when OpenAI API key is missing and when Anthropic dependency is not available, improving robustness and error handling in LLM creation.
* fix: update test for default LLM model usage
* Refactored the test_create_llm_with_none_uses_default_model to use the imported DEFAULT_LLM_MODEL constant instead of a hardcoded string.
* Ensured that the test correctly asserts the model used is the current default, improving maintainability and consistency across tests.
* change default model to gpt-4.1-mini
* change default model use defualt
* feat: enhance InternalInstructor to support multiple LLM providers
- Updated InternalInstructor to conditionally create an instructor client based on the LLM provider.
- Introduced a new method _create_instructor_client to handle client creation using the modern from_provider pattern.
- Added functionality to extract the provider from the LLM model name.
- Implemented tests for InternalInstructor with various LLM providers including OpenAI, Anthropic, Gemini, and Azure, ensuring robust integration and error handling.
This update improves flexibility and extensibility for different LLM integrations.
* fix test
Fix navigation paths for two integration tool cards that were redirecting to the
introduction page instead of their intended documentation pages.
Fixes#3516
Co-authored-by: Cwarre33 <cwarre33@charlotte.edu>
Co-authored-by: Greyson LaLonde <greyson.r.lalonde@gmail.com>
* Implement improvements on QdrantVectorSearchTool
- Allow search filters to be set at the constructor level
- Fix issue that prevented multiple records from being returned
* Implement improvements on QdrantVectorSearchTool
- Allow search filters to be set at the constructor level
- Fix issue that prevented multiple records from being returned
---------
Co-authored-by: Greyson LaLonde <greyson.r.lalonde@gmail.com>
* chore: update codeql config paths to new folders
* tests: use threading.Condition for event check
---------
Co-authored-by: Lorenze Jay <63378463+lorenzejay@users.noreply.github.com>
* docs: update LLM integration details and examples
- Changed references from LiteLLM to native SDKs for LLM providers.
- Enhanced OpenAI and AWS Bedrock sections with new usage examples and advanced configuration options.
- Added structured output examples and supported environment variables for better clarity.
- Improved documentation on additional parameters and features for LLM configurations.
* drop this example - should use strucutred output from task instead
---------
Co-authored-by: Greyson LaLonde <greyson.r.lalonde@gmail.com>