Skip to content

Failed to call _from_config() when HttpTool in StaticStreamWorkbench #7172

@a171232886

Description

@a171232886

What happened?

Describe the bug
I created a tool using HttpTool and used it in StaticStreamWorkbench. It worked fine.
However, when I created a new instance of StaticStreamWorkbench by calling _from_config(), I got an error:

pydantic_core._pydantic_core.ValidationError: 1 validation error for HttpToolConfig
headers
  Field required [type=missing, input_value={'name': 'base64_decode',... 'text', 'timeout': 5.0}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.12/v/missing

Maybe HttpTool has some problems to cause the failure of _from_config().

env version:

  • autogen-core: 0.7.5
  • autogen-ext: 0.7.5
  • Python 3.13.9

To Reproduce
Here is the code:

from autogen_core.tools import StaticStreamWorkbench
from autogen_ext.tools.http import HttpTool


async def build():
    tool2 = HttpTool(
        name="base64_decode",
        description="base64 decode a value",
        scheme="https",
        host="httpbin.org",
        port=443,
        path="/base64/{value}",
        method="GET",
        json_schema={
            "type": "object",
            "properties": {
                "value": {"type": "string", "description": "The base64 value to decode"},
            },
            "required": ["value"],
        }
    )


    workbench = StaticStreamWorkbench(tools=[tool2])

    return workbench

async def run():
    workbench = await build()

    tool_list = await workbench.list_tools()
    print("Available tools in the workbench:", tool_list)

    result = await workbench.call_tool("base64_decode", {"value": "YWJjZGU="})
    print("Sentiment Analysis Result:", result)


async def save_load_example():
    workbench = await build()

    state = await workbench.save_state()
    config = workbench._to_config()

    # Maybe HttpTool has some problems to cause the failure of _from_config 
    new_workbench = StaticStreamWorkbench._from_config(config)
    await new_workbench.load_state(state)



if __name__ == "__main__":
    import asyncio
    asyncio.run(run())
    asyncio.run(save_load_example())

Which packages was the bug in?

Python Extensions (autogen-ext)

AutoGen library version.

Python 0.7.5

Other library version.

No response

Model used

No response

Model provider

None

Other model provider

No response

Python version

3.13

.NET version

None

Operating system

Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions