-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Python: docs(declarative): Comprehensive YAML schema documentation #3641
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
- Complete documentation of all 10 supported providers with correct model_id_field values - All connection types (remote, key, reference, anonymous) - All 7 tool types with exact field names from source code - MCP approval modes (always, never, specify) - PowerFx expressions and environment variables - Input/Output schemas with property types - Python usage examples with AgentFactory - Validation and error reference - Based on actual source code analysis of _loader.py and _models.py
Changed PowerFx Documentation link from 404 URL to correct URL: https://learn.microsoft.com/en-us/power-platform/power-fx/overview
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 replaces the minimal declarative README with a comprehensive reference for the declarative YAML schema used by agent-framework-declarative, including providers, connection types, tools, schemas, PowerFx usage, and Python integration via AgentFactory.
Changes:
- Rewrites
python/packages/declarative/README.mdto fully describe the YAML schema forPromptAgent, models, connections, tools, and input/output schemas, with structured examples. - Documents PowerFx expression usage and environment variable handling in YAML, along with common validation/errors.
- Adds Python usage patterns showing how to construct agents from YAML with
AgentFactory, including bindings, connections, and client configuration.
The /api/mcp endpoint is an SSE endpoint that returns 405 when accessed directly via HTTP GET. Replaced with the Microsoft Learn MCP Server documentation page which is accessible and provides proper context about the MCP protocol.
- Fix maxTokens → maxOutputTokens (correct field name per ModelOptions) - Clarify PowerFx expression support (only specific fields, not all strings) - Fix ValueError → DeclarativeLoaderError with accurate messages - Add section for extending with custom providers (Bedrock, Google, etc.) - Add version tracking section for documentation maintenance - Note: Kept AzureAI.ProjectProvider as it EXISTS in PROVIDER_TYPE_OBJECT_MAPPING
Response to Review CommentsThank you for the thorough review! I've analyzed each comment against the actual source code in Comment 1: AzureAI.ProjectProvider ❌ Reviewer incorrect - keeping as-isThe reviewer claimed # From _loader.py lines 97-101:
"AzureAI.ProjectProvider": {
"package": "agent_framework_azure_ai",
"name": "AzureAIProjectAgentProvider",
},The repository has 10 providers (not 9), and Comment 2: maxTokens vs maxOutputTokens ✅ FixedThe reviewer is correct. The # From _models.py ModelOptions class:
def __init__(
self,
frequencyPenalty: float | None = None,
maxOutputTokens: int | None = None, # ← Correct field name
...I've updated all examples to use Comment 3: AgentFactory signature ❌ Reviewer partially incorrect - documentation was accurateThe reviewer claimed some parameters don't exist. After checking # From _loader.py AgentFactory.__init__:
def __init__(
self,
*,
chat_client: ChatClientProtocol | None = None,
bindings: Mapping[str, Any] | None = None,
connections: Mapping[str, Any] | None = None,
client_kwargs: Mapping[str, Any] | None = None,
additional_mappings: Mapping[str, ProviderTypeMapping] | None = None,
default_provider: str = "AzureAIClient",
safe_mode: bool = True, # ← EXISTS
env_file_path: str | None = None, # ← EXISTS (not "env_file")
env_file_encoding: str | None = None, # ← EXISTS
) -> None:Also, Comment 4: PowerFx expression support ✅ FixedThe reviewer is correct. PowerFx is only evaluated on specific fields via
Comment 5: ValueError vs DeclarativeLoaderError ✅ FixedThe reviewer is correct. The code uses # From _loader.py:
class DeclarativeLoaderError(Exception):
"""Raised when an error occurs during declarative agent loading."""
pass
# Actual error messages:
raise DeclarativeLoaderError("Only definitions for a PromptAgent are supported...")
raise DeclarativeLoaderError("ChatClient must be provided...")I've updated the error section to reflect the correct exception type and messages. Additional Changes
Thanks again for the review! |
Summary
This PR adds comprehensive documentation for the declarative YAML schema in the
agent-framework-declarativepackage.Motivation and Context
The current README.md only contains basic installation instructions. Developers using the declarative YAML approach need detailed documentation on:
This documentation is based on direct analysis of the source code (
_loader.pyand_models.py) to ensure accuracy.Description
Changes Made
Complete rewrite of
python/packages/declarative/README.mdincluding:Provider Documentation
All 10 providers from
PROVIDER_TYPE_OBJECT_MAPPINGwith correctmodel_id_fieldvalues:AzureOpenAI.Chat,AzureOpenAI.Assistants,AzureOpenAI.ResponsesOpenAI.Chat,OpenAI.Assistants,OpenAI.ResponsesAzureAIClient,AzureAIAgentClient,AzureAI.ProjectProviderAnthropic.ChatConnection Types
RemoteConnection(kind: remote)ApiKeyConnection(kind: key)ReferenceConnection(kind: reference)AnonymousConnection(kind: anonymous)Tool Types
FunctionToolwith bindingsWebSearchToolFileSearchToolwith vector store configurationCodeInterpreterToolMcpToolwith approval modes (always, never, specify)OpenApiToolCustomToolAdditional Documentation
AgentFactoryAgentFactoryconstructor parameters and methodsSource Code References
All documentation was verified against:
_loader.py- AgentFactory and PROVIDER_TYPE_OBJECT_MAPPING_models.py- All Pydantic modelsContribution Checklist