Skip to content

Conversation

@eavanvalkenburg
Copy link
Member

@eavanvalkenburg eavanvalkenburg commented Nov 7, 2025

Motivation and Context

  1. Adds a declarative spec package
  2. Adds the same folder in core
  3. helpers for parsing the yaml into a object
  4. loader that takes either a yaml string or a yaml path and creates a ChatAgent based on it

Closes #1471 for python

Todo:

  • additional tests with agent-samples
  • mypy typing
  • documentation

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings November 7, 2025 14:51
@eavanvalkenburg eavanvalkenburg marked this pull request as draft November 7, 2025 14:51
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Nov 7, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds declarative YAML-based agent specification support to the Microsoft Agent Framework Python implementation. The changes enable developers to define agents using YAML files that can be loaded and instantiated at runtime.

Key changes:

  • New agent-framework-declarative package with YAML parsing and PowerFx expression evaluation
  • Model classes for representing MAML (Microsoft Agent Markup Language) objects
  • AgentFactory class for creating agents from YAML specifications
  • Sample agents demonstrating various scenarios (OpenAI, Azure, tools, etc.)
  • Updates to core framework to support additional chat options

Reviewed Changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
python/packages/declarative/* New declarative package with models, loader, and factory
python/samples/getting_started/declarative/* Sample applications demonstrating declarative agent usage
agent-samples/*.yaml YAML agent definitions for various providers and scenarios
python/packages/core/agent_framework/declarative/* Core package integration for declarative module
python/packages/core/agent_framework/_agents.py Added allow_multiple_tool_calls parameter support
python/packages/core/agent_framework/_clients.py Added allow_multiple_tool_calls parameter support
python/pyproject.toml Added declarative package to dependencies
python/uv.lock Updated lock file with new dependencies

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Nov 7, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _agents.py2835181%329, 388–390, 436, 485, 503, 665, 844, 847–849, 970–973, 975, 978–980, 1063, 1104, 1106, 1115–1120, 1126, 1128, 1138–1139, 1146, 1148–1149, 1157–1161, 1169–1170, 1172, 1177, 1179, 1213, 1254–1255, 1257, 1270
   _clients.py1041288%268, 384, 430–433, 477, 671, 674–675, 806, 808
TOTAL15010221485% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
2172 127 💤 0 ❌ 0 🔥 53.552s ⏱️

@markwallace-microsoft
Copy link
Member

@eavanvalkenburg Consider creating your own feature branch for this work so the changes can be broken down into multiples PR's. I've done this on the .NET side as I'm expecting a very large number of unit tests.

@eavanvalkenburg
Copy link
Member Author

I'll get this into a feature branch once this first iteration is very close to done

@eavanvalkenburg eavanvalkenburg marked this pull request as ready for review November 13, 2025 13:46
@eavanvalkenburg eavanvalkenburg requested a review from a team as a code owner November 13, 2025 13:46
@eavanvalkenburg eavanvalkenburg force-pushed the declarative branch 2 times, most recently from 644c9d6 to 0aee147 Compare November 17, 2025 10:04
@eavanvalkenburg eavanvalkenburg force-pushed the declarative branch 2 times, most recently from 9c9d650 to 5879a8b Compare November 17, 2025 13:59
@crickman crickman added the agents Issues related to single agents label Nov 17, 2025
@nstijepovic
Copy link

Hey all, sorry to hijack the PR, quick question: is there any plan to include the YAML declarative workflow approach (similar to what we have for C#)? Maybe not in this PR, but in the roadmap? Thanks! :)

@eavanvalkenburg
Copy link
Member Author

@nstijepovic yes that is the plan, and both workflows and agents should be able to be parsed in both dotnet and python from the same yaml file.

@eavanvalkenburg eavanvalkenburg removed the request for review from a team November 19, 2025 16:06
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Nov 19, 2025
Merged via the queue into microsoft:main with commit 92df9e1 Nov 19, 2025
24 checks passed
arisng pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
* first work on declarative

* initial version of the declarative support

* fix tests and mypy

* fix parameters of functiontool

* slight logic improvement

* remove path until merge

* updates from comments

* create dispatcher and spec type, json_schema method

* fix mypy, skipping model

* updated lock

* fixed declarative tests and renamed some other test files

* refined loader

* updated lock

* fix mypy

* added readme to samples folder

* fixes from review

* undid test file rename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Issues related to single agents documentation Improvements or additions to documentation python

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Single Agent: Declarative Support

7 participants