Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion autoagent/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,17 @@ def handle_tool_calls(
)
continue
args = json.loads(tool_call.function.arguments)

if not isinstance(args, dict):
# The LLM occasionally returns a bare JSON value (string, number)
# instead of a JSON object. Map it to the first non-context
# parameter so the call can still proceed.
func_sig = inspect.signature(function_map[name])
first_param = next(
(p for p in func_sig.parameters if p != __CTX_VARS_NAME__),
None,
)
args = {first_param: args} if first_param else {}

# debug_print(
# debug, f"Processing tool call: {name} with arguments {args}")
func = function_map[name]
Expand Down
3 changes: 3 additions & 0 deletions autoagent/tools/meta/edit_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ def create_orchestrator_agent(agent_name: str, agent_description: str, sub_agent
if agent_list.startswith("[ERROR]"):
return "Failed to list agents. Error: " + agent_list
agent_dict = json.loads(agent_list)
missing = [sa["name"] for sa in sub_agents if sa["name"] not in agent_dict]
if missing:
return f"[ERROR] Sub-agent(s) not found in registry: {missing}. Register them first."
sub_agent_info = [agent_dict[sub_agent["name"]] for sub_agent in sub_agents]
import_agent_str = ""
for ainfo in sub_agent_info:
Expand Down