Agents + Chat Client Samples Doctsring Updates (#1028)

* agents + chat client samples doctsring updates

* fixes
This commit is contained in:
Giles Odigwe
2025-10-01 00:18:53 -07:00
committed by GitHub
Unverified
parent 3d04517877
commit b88143b686
68 changed files with 511 additions and 45 deletions
@@ -8,6 +8,13 @@ from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
from pydantic import Field
"""
Azure AI Agent Basic Example
This sample demonstrates basic usage of AzureAIAgentClient to create agents with automatic
lifecycle management. Shows both streaming and non-streaming responses with function tools.
"""
def get_weather(
location: Annotated[str, Field(description="The location to get the weather for.")],
@@ -9,6 +9,13 @@ from azure.ai.agents.models import (
)
from azure.identity.aio import AzureCliCredential
"""
Azure AI Agent with Code Interpreter Example
This sample demonstrates using HostedCodeInterpreterTool with Azure AI Agents
for Python code execution and mathematical problem solving.
"""
def print_code_interpreter_inputs(response: AgentRunResponse) -> None:
"""Helper method to access code interpreter data."""
@@ -43,7 +50,8 @@ async def main() -> None:
print(f"User: {query}")
response = await AgentRunResponse.from_agent_response_generator(agent.run_stream(query))
print(f"Agent: {response}")
# To review the code interpreter outputs, you can access them from the response raw_representations, just uncomment the next line:
# To review the code interpreter outputs, you can access
# them from the response raw_representations, just uncomment the next line:
# print_code_interpreter_inputs(response)
@@ -11,6 +11,13 @@ from azure.ai.projects.aio import AIProjectClient
from azure.identity.aio import AzureCliCredential
from pydantic import Field
"""
Azure AI Agent with Existing Agent Example
This sample demonstrates working with pre-existing Azure AI Agents by providing
agent IDs, showing agent reuse patterns for production scenarios.
"""
def get_weather(
location: Annotated[str, Field(description="The location to get the weather for.")],
@@ -11,6 +11,13 @@ from azure.ai.projects.aio import AIProjectClient
from azure.identity.aio import AzureCliCredential
from pydantic import Field
"""
Azure AI Agent with Existing Thread Example
This sample demonstrates working with pre-existing conversation threads
by providing thread IDs for thread reuse patterns.
"""
def get_weather(
location: Annotated[str, Field(description="The location to get the weather for.")],
@@ -10,6 +10,13 @@ from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
from pydantic import Field
"""
Azure AI Agent with Explicit Settings Example
This sample demonstrates creating Azure AI Agents with explicit configuration
settings rather than relying on environment variable defaults.
"""
def get_weather(
location: Annotated[str, Field(description="The location to get the weather for.")],
@@ -10,6 +10,13 @@ from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
from pydantic import Field
"""
Azure AI Agent with Function Tools Example
This sample demonstrates function tool integration with Azure AI Agents,
showing both agent-level and query-level tool configuration patterns.
"""
def get_weather(
location: Annotated[str, Field(description="The location to get the weather for.")],
@@ -7,6 +7,13 @@ from agent_framework import AgentProtocol, AgentThread, HostedMCPTool
from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
"""
Azure AI Agent with Hosted MCP Example
This sample demonstrates integration of Azure AI Agents with hosted Model Context Protocol (MCP)
servers, including user approval workflows for function call security.
"""
async def handle_approvals_with_thread(query: str, agent: "AgentProtocol", thread: "AgentThread"):
"""Here we let the thread deal with the previous responses, and we just rerun with the approval."""
@@ -6,6 +6,13 @@ from agent_framework import ChatAgent, MCPStreamableHTTPTool
from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
"""
Azure AI Agent with Local MCP Example
This sample demonstrates integration of Azure AI Agents with local Model Context Protocol (MCP)
servers, showing both agent-level and run-level tool configuration patterns.
"""
async def mcp_tools_on_run_level() -> None:
"""Example showing MCP tools defined when running the agent."""
@@ -13,6 +13,13 @@ from agent_framework import (
from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
"""
Azure AI Agent with Multiple Tools Example
This sample demonstrates integrating multiple tools (MCP and Web Search) with Azure AI Agents,
including user approval workflows for function call security.
"""
def get_time() -> str:
"""Get the current UTC time."""
@@ -9,6 +9,13 @@ from agent_framework.azure import AzureAIAgentClient
from azure.identity.aio import AzureCliCredential
from pydantic import Field
"""
Azure AI Agent with Thread Management Example
This sample demonstrates thread management with Azure AI Agents, comparing
automatic thread creation with explicit thread management for persistent context.
"""
def get_weather(
location: Annotated[str, Field(description="The location to get the weather for.")],