mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: [BREAKING] Renamed AgentProtocol to SupportsAgentRun (#3717)
* Renamed AgentProtocol to AgentLike * Resolved comments * Renamed AgentLike to SupportsAgentRun * Resolved comments
This commit is contained in:
committed by
GitHub
Unverified
parent
ac17adb595
commit
15256bb616
@@ -16,7 +16,7 @@ from typing import TYPE_CHECKING, Any, TypeVar, cast
|
||||
|
||||
import azure.durable_functions as df
|
||||
import azure.functions as func
|
||||
from agent_framework import AgentProtocol, get_logger
|
||||
from agent_framework import SupportsAgentRun, get_logger
|
||||
from agent_framework_durabletask import (
|
||||
DEFAULT_MAX_POLL_RETRIES,
|
||||
DEFAULT_POLL_INTERVAL_SECONDS,
|
||||
@@ -51,12 +51,12 @@ class AgentMetadata:
|
||||
"""Metadata for a registered agent.
|
||||
|
||||
Attributes:
|
||||
agent: The agent instance implementing AgentProtocol
|
||||
agent: The agent instance implementing SupportsAgentRun
|
||||
http_endpoint_enabled: Whether HTTP endpoint is enabled for this agent
|
||||
mcp_tool_enabled: Whether MCP tool endpoint is enabled for this agent
|
||||
"""
|
||||
|
||||
agent: AgentProtocol
|
||||
agent: SupportsAgentRun
|
||||
http_endpoint_enabled: bool
|
||||
mcp_tool_enabled: bool
|
||||
|
||||
@@ -145,7 +145,7 @@ class AgentFunctionApp(DFAppBase):
|
||||
- Full access to all Azure Functions capabilities
|
||||
|
||||
Attributes:
|
||||
agents: Dictionary of agent name to AgentProtocol instance
|
||||
agents: Dictionary of agent name to SupportsAgentRun instance
|
||||
enable_health_check: Whether health check endpoint is enabled
|
||||
enable_http_endpoints: Whether HTTP endpoints are created for agents
|
||||
enable_mcp_tool_trigger: Whether MCP tool triggers are created for agents
|
||||
@@ -160,7 +160,7 @@ class AgentFunctionApp(DFAppBase):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
agents: list[AgentProtocol] | None = None,
|
||||
agents: list[SupportsAgentRun] | None = None,
|
||||
http_auth_level: func.AuthLevel = func.AuthLevel.FUNCTION,
|
||||
enable_health_check: bool = True,
|
||||
enable_http_endpoints: bool = True,
|
||||
@@ -222,17 +222,17 @@ class AgentFunctionApp(DFAppBase):
|
||||
logger.debug("[AgentFunctionApp] Initialization complete")
|
||||
|
||||
@property
|
||||
def agents(self) -> dict[str, AgentProtocol]:
|
||||
def agents(self) -> dict[str, SupportsAgentRun]:
|
||||
"""Returns dict of agent names to agent instances.
|
||||
|
||||
Returns:
|
||||
Dictionary mapping agent names to their AgentProtocol instances.
|
||||
Dictionary mapping agent names to their SupportsAgentRun instances.
|
||||
"""
|
||||
return {name: metadata.agent for name, metadata in self._agent_metadata.items()}
|
||||
|
||||
def add_agent(
|
||||
self,
|
||||
agent: AgentProtocol,
|
||||
agent: SupportsAgentRun,
|
||||
callback: AgentResponseCallbackProtocol | None = None,
|
||||
enable_http_endpoint: bool | None = None,
|
||||
enable_mcp_tool_trigger: bool | None = None,
|
||||
@@ -240,7 +240,7 @@ class AgentFunctionApp(DFAppBase):
|
||||
"""Add an agent to the function app after initialization.
|
||||
|
||||
Args:
|
||||
agent: The Microsoft Agent Framework agent instance (must implement AgentProtocol)
|
||||
agent: The Microsoft Agent Framework agent instance (must implement SupportsAgentRun)
|
||||
The agent must have a 'name' attribute.
|
||||
callback: Optional callback invoked during agent execution
|
||||
enable_http_endpoint: Optional flag to enable/disable HTTP endpoint for this agent.
|
||||
@@ -322,7 +322,7 @@ class AgentFunctionApp(DFAppBase):
|
||||
|
||||
def _setup_agent_functions(
|
||||
self,
|
||||
agent: AgentProtocol,
|
||||
agent: SupportsAgentRun,
|
||||
agent_name: str,
|
||||
callback: AgentResponseCallbackProtocol | None,
|
||||
enable_http_endpoint: bool,
|
||||
@@ -484,7 +484,7 @@ class AgentFunctionApp(DFAppBase):
|
||||
|
||||
def _setup_agent_entity(
|
||||
self,
|
||||
agent: AgentProtocol,
|
||||
agent: SupportsAgentRun,
|
||||
agent_name: str,
|
||||
callback: AgentResponseCallbackProtocol | None,
|
||||
) -> None:
|
||||
|
||||
@@ -12,7 +12,7 @@ from collections.abc import Callable
|
||||
from typing import Any, cast
|
||||
|
||||
import azure.durable_functions as df
|
||||
from agent_framework import AgentProtocol, get_logger
|
||||
from agent_framework import SupportsAgentRun, get_logger
|
||||
from agent_framework_durabletask import (
|
||||
AgentEntity,
|
||||
AgentEntityStateProviderMixin,
|
||||
@@ -46,13 +46,13 @@ class AzureFunctionEntityStateProvider(AgentEntityStateProviderMixin):
|
||||
|
||||
|
||||
def create_agent_entity(
|
||||
agent: AgentProtocol,
|
||||
agent: SupportsAgentRun,
|
||||
callback: AgentResponseCallbackProtocol | None = None,
|
||||
) -> Callable[[df.DurableEntityContext], None]:
|
||||
"""Factory function to create an agent entity class.
|
||||
|
||||
Args:
|
||||
agent: The Microsoft Agent Framework agent instance (must implement AgentProtocol)
|
||||
agent: The Microsoft Agent Framework agent instance (must implement SupportsAgentRun)
|
||||
callback: Optional callback invoked during streaming and final responses
|
||||
|
||||
Returns:
|
||||
|
||||
Reference in New Issue
Block a user