AutoGen adapter: converting a tool with an untyped input property raises KeyError: 'type'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 420
- Forks
- 60
- Avg merge
- 9h 30m
- Merged PRs (30d)
- 4
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
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.
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.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 86/100