-
Notifications
You must be signed in to change notification settings - Fork 682
Python: Introducing support for declarative yaml spec #2002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
67f4b8d to
f7ad21d
Compare
There was a problem hiding this 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-declarativepackage with YAML parsing and PowerFx expression evaluation - Model classes for representing MAML (Microsoft Agent Markup Language) objects
AgentFactoryclass 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 |
python/samples/getting_started/declarative/azure_openai_responses_agent.py
Show resolved
Hide resolved
python/packages/declarative/agent_framework_declarative/_loader.py
Outdated
Show resolved
Hide resolved
python/packages/declarative/agent_framework_declarative/_models.py
Outdated
Show resolved
Hide resolved
python/packages/declarative/agent_framework_declarative/_models.py
Outdated
Show resolved
Hide resolved
python/packages/declarative/agent_framework_declarative/_models.py
Outdated
Show resolved
Hide resolved
Python Test Coverage Report •
Python Unit Test Overview
|
|||||||||||||||||||||||||||||||||||
|
@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, |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
Motivation and Context
Closes #1471 for python
Todo:
Description
Contribution Checklist