Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
46b4e82
Refactor code structure for improved readability and maintainability
Dhanushree-Microsoft May 21, 2026
4e0a59a
refactor: remove ImportError handling for agent_framework imports
Dhanushree-Microsoft May 21, 2026
b6001e8
refactor: update Message stubs for consistency and clarity in tests
Dhanushree-Microsoft May 21, 2026
64c78f4
refactor: simplify client import handling in AgentFrameworkHelper
Dhanushree-Microsoft May 21, 2026
7e514c5
refactor: update exception handling in client creation tests to use I…
Dhanushree-Microsoft May 21, 2026
aab94b9
refactor: normalize executor_id handling in MigrationProcessor for im…
Dhanushree-Microsoft May 21, 2026
913bffa
refactor: streamline WorkflowEvent handling in GroupChatOrchestrator …
Dhanushree-Microsoft May 21, 2026
f64adcd
refactor: enhance AzureOpenAIResponseClientWithRetry for legacy param…
Dhanushree-Microsoft May 21, 2026
0ad41f1
code quality issue
Priyanka-Microsoft Jun 2, 2026
26f584c
chore: update werkzeug to 3.1.6 and add idna 3.15 to dependencies
Dhanushree-Microsoft Jun 2, 2026
05cc25d
Merge pull request #267 from microsoft/cm-dm0206
Roopan-Microsoft Jun 3, 2026
8371c22
fix: check credential value instead of key presence
Dhanushree-Microsoft Jun 4, 2026
1033890
fix: check credential value instead of key presence
Dhanushree-Microsoft Jun 4, 2026
359ed58
fix: resolve merge conflicts with dev branch
Jun 4, 2026
d86c63e
fix: address review comments - type annotations, test cleanup, and co…
Jun 4, 2026
d60d5b1
fix: use contents= for Message construction in agent-framework 1.3.0
Jun 4, 2026
cba537e
fix: add setup_module to prevent test ordering issues with Message patch
Jun 4, 2026
271fc27
fix: assert contents instead of text in input observer test
Jun 4, 2026
75b3e64
fix: set both text and contents on Message, restore copyright header
Jun 4, 2026
ed3d29c
fix: remove unused modified_count variable (F841)
Dhanushree-Microsoft Jun 4, 2026
d7055f2
fix: remove unused Agent import (F401)
Dhanushree-Microsoft Jun 4, 2026
3968aed
fix: Refactor code structure for improved readability and maintainabi…
Avijit-Microsoft Jun 4, 2026
ebbba82
fix: remove unused WorkflowEvent import and restore 'invalid content'…
Dhanushree-Microsoft Jun 5, 2026
9fd191d
Merge pull request #275 from microsoft/fix/restore-retry-and-remove-u…
Roopan-Microsoft Jun 5, 2026
a953ae1
Merge pull request #266 from microsoft/feature/code-quality-issues
Roopan-Microsoft Jun 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion infra/vscode_web/endpoint-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
azure-ai-projects==1.0.0b12
azure-ai-projects==2.1.0
azure-identity==1.20.0
ansible-core~=2.17.0
2 changes: 1 addition & 1 deletion infra/vscode_web/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
azure-ai-projects==1.0.0b12
azure-ai-projects==2.1.0
azure-identity==1.20.0
ansible-core~=2.17.0
3 changes: 2 additions & 1 deletion src/backend-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ override-dependencies = [
"azure-core==1.38.0",
"urllib3==2.7.0",
"requests==2.33.0",
"werkzeug==3.1.4",
"werkzeug==3.1.6",
"pygments==2.20.0",
"black==26.3.1",
"cryptography==46.0.7",
"pyjwt==2.12.0",
"pyopenssl==26.0.0",
"idna==3.15",
]
1 change: 0 additions & 1 deletion src/backend-api/src/tests/base/test_sk_logic_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import importlib
import sys
import types
from typing import Type
from unittest.mock import MagicMock

import pytest
Expand Down
15 changes: 8 additions & 7 deletions src/backend-api/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/frontend/src/components/batchHistoryPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef } from "react";

import { useDispatch, useSelector } from 'react-redux';
import { useDispatch } from 'react-redux';
import { Card, Spinner, Tooltip } from "@fluentui/react-components";
import { useNavigate } from "react-router-dom";
import ConfirmationDialog from "../commonComponents/ConfirmationDialog/confirmationDialogue";
Expand Down
5 changes: 3 additions & 2 deletions src/processor/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"agent-framework==1.0.0b260107",
"agent-framework==1.3.0",
"aiohttp==3.13.5",
"art==6.5",
"azure-ai-agents==1.2.0b5",
"azure-ai-agents==1.2.0b6",
"azure-ai-inference==1.0.0b9",
"azure-ai-projects==2.1.0",
"azure-appconfiguration==1.8.0",
Expand Down Expand Up @@ -62,4 +62,5 @@ prerelease = "allow"
override-dependencies = [
"urllib3==2.7.0",
"authlib==1.7.1",
"idna==3.15",
]
101 changes: 46 additions & 55 deletions src/processor/src/libs/agent_framework/agent_builder.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"""Fluent builder for constructing ChatAgent instances with chainable configuration."""
"""Fluent builder for constructing Agent instances with chainable configuration."""

from collections.abc import Callable, MutableMapping, Sequence
from typing import Any, Literal

from agent_framework import (
AggregateContextProvider,
ChatAgent,
ChatClientProtocol,
ChatMessageStoreProtocol,
Agent,
AgentMiddleware,
BaseChatClient,
ChatMiddleware,
ContextProvider,
Middleware,
FunctionTool,
ToolMode,
ToolProtocol,
)
from pydantic import BaseModel

Expand All @@ -23,7 +22,7 @@


class AgentBuilder:
"""Fluent builder for creating ChatAgent instances with a chainable API.
"""Fluent builder for creating Agent instances with a chainable API.

This class provides two ways to create agents:
1. Fluent API with method chaining (recommended for readability)
Expand Down Expand Up @@ -59,7 +58,7 @@ class AgentBuilder:
)
"""

def __init__(self, chat_client: ChatClientProtocol):
def __init__(self, chat_client: BaseChatClient):
"""Initialize the builder with a chat client.

Args:
Expand All @@ -70,14 +69,15 @@ def __init__(self, chat_client: ChatClientProtocol):
self._id: str | None = None
self._name: str | None = None
self._description: str | None = None
self._chat_message_store_factory: (
Callable[[], ChatMessageStoreProtocol] | None
) = None
self._chat_message_store_factory: Callable[[], Any] | None = None
self._conversation_id: str | None = None
self._context_providers: (
ContextProvider | list[ContextProvider] | AggregateContextProvider | None
self._context_providers: ContextProvider | list[ContextProvider] | None = None
self._middleware: (
AgentMiddleware
| ChatMiddleware
| list[AgentMiddleware | ChatMiddleware]
| None
) = None
self._middleware: Middleware | list[Middleware] | None = None
self._frequency_penalty: float | None = None
self._logit_bias: dict[str | int, float] | None = None
self._max_tokens: int | None = None
Expand All @@ -93,10 +93,10 @@ def __init__(self, chat_client: ChatClientProtocol):
ToolMode | Literal["auto", "required", "none"] | dict[str, Any] | None
) = "auto"
self._tools: (
ToolProtocol
FunctionTool
| Callable[..., Any]
| MutableMapping[str, Any]
| Sequence[ToolProtocol | Callable[..., Any] | MutableMapping[str, Any]]
| Sequence[FunctionTool | Callable[..., Any] | MutableMapping[str, Any]]
| None
) = None
self._top_p: float | None = None
Expand Down Expand Up @@ -178,10 +178,10 @@ def with_max_tokens(self, max_tokens: int) -> "AgentBuilder":

def with_tools(
self,
tools: ToolProtocol
tools: FunctionTool
| Callable[..., Any]
| MutableMapping[str, Any]
| Sequence[ToolProtocol | Callable[..., Any] | MutableMapping[str, Any]],
| Sequence[FunctionTool | Callable[..., Any] | MutableMapping[str, Any]],
) -> "AgentBuilder":
"""Set the tools available to the agent.

Expand Down Expand Up @@ -210,7 +210,8 @@ def with_tool_choice(
return self

def with_middleware(
self, middleware: Middleware | list[Middleware]
self,
middleware: AgentMiddleware | ChatMiddleware | list[AgentMiddleware | ChatMiddleware],
) -> "AgentBuilder":
"""Set middleware for request/response processing.

Expand All @@ -225,9 +226,7 @@ def with_middleware(

def with_context_providers(
self,
context_providers: ContextProvider
| list[ContextProvider]
| AggregateContextProvider,
context_providers: ContextProvider | list[ContextProvider],
) -> "AgentBuilder":
"""Set context providers for additional conversation context.

Expand Down Expand Up @@ -385,7 +384,7 @@ def with_store(self, store: bool) -> "AgentBuilder":
return self

def with_message_store_factory(
self, factory: Callable[[], ChatMessageStoreProtocol]
self, factory: Callable[[], Any]
) -> "AgentBuilder":
"""Set the message store factory.

Expand Down Expand Up @@ -422,11 +421,11 @@ def with_kwargs(self, **kwargs: Any) -> "AgentBuilder":
self._kwargs.update(kwargs)
return self

def build(self) -> ChatAgent:
"""Build and return the configured ChatAgent.
def build(self) -> Agent:
"""Build and return the configured Agent.

Returns:
ChatAgent: Configured agent instance ready for use
Agent: Configured agent instance ready for use

Example:
.. code-block:: python
Expand All @@ -442,7 +441,7 @@ def build(self) -> ChatAgent:
async with agent:
response = await agent.run("Hello!")
"""
return ChatAgent(
return Agent(
chat_client=self._chat_client,
instructions=self._instructions,
id=self._id,
Expand Down Expand Up @@ -477,14 +476,10 @@ def create_agent_by_agentinfo(
agent_info: AgentInfo,
*,
id: str | None = None,
chat_message_store_factory: Callable[[], ChatMessageStoreProtocol]
| None = None,
chat_message_store_factory: Callable[[], Any] | None = None,
conversation_id: str | None = None,
context_providers: ContextProvider
| list[ContextProvider]
| AggregateContextProvider
| None = None,
middleware: Middleware | list[Middleware] | None = None,
context_providers: ContextProvider | list[ContextProvider] | None = None,
middleware: AgentMiddleware | ChatMiddleware | list[AgentMiddleware | ChatMiddleware] | None = None,
frequency_penalty: float | None = None,
logit_bias: dict[str | int, float] | None = None,
max_tokens: int | None = None,
Expand All @@ -500,20 +495,20 @@ def create_agent_by_agentinfo(
| Literal["auto", "required", "none"]
| dict[str, Any]
| None = "auto",
tools: ToolProtocol
tools: FunctionTool
| Callable[..., Any]
| MutableMapping[str, Any]
| Sequence[ToolProtocol | Callable[..., Any] | MutableMapping[str, Any]]
| Sequence[FunctionTool | Callable[..., Any] | MutableMapping[str, Any]]
| None = None,
top_p: float | None = None,
user: str | None = None,
additional_chat_options: dict[str, Any] | None = None,
**kwargs: Any,
) -> ChatAgent:
) -> Agent:
"""Create an agent using AgentInfo configuration with full parameter support.

This method creates a chat client from the service configuration and then
creates a ChatAgent with the specified parameters. Agent name, description,
creates a Agent with the specified parameters. Agent name, description,
and instructions are taken from AgentInfo but can be overridden via kwargs.

Args:
Expand Down Expand Up @@ -543,7 +538,7 @@ def create_agent_by_agentinfo(
**kwargs: Additional keyword arguments

Returns:
ChatAgent: Configured agent instance ready for use
Agent: Configured agent instance ready for use

Example:
.. code-block:: python
Expand Down Expand Up @@ -611,20 +606,16 @@ def create_agent_by_agentinfo(

@staticmethod
def create_agent(
chat_client: ChatClientProtocol,
chat_client: BaseChatClient,
instructions: str | None = None,
*,
id: str | None = None,
name: str | None = None,
description: str | None = None,
chat_message_store_factory: Callable[[], ChatMessageStoreProtocol]
| None = None,
chat_message_store_factory: Callable[[], Any] | None = None,
conversation_id: str | None = None,
context_providers: ContextProvider
| list[ContextProvider]
| AggregateContextProvider
| None = None,
middleware: Middleware | list[Middleware] | None = None,
context_providers: ContextProvider | list[ContextProvider] | None = None,
middleware: AgentMiddleware | ChatMiddleware | list[AgentMiddleware | ChatMiddleware] | None = None,
frequency_penalty: float | None = None,
logit_bias: dict[str | int, float] | None = None,
max_tokens: int | None = None,
Expand All @@ -640,19 +631,19 @@ def create_agent(
| Literal["auto", "required", "none"]
| dict[str, Any]
| None = "auto",
tools: ToolProtocol
tools: FunctionTool
| Callable[..., Any]
| MutableMapping[str, Any]
| Sequence[ToolProtocol | Callable[..., Any] | MutableMapping[str, Any]]
| Sequence[FunctionTool | Callable[..., Any] | MutableMapping[str, Any]]
| None = None,
top_p: float | None = None,
user: str | None = None,
additional_chat_options: dict[str, Any] | None = None,
**kwargs: Any,
) -> ChatAgent:
) -> Agent:
"""Create a Chat Client Agent.

Factory method that creates a ChatAgent instance with the specified configuration.
Factory method that creates a Agent instance with the specified configuration.
The agent uses a chat client to interact with language models and supports tools
(MCP tools, callable functions), context providers, middleware, and both streaming
and non-streaming responses.
Expand Down Expand Up @@ -686,7 +677,7 @@ def create_agent(
**kwargs: Additional keyword arguments

Returns:
ChatAgent: Configured chat agent instance that can be used directly or with async context manager
Agent: Configured chat agent instance that can be used directly or with async context manager

Examples:
Non-streaming example (from azure_response_client_basic.py):
Expand Down Expand Up @@ -761,10 +752,10 @@ def create_agent(

Note:
When the agent has MCP tools or needs proper resource cleanup, use it with
``async with`` to ensure proper initialization and cleanup via the ChatAgent's
``async with`` to ensure proper initialization and cleanup via the Agent's
async context manager protocol.
"""
return ChatAgent(
return Agent(
chat_client=chat_client,
instructions=instructions,
id=id,
Expand Down
Loading
Loading