AutoGen adapter: converting a tool with an untyped input property raises KeyError: 'type'

Open Beginner friendly
#253 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
tooling

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from oracle/agent-spec

All issues in oracle/agent-spec

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.