-
Notifications
You must be signed in to change notification settings - Fork 137
fix(agent_builder): correct sub-agent tuple return format #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
andersonlemesc
wants to merge
3
commits into
EvolutionAPI:develop
Choose a base branch
from
andersonlemesc:fix/websocket-format-error
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix(agent_builder): correct sub-agent tuple return format #36
andersonlemesc
wants to merge
3
commits into
EvolutionAPI:develop
from
andersonlemesc:fix/websocket-format-error
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reviewer's GuideThis PR fixes the tuple return format in _get_sub_agents by appending sub-agents as (LlmAgent, AsyncExitStack) pairs, resolving unpacking errors during WebSocket handling. Sequence Diagram: Fix for Sub-Agent Unpacking ErrorsequenceDiagram
participant C as Caller
participant ASG as agent_builder._get_sub_agents
C->>ASG: Call _get_sub_agents(...)
activate ASG
%% Previously, ASG would prepare a list of LlmAgent objects.
%% Now, ASG prepares a list of (LlmAgent, Optional[AsyncExitStack]) tuples.
ASG-->>C: Returns sub_agents_list
deactivate ASG
alt Old behavior (sub_agents_list elements were LlmAgent objects)
C->>C: Attempt to unpack item: agent, stack = item_from_list
C-->>C: Raises ValueError: too many values to unpack (expected 2)
else New behavior (sub_agents_list elements are (LlmAgent, Optional[AsyncExitStack]) tuples)
C->>C: Unpack item: agent, stack = item_from_list
C-->>C: Successfully unpacks tuple
end
Class Diagram: Update to _get_sub_agents Return Type in agent_builderclassDiagram
class agent_builder {
+ _get_sub_agents(...) : List~(LlmAgent, Optional~AsyncExitStack~)~
}
class LlmAgent {
%% Represents an LLM Agent
}
class AsyncExitStack {
%% Represents an asynchronous exit stack, potentially optional
}
agent_builder ..> LlmAgent : uses/returns
agent_builder ..> AsyncExitStack : uses/returns
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
d1b35cb
to
242421a
Compare
- Fix original websocket format error - Add robust model validation for all agent types - Prevent empty model strings in LiteLLM calls - Update Pydantic V2 compatibility (dict() -> model_dump()) - Improve error handling in workflow agents - Add comprehensive logging and validation
242421a
to
d4618fa
Compare
…ints - Update config_type validation to accept ['studio', 'sse'] instead of ['studio', 'custom'] - Update type validation to accept ['official', 'community'] instead of ['official', 'custom'] - Resolves ResponseValidationError when listing MCP servers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request addresses multiple critical issues in agent creation and handling that were causing runtime errors and WebSocket connection problems.
Original Issue (2 days ago)
Fixed an issue in
agent_builder.py
where the function_get_sub_agents
was returning sub-agents without the expected tuple format. This caused aValueError: too many values to unpack (expected 2)
error during WebSocket connection handling, leading to connection closures.Additional Critical Fixes (Recent)
Extended the PR to address comprehensive LLM model validation and agent type handling issues:
Agent Builder Enhancements
Workflow Agent Improvements
Schema & Compatibility Updates
dict()
→model_dump()
)Problems Solved
LiteLLM "provider not provided"
errors ✅Changes Made
_get_sub_agents
to return a list of tuples, each containing aLlmAgent
and anOptional[AsyncExitStack]
Testing
Impact
Resolves critical runtime errors and improves overall system stability by ensuring proper agent creation, validation, and execution across all agent types.
Summary by Sourcery
Bug Fixes:
_get_sub_agents
to resolve the too-many-values-to-unpack error and avoid WebSocket connection closures