Skip to content

Commit 683db0c

Browse files
committed
fix: Adapt to breaking change in msaf: Change model_id to model
1 parent e6a388f commit 683db0c

4 files changed

Lines changed: 12 additions & 11 deletions

File tree

msaf/agenticlayer/msaf/agent_to_a2a.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
TextPart,
2727
)
2828
from a2a.utils.constants import AGENT_CARD_WELL_KNOWN_PATH
29-
from agent_framework import AgentSession, SupportsAgentRun
29+
from agent_framework import Agent, AgentSession
3030
from agent_framework._mcp import MCPStreamableHTTPTool
3131
from agent_framework._tools import FunctionTool
3232
from agenticlayer.shared.config import McpTool, SubAgent
@@ -53,7 +53,7 @@ class MsafAgentExecutor(AgentExecutor):
5353

5454
def __init__(
5555
self,
56-
agent: SupportsAgentRun,
56+
agent: Agent,
5757
sub_agent_tools: list[FunctionTool] | None = None,
5858
mcp_tool_configs: list[McpTool] | None = None,
5959
agent_factory: MsafAgentFactory | None = None,
@@ -173,7 +173,7 @@ async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None
173173

174174

175175
async def create_a2a_app(
176-
agent: SupportsAgentRun,
176+
agent: Agent,
177177
name: str,
178178
description: str | None,
179179
rpc_url: str,
@@ -224,7 +224,7 @@ async def create_a2a_app(
224224

225225

226226
def to_a2a(
227-
agent: SupportsAgentRun,
227+
agent: Agent,
228228
name: str,
229229
rpc_url: str,
230230
description: str | None = None,
@@ -262,7 +262,7 @@ def to_a2a(
262262

263263

264264
async def _build_app(
265-
agent: SupportsAgentRun,
265+
agent: Agent,
266266
name: str,
267267
description: str | None,
268268
rpc_url: str,

msaf/agenticlayer/msaf/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def create_openai_client(
9-
model_id: str | None = None,
9+
model: str | None = None,
1010
) -> OpenAIChatClient:
1111
"""Create an OpenAIChatClient configured from environment variables.
1212
@@ -20,10 +20,10 @@ def create_openai_client(
2020
parameter. Falls back to the ``OPENAI_API_KEY`` env var when not set.
2121
- ``OPENAI_CHAT_MODEL_ID``: Model name to use (e.g. ``gpt-4o``). Handled
2222
natively by :class:`~agent_framework.openai.OpenAIChatClient`; takes effect
23-
even when ``model_id`` is not passed to this function.
23+
even when ``model`` is not passed to this function.
2424
2525
Args:
26-
model_id: Optional model identifier override. When ``None``, the
26+
model: Optional model identifier override. When ``None``, the
2727
``OPENAI_CHAT_MODEL_ID`` environment variable is used automatically
2828
by :class:`~agent_framework.openai.OpenAIChatClient`.
2929
@@ -52,7 +52,7 @@ def create_openai_client(
5252
api_key = os.environ.get("LITELLM_PROXY_API_KEY")
5353

5454
return OpenAIChatClient(
55-
model_id=model_id,
55+
model=model,
5656
base_url=base_url,
5757
api_key=api_key,
5858
)

msaf/agenticlayer/msaf/metrics_middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async def process(
7171
call_next: Callable[[], Awaitable[None]],
7272
) -> None:
7373
options = context.options or {}
74-
model: str = options.get("model_id") or getattr(context.client, "model_id", None) or "unknown"
74+
model: str = options.get("model") or getattr(context.client, "model", None) or "unknown"
7575
attrs: dict[str, Any] = {"model": model}
7676
_llm_calls.add(1, attrs)
7777
try:

msaf/tests/fixtures/mock_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class MockChatClient(BaseChatClient[Any]):
1010
"""A mock chat client for testing that returns predefined responses."""
1111

1212
def __init__(self, response_text: str = "Hello from mock agent!") -> None:
13+
super().__init__()
1314
self._response_text = response_text
1415
self.received_messages: list[Sequence[Message]] = []
1516

@@ -31,7 +32,7 @@ async def _respond() -> ChatResponse[Any]:
3132
return ChatResponse(
3233
messages=[Message("assistant", [self._response_text])],
3334
finish_reason="stop",
34-
model_id="mock-model",
35+
model="mock-model",
3536
)
3637

3738
return _respond()

0 commit comments

Comments
 (0)