Skip to content

Fix TypeError in tool calls and KeyError in orchestrator agent creation#81

Open
he-yufeng wants to merge 1 commit intoHKUDS:mainfrom
he-yufeng:fix/tool-args-type-error
Open

Fix TypeError in tool calls and KeyError in orchestrator agent creation#81
he-yufeng wants to merge 1 commit intoHKUDS:mainfrom
he-yufeng:fix/tool-args-type-error

Conversation

@he-yufeng
Copy link
Copy Markdown

Fixes #73 and #71.

Issue #73TypeError: 'str' object does not support item assignment

json.loads(tool_call.function.arguments) can return a string when the LLM outputs a bare JSON value instead of a JSON object. The fix checks the type after parsing and maps the value to the first non-context parameter.

Issue #71KeyError: 'Market Analysis Agent'

create_orchestrator_agent blindly looked up sub-agent names in agent_dict without checking they exist first. The fix returns a descriptive error message listing which sub-agents are missing from the registry.

…r_agent

core.py: json.loads(arguments) can return a non-dict when the LLM emits
a bare JSON value instead of an object. Map it to the first parameter
so the call doesn't crash.

edit_agents.py: create_orchestrator_agent did a blind dict lookup for
each sub-agent name. Return a clear error if any name isn't in the
registry yet, instead of raising a KeyError.

Fixes HKUDS#73, HKUDS#71
@he-yufeng
Copy link
Copy Markdown
Author

Ping — is there anything I should change here? Been a few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

args[__CTX_VARS_NAME__] = context_variables TypeError: 'str' object does not support item assignment

1 participant