mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: Move workflow-samples and agent-samples under declarative-agents directory (#5011)
* Move workflow-samples and agent-samples under declarative-agents and update all references Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/f70f7d19-9256-4eec-b7db-28007d74440c Co-authored-by: sphenry <6749825+sphenry@users.noreply.github.com> * Fix relative paths in README files inside moved directories Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/f70f7d19-9256-4eec-b7db-28007d74440c Co-authored-by: sphenry <6749825+sphenry@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sphenry <6749825+sphenry@users.noreply.github.com> Co-authored-by: Shawn Henry <shahen@microsoft.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
7e8e9e3074
commit
fd253c0b0e
@@ -439,10 +439,10 @@ properties:
|
||||
|
||||
|
||||
def _get_agent_sample_yaml_files() -> list[tuple[Path, Path]]:
|
||||
"""Helper function to collect all YAML files from agent-samples directory."""
|
||||
"""Helper function to collect all YAML files from declarative-agents/agent-samples directory."""
|
||||
current_file = Path(__file__)
|
||||
repo_root = current_file.parent.parent.parent.parent # tests -> declarative -> packages -> python
|
||||
agent_samples_dir = repo_root.parent / "agent-samples"
|
||||
agent_samples_dir = repo_root.parent / "declarative-agents" / "agent-samples"
|
||||
|
||||
if not agent_samples_dir.exists():
|
||||
return []
|
||||
@@ -457,7 +457,7 @@ def _get_agent_sample_yaml_files() -> list[tuple[Path, Path]]:
|
||||
ids=lambda x: x[0].name if isinstance(x, tuple) else str(x),
|
||||
)
|
||||
def test_agent_schema_dispatch_agent_samples(yaml_file: Path, agent_samples_dir: Path):
|
||||
"""Test that agent_schema_dispatch successfully loads a YAML file from agent-samples directory."""
|
||||
"""Test that agent_schema_dispatch loads a YAML file from declarative-agents/agent-samples directory."""
|
||||
with open(yaml_file) as f:
|
||||
content = f.read()
|
||||
result = agent_schema_dispatch(yaml.safe_load(content))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
"""Integration tests for workflow samples.
|
||||
|
||||
These tests verify that the workflow samples from workflow-samples/ directory
|
||||
These tests verify that the workflow samples from declarative-agents/workflow-samples/ directory
|
||||
can be parsed and validated by the WorkflowFactory.
|
||||
"""
|
||||
|
||||
@@ -13,7 +13,7 @@ import yaml
|
||||
|
||||
# Path to workflow samples - navigate from tests dir up to repo root
|
||||
# tests/test_*.py -> packages/declarative/tests/ -> packages/declarative/ -> packages/ -> python/ -> repo root
|
||||
WORKFLOW_SAMPLES_DIR = Path(__file__).parent.parent.parent.parent.parent / "workflow-samples"
|
||||
WORKFLOW_SAMPLES_DIR = Path(__file__).parent.parent.parent.parent.parent / "declarative-agents" / "workflow-samples"
|
||||
|
||||
|
||||
def get_workflow_sample_files():
|
||||
|
||||
@@ -28,7 +28,7 @@ Demonstrates how to create an agent with custom function tools using the declara
|
||||
|
||||
- Uses Azure OpenAI Responses client
|
||||
- Shows how to bind Python functions to the agent using the `bindings` parameter
|
||||
- Loads agent configuration from `agent-samples/chatclient/GetWeather.yaml`
|
||||
- Loads agent configuration from `declarative-agents/agent-samples/chatclient/GetWeather.yaml`
|
||||
- Implements a simple weather lookup function tool
|
||||
|
||||
**Key concepts**: Function binding, Azure OpenAI integration, tool usage
|
||||
@@ -39,7 +39,7 @@ Shows how to create an agent that can search and retrieve information from Micro
|
||||
|
||||
- Uses Azure AI Foundry client with MCP server integration
|
||||
- Demonstrates async context managers for proper resource cleanup
|
||||
- Loads agent configuration from `agent-samples/foundry/MicrosoftLearnAgent.yaml`
|
||||
- Loads agent configuration from `declarative-agents/agent-samples/foundry/MicrosoftLearnAgent.yaml`
|
||||
- Uses Azure CLI credentials for authentication
|
||||
- Leverages MCP to access Microsoft documentation tools
|
||||
|
||||
@@ -63,7 +63,7 @@ Illustrates a basic agent using Azure OpenAI with structured responses.
|
||||
|
||||
- Uses Azure OpenAI Responses client
|
||||
- Shows how to pass credentials via `client_kwargs`
|
||||
- Loads agent configuration from `agent-samples/azure/AzureOpenAIResponses.yaml`
|
||||
- Loads agent configuration from `declarative-agents/agent-samples/azure/AzureOpenAIResponses.yaml`
|
||||
- Demonstrates accessing structured response data
|
||||
|
||||
**Key concepts**: Azure OpenAI integration, credential management, structured outputs
|
||||
@@ -74,18 +74,18 @@ Demonstrates the simplest possible agent using OpenAI directly.
|
||||
|
||||
- Uses OpenAI API (requires `OPENAI_API_KEY` environment variable)
|
||||
- Shows minimal configuration needed for basic agent creation
|
||||
- Loads agent configuration from `agent-samples/openai/OpenAIResponses.yaml`
|
||||
- Loads agent configuration from `declarative-agents/agent-samples/openai/OpenAIResponses.yaml`
|
||||
|
||||
**Key concepts**: OpenAI integration, minimal setup, environment-based configuration
|
||||
|
||||
## Agent Samples Repository
|
||||
|
||||
All the YAML configuration files referenced in these samples are located in the [`agent-samples`](../../../../agent-samples/) folder at the repository root. This folder contains declarative agent specifications organized by provider:
|
||||
All the YAML configuration files referenced in these samples are located in the [`declarative-agents/agent-samples`](../../../../declarative-agents/agent-samples/) folder at the repository root. This folder contains declarative agent specifications organized by provider:
|
||||
|
||||
- **`agent-samples/azure/`** - Azure OpenAI agent configurations
|
||||
- **`agent-samples/chatclient/`** - Chat client agent configurations with tools
|
||||
- **`agent-samples/foundry/`** - Azure AI Foundry agent configurations
|
||||
- **`agent-samples/openai/`** - OpenAI agent configurations
|
||||
- **`declarative-agents/agent-samples/azure/`** - Azure OpenAI agent configurations
|
||||
- **`declarative-agents/agent-samples/chatclient/`** - Chat client agent configurations with tools
|
||||
- **`declarative-agents/agent-samples/foundry/`** - Azure AI Foundry agent configurations
|
||||
- **`declarative-agents/agent-samples/openai/`** - OpenAI agent configurations
|
||||
|
||||
**Important**: These YAML files are **platform-agnostic** and work with both Python and .NET implementations of the Agent Framework. You can use the exact same YAML definition to create agents in either language, making it easy to share agent configurations across different technology stacks.
|
||||
|
||||
@@ -261,12 +261,12 @@ python openai_responses_agent.py
|
||||
## Learn More
|
||||
|
||||
- [Agent Framework Declarative Package](../../../packages/declarative/) - Main declarative package documentation
|
||||
- [Agent Samples](../../../../agent-samples/) - Additional declarative agent YAML specifications
|
||||
- [Agent Samples](../../../../declarative-agents/agent-samples/) - Additional declarative agent YAML specifications
|
||||
- [Agent Framework Core](../../../packages/core/) - Core agent framework documentation
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Explore the YAML files in the `agent-samples` folder to understand the configuration format
|
||||
1. Explore the YAML files in the `declarative-agents/agent-samples` folder to understand the configuration format
|
||||
2. Try modifying the samples to use different models or instructions
|
||||
3. Create your own declarative agent configurations
|
||||
4. Build custom function tools and bind them to your agents
|
||||
|
||||
@@ -14,7 +14,7 @@ async def main():
|
||||
"""Create an agent from a declarative yaml specification and run it."""
|
||||
# get the path
|
||||
current_path = Path(__file__).parent
|
||||
yaml_path = current_path.parent.parent.parent.parent / "agent-samples" / "azure" / "AzureOpenAIResponses.yaml"
|
||||
yaml_path = current_path.parent.parent.parent.parent / "declarative-agents" / "agent-samples" / "azure" / "AzureOpenAIResponses.yaml"
|
||||
# load the yaml from the path
|
||||
with yaml_path.open("r") as f:
|
||||
yaml_str = f.read()
|
||||
|
||||
@@ -22,7 +22,7 @@ async def main():
|
||||
"""Create an agent from a declarative yaml specification and run it."""
|
||||
# get the path
|
||||
current_path = Path(__file__).parent
|
||||
yaml_path = current_path.parent.parent.parent.parent / "agent-samples" / "chatclient" / "GetWeather.yaml"
|
||||
yaml_path = current_path.parent.parent.parent.parent / "declarative-agents" / "agent-samples" / "chatclient" / "GetWeather.yaml"
|
||||
# load the yaml from the path
|
||||
with yaml_path.open("r") as f:
|
||||
yaml_str = f.read()
|
||||
|
||||
@@ -28,7 +28,7 @@ async def main():
|
||||
"""Create an agent from a declarative yaml specification and run it."""
|
||||
# get the path
|
||||
current_path = Path(__file__).parent
|
||||
yaml_path = current_path.parent.parent.parent.parent / "agent-samples" / "foundry" / "MicrosoftLearnAgent.yaml"
|
||||
yaml_path = current_path.parent.parent.parent.parent / "declarative-agents" / "agent-samples" / "foundry" / "MicrosoftLearnAgent.yaml"
|
||||
# create the agent from the yaml
|
||||
async with (
|
||||
AzureCliCredential() as credential,
|
||||
|
||||
@@ -13,7 +13,7 @@ async def main():
|
||||
"""Create an agent from a declarative yaml specification and run it."""
|
||||
# get the path
|
||||
current_path = Path(__file__).parent
|
||||
yaml_path = current_path.parent.parent.parent.parent / "agent-samples" / "openai" / "OpenAIResponses.yaml"
|
||||
yaml_path = current_path.parent.parent.parent.parent / "declarative-agents" / "agent-samples" / "openai" / "OpenAIResponses.yaml"
|
||||
# create the agent from the yaml
|
||||
agent = AgentFactory(safe_mode=False).create_agent_from_yaml_path(yaml_path)
|
||||
# use the agent
|
||||
|
||||
@@ -243,9 +243,9 @@ async def main() -> None:
|
||||
|
||||
# Load workflow from YAML
|
||||
samples_root = Path(__file__).parent.parent.parent.parent.parent.parent.parent
|
||||
workflow_path = samples_root / "workflow-samples" / "CustomerSupport.yaml"
|
||||
workflow_path = samples_root / "declarative-agents" / "workflow-samples" / "CustomerSupport.yaml"
|
||||
if not workflow_path.exists():
|
||||
# Fall back to local copy if workflow-samples doesn't exist
|
||||
# Fall back to local copy if declarative-agents/workflow-samples doesn't exist
|
||||
workflow_path = Path(__file__).parent / "workflow.yaml"
|
||||
|
||||
workflow = factory.create_workflow_from_yaml_path(workflow_path)
|
||||
|
||||
@@ -190,9 +190,9 @@ async def main() -> None:
|
||||
|
||||
# Load workflow from YAML
|
||||
samples_root = Path(__file__).parent.parent.parent.parent.parent.parent
|
||||
workflow_path = samples_root / "workflow-samples" / "DeepResearch.yaml"
|
||||
workflow_path = samples_root / "declarative-agents" / "workflow-samples" / "DeepResearch.yaml"
|
||||
if not workflow_path.exists():
|
||||
# Fall back to local copy if workflow-samples doesn't exist
|
||||
# Fall back to local copy if declarative-agents/workflow-samples doesn't exist
|
||||
workflow_path = Path(__file__).parent / "workflow.yaml"
|
||||
|
||||
workflow = factory.create_workflow_from_yaml_path(workflow_path)
|
||||
|
||||
Reference in New Issue
Block a user