Skip to content

FunctionTool(strict=True) loses strict across dump_component / load_component #8283

Description

Describe the bug

Docs require strict=True for tools used with structured output / output_content_type. FunctionTool.dump_component / load_component omit strict from the config, so a tool saved with strict=True comes back as strict=False after an apparently lossless round-trip.

To Reproduce

from autogen_core.tools import FunctionTool

def add(a: int, b: int) -> int:
    """Add two integers."""
    return a + b

tool = FunctionTool(add, description="Add two integers", strict=True)
assert tool.schema.get("strict") is True

cfg = tool.dump_component()
print(sorted(cfg.config.keys()))
# ['description', 'global_imports', 'has_cancellation_support', 'name', 'source_code']
# no 'strict'

restored = FunctionTool.load_component(cfg)
print(restored.schema.get("strict"))  # False  — BUG

Expected behavior

Config persists strict; restored tool has schema[\"strict\"] is True.

Actual behavior

strict is absent from config; restored tool defaults to False.

Environment

  • autogen-core 0.7.5
  • Python 3.13

Additional context

Likely fix: include strict in the FunctionTool component config _to_config / _from_config path in autogen_core.tools.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions