AutoGen adapter: converting a tool with an untyped input property raises KeyError: 'type'
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
Research direction
Start in pyagentspec/src/pyagentspec/adapters/autogen/_autogenconverter.py, at _json_schema_type_to_python_annotation, and run the reproduction from the issue with a property missing type. Done means the AutoGen adapter converts that input as Any and an array without items as List[Any], without raising KeyError.
Written by the indexing model from the issue text.
Description
Description
The AutoGen adapter fails to convert any tool whose input property has no type in its JSON schema. A property without type is valid Agent Spec and means "any value" (Property(json_schema={"title": "anything"})), and the LangGraph and Agent Framework adapters accept it.
Reproduction
from pyagentspec.adapters.autogen import AgentSpecLoader
from pyagentspec.property import Property, StringProperty
from pyagentspec.tools import ServerTool
from typing import Any
echo_tool = ServerTool(
name="echo",
description="Echoes any value as a string",
inputs=[Property(json_schema={"title": "anything"})],
outputs=[StringProperty(title="echoed")],
)
def echo(anything: Any) -> str:
return str(anything)
AgentSpecLoader(tool_registry={"echo": echo}).load_component(echo_tool)
File ".../pyagentspec/adapters/autogen/_autogenconverter.py", line 78, in _json_schema_type_to_python_annotation
if isinstance(json_schema["type"], list):
KeyError: 'type'
Expected behavior
The tool converts, with the untyped input annotated as Any (and an array without items as List[Any]), as the Agent Framework converter already does.
Root cause
_json_schema_type_to_python_annotation in pyagentspec/src/pyagentspec/adapters/autogen/_autogenconverter.py indexes json_schema["type"] (and json_schema["items"]) directly instead of using .get().
Environment
- pyagentspec
main(26.4.0.dev0), autogen-core 0.7.4, Python 3.12
- Dominant language
- Python
- Stars
- 421
- Forks
- 60
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from oracle/agent-spec
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
oracle/agent-spec#255 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
oracle/agent-spec#254 ·
-
LangGraph adapter: ToolNode without declared outputs fails with "Unsupported multi-output mapping" Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
oracle/agent-spec#251 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
oracle/agent-spec#220 ·
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
oracle/agent-spec#265 ·
All issues in oracle/agent-spec
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100