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, 664, 843, 846–848, 969–972, 974, 977–979, 1062, 1103, 1105, 1114–1119, 1125, 1127, 1137–1138, 1145, 1147–1148, 1156–1160, 1168–1169, 1171, 1176, 1178, 1212, 1253–1254, 1256, 1269
   _clients.py1061486%268, 384, 430–433, 477, 675, 679, 682–683, 722, 812, 814
TOTAL13035195285% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
1870 107 💤 0 ❌ 0 🔥 47.122s ⏱️

@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.

middleware: Middleware | list[Middleware] | None = None,
# chat options
allow_multiple_tool_calls: bool | None = None,
conversation_id: str | None = None,

Choose a reason for hiding this comment

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

Consider separating this into it's own PR and getting it into main straight away

"logit",
"logprobs",
"lowlevel",
"maml",

Choose a reason for hiding this comment

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

Do not use this term it is for internal use only, just use the generic term declarative agents

"name": "OpenAIChatClient",
"model_id_field": "model_id",
},
"OpenAI.Completions": {

Choose a reason for hiding this comment

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

What are OpenAI.Completions?

IIRC the spec supports "Chat" or "Responses" and then we also want to handle "Assistants" as a custom type until it reaches end of life.


# If no kind field, assume it's an AgentManifest
if kind is None:
return AgentManifest.from_dict(as_dict)

Choose a reason for hiding this comment

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

What is the thinking behind making a manifest the default type rather than a prompt agent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Single Agent: Declarative Support

2 participants