Python: [BREAKING] Fix #3613 chat/agent message typing alignment (#3920)

* Fix #3613 message typing across chat and agents

* Address #3613 review feedback and sample input style

* refactor: use shared AgentRunMessages aliases (#3613)

* refactor: rename agent run input aliases for #3613

* samples: inline image content in run calls

* core: export AgentRunInputs from package init

* core: use explicit init re-exports without __all__

* updated logging and inits

* Fix core mypy export and samples XML note

* Remove AgentRunInputsOrNone and dedupe loggers

* Remove prepare_messages helper

* fix integration tests
This commit is contained in:
Eduard van Valkenburg
2026-02-16 16:27:25 +01:00
committed by GitHub
Unverified
parent 503eb10fdd
commit dc9439a75a
87 changed files with 422 additions and 578 deletions
@@ -1,12 +1,12 @@
# Copyright (c) Microsoft. All rights reserved.
from __future__ import annotations
import logging
import os
from collections.abc import MutableMapping
from contextvars import ContextVar
from typing import Any, Literal, TypeVar, Union
from agent_framework import get_logger
from agent_framework._serialization import SerializationMixin
try:
@@ -20,7 +20,7 @@ except (ImportError, RuntimeError):
from typing import overload
logger = get_logger("agent_framework.declarative")
logger = logging.getLogger("agent_framework.declarative")
# Context variable for safe_mode setting.
# When True (default), environment variables are NOT accessible in PowerFx expressions.
@@ -10,10 +10,10 @@ This module implements handlers for:
from __future__ import annotations
import json
import logging
from collections.abc import AsyncGenerator
from typing import Any, cast
from agent_framework import get_logger
from agent_framework._types import AgentResponse, Message
from ._handlers import (
@@ -25,7 +25,7 @@ from ._handlers import (
)
from ._human_input import ExternalLoopEvent, QuestionRequest
logger = get_logger("agent_framework.declarative.workflows.actions")
logger = logging.getLogger("agent_framework.declarative")
def _extract_json_from_response(text: str) -> Any:
@@ -18,11 +18,10 @@ actually yielding any events.
from __future__ import annotations
import logging
from collections.abc import AsyncGenerator
from typing import TYPE_CHECKING, Any, cast
from agent_framework import get_logger
from ._handlers import (
ActionContext,
AttachmentOutputEvent,
@@ -35,7 +34,7 @@ from ._handlers import (
if TYPE_CHECKING:
from ._state import WorkflowState
logger = get_logger("agent_framework.declarative.workflows.actions")
logger = logging.getLogger("agent_framework.declarative")
@action_handler("SetValue")
@@ -11,10 +11,9 @@ This module implements handlers for:
- ContinueLoop: Skip to the next iteration
"""
import logging
from collections.abc import AsyncGenerator
from agent_framework import get_logger
from ._handlers import (
ActionContext,
LoopControlSignal,
@@ -22,7 +21,7 @@ from ._handlers import (
action_handler,
)
logger = get_logger("agent_framework.declarative.workflows.actions")
logger = logging.getLogger("agent_framework.declarative")
@action_handler("Foreach")
@@ -9,18 +9,17 @@ This module implements handlers for:
from __future__ import annotations
import logging
from collections.abc import AsyncGenerator
from dataclasses import dataclass
from agent_framework import get_logger
from ._handlers import (
ActionContext,
WorkflowEvent,
action_handler,
)
logger = get_logger("agent_framework.declarative.workflows.actions")
logger = logging.getLogger("agent_framework.declarative")
class WorkflowActionError(Exception):
@@ -12,6 +12,7 @@ enabling checkpointing, visualization, and pause/resume capabilities.
from __future__ import annotations
import logging
from collections.abc import Mapping
from pathlib import Path
from typing import Any, cast
@@ -22,13 +23,12 @@ from agent_framework import (
CheckpointStorage,
SupportsAgentRun,
Workflow,
get_logger,
)
from .._loader import AgentFactory
from ._declarative_builder import DeclarativeWorkflowBuilder
logger = get_logger("agent_framework.declarative.workflows")
logger = logging.getLogger("agent_framework.declarative")
class DeclarativeWorkflowError(Exception):
@@ -9,16 +9,15 @@ has a corresponding handler registered via the @action_handler decorator.
from __future__ import annotations
import logging
from collections.abc import AsyncGenerator, Callable
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
from agent_framework import get_logger
if TYPE_CHECKING:
from ._state import WorkflowState
logger = get_logger("agent_framework.declarative.workflows")
logger = logging.getLogger("agent_framework.declarative")
@dataclass
@@ -10,12 +10,11 @@ This module implements handlers for human input patterns:
from __future__ import annotations
import logging
from collections.abc import AsyncGenerator
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, cast
from agent_framework import get_logger
from ._handlers import (
ActionContext,
WorkflowEvent,
@@ -25,7 +24,7 @@ from ._handlers import (
if TYPE_CHECKING:
from ._state import WorkflowState
logger = get_logger("agent_framework.declarative.workflows.human_input")
logger = logging.getLogger("agent_framework.declarative")
@dataclass
@@ -11,11 +11,10 @@ This module provides state management for declarative workflows, handling:
from __future__ import annotations
import logging
from collections.abc import Mapping
from typing import Any, cast
from agent_framework import get_logger
try:
from powerfx import Engine
@@ -25,7 +24,7 @@ except (ImportError, RuntimeError):
# RuntimeError: .NET runtime not available or misconfigured
_powerfx_engine = None
logger = get_logger("agent_framework.declarative.workflows")
logger = logging.getLogger("agent_framework.declarative")
class WorkflowState: