Skip to content

Commit 5da28b4

Browse files
CopilotronniegeraghtyCopilot
authored
Add AGENTS.md file to align with agents.md standards (#43330)
* Initial plan * Add AGENTS.md file with comprehensive AI agent guidelines Co-authored-by: ronniegeraghty <28957151+ronniegeraghty@users.noreply.github.com> * Fix invalid relative links by converting to absolute GitHub URLs Co-authored-by: ronniegeraghty <28957151+ronniegeraghty@users.noreply.github.com> * Fix relative links in AGENTS.md for Build Analyze CI Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix broken agents.md link causing Build Analyze failure Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Sync copilot-instructions.md with main, fix link validation Added verify-setup tool requirement and SDK release link from main. Converted relative link to absolute URL. Added TypeSpec workflow and local SDK generation sections. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address review feedback: tox→azpysdk, update doc links Replace all tox references with azpysdk test runner per reviewer feedback from l0lawrence and JennyPng. Update command examples to use 'azpysdk <environment> .' syntax and fix doc link anchors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address 3 review threads: skills location, copilot-instructions relationship, Python 3.10 - Add .github/skills/ and .github/prompts/ to repository structure tree (thread 1) - Add 'Relationship to Copilot Instructions' section explaining AGENTS.md is the primary standard and referencing copilot-instructions.md for deeper detail (thread 2) - Update minimum Python version from 3.9 to 3.10 per upcoming support drop (thread 3) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix broken link and convert relative links to absolute in AGENTS.md - Replace 404 link https://github.com/anthropics/agents-md with https://github.com/agentsmd/agents.md (the spec moved to the Agentic AI Foundation) - Convert relative links (.github/copilot-instructions.md, .github/skills/, .github/prompts/) to absolute GitHub URLs per Azure SDK link verification requirements Fixes Build Analyze 'Link verification check' failure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ronniegeraghty <28957151+ronniegeraghty@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Ronnie Geraghty <rgeraghty@microsoft.com> Co-authored-by: Ronnie Geraghty <ronniegeraghty@users.noreply.github.com>
1 parent 1fa00e1 commit 5da28b4

2 files changed

Lines changed: 322 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# AZURE SDK FOR PYTHON - COPILOT INSTRUCTIONS
22

3+
> **Note**: For general AI agent guidelines and repository overview, see [AGENTS.md](https://github.com/Azure/azure-sdk-for-python/blob/main/AGENTS.md) at the repository root.
4+
35
---
46

57
## CORE PRINCIPLES

AGENTS.md

Lines changed: 320 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,320 @@
1+
# AGENTS.md - Azure SDK for Python
2+
3+
This file describes how AI agents (e.g., GitHub Copilot, MCP servers, or LLM-based assistants) should interact with this repository.
4+
5+
## Repository Overview
6+
7+
**Purpose**: This repository contains the active development of the Azure SDK for Python, providing client libraries and management libraries for Azure services.
8+
9+
**Scope**:
10+
- 100+ Python packages for Azure services
11+
- Client libraries for data plane operations
12+
- Management libraries for Azure Resource Manager (ARM)
13+
- Shared core functionality (authentication, retries, logging, transport)
14+
- TypeSpec-based SDK generation from API specifications
15+
- Comprehensive testing, validation, and documentation infrastructure
16+
17+
**Main Branch**: `main`
18+
19+
**Key Documentation**:
20+
- [Azure SDK Python Design Guidelines](https://azure.github.io/azure-sdk/python_design.html)
21+
- [Contributing Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/CONTRIBUTING.md)
22+
- [Developer Documentation](https://github.com/Azure/azure-sdk-for-python/tree/main/doc/dev)
23+
24+
## Repository Structure
25+
26+
```
27+
azure-sdk-for-python/
28+
├── sdk/ # Service-specific libraries (e.g., sdk/storage/, sdk/ai/)
29+
├── eng/ # Engineering system tools and configurations
30+
├── doc/ # Developer documentation and guides
31+
├── scripts/ # Automation scripts
32+
├── .github/ # GitHub workflows, Copilot instructions, skills, and prompts
33+
│ ├── copilot-instructions.md # Detailed Copilot-specific guidance
34+
│ ├── skills/ # Reusable Copilot skills (e.g., find-package, fix-pylint)
35+
│ └── prompts/ # Copilot prompt files for common tasks
36+
└── tools/ # Development tools
37+
```
38+
39+
## AI Agent Guidelines
40+
41+
### Supported Actions
42+
43+
AI agents can assist with the following activities:
44+
45+
#### Code Generation & Development
46+
- **TypeSpec SDK Generation**: Generate Python SDKs from TypeSpec specifications
47+
- Follow the complete workflow in `.github/copilot-instructions.md`
48+
- Use MCP tools for environment verification, code generation, and validation
49+
- Time estimate: 10-15 minutes for full generation workflow
50+
51+
- **Code Fixes**: Address linting, type checking, and validation issues
52+
- Pylint, MyPy, Pyright, Verifytypes, Sphinx warnings
53+
- Follow official guidelines and existing patterns
54+
- Make minimal, surgical changes
55+
56+
- **Documentation**: Update CHANGELOG.md, README files, and API documentation
57+
- Follow existing formatting conventions
58+
- Include version information and release dates
59+
60+
#### Testing & Validation
61+
- **Run Tests**: Execute test suites using the `azpysdk` test runner
62+
- Unit tests, integration tests, samples
63+
- Support both local and CI environments
64+
65+
- **Static Analysis**: Run and fix issues from:
66+
- Pylint (code quality)
67+
- MyPy, Pyright (type checking)
68+
- Bandit (security)
69+
- Black (formatting)
70+
- Sphinx (documentation)
71+
72+
#### Pull Request Management
73+
- **PR Creation**: Create draft PRs with descriptive titles and descriptions
74+
- **PR Review**: Analyze PR feedback and make requested changes
75+
- **Status Checks**: Monitor CI/CD pipeline status and address failures
76+
77+
#### Issue Triage & Labeling
78+
- **Issue Analysis**: Review and categorize issues
79+
- **Service Labels**: Validate and create service labels (e.g., `Azure.AI.Projects`)
80+
- **CODEOWNERS**: Validate and update CODEOWNERS entries
81+
82+
### Relationship to Copilot Instructions
83+
84+
This `AGENTS.md` file is the primary reference for AI agents working in this repository. It follows the [AGENTS.md standard](https://github.com/agentsmd/agents.md) that most AI coding tools recognize automatically. For additional Copilot-specific guidance (e.g., TypeSpec generation details, MCP tool usage), see [`.github/copilot-instructions.md`](https://github.com/Azure/azure-sdk-for-python/blob/main/.github/copilot-instructions.md). Reusable skills are available in [`.github/skills/`](https://github.com/Azure/azure-sdk-for-python/tree/main/.github/skills/) and prompt templates in [`.github/prompts/`](https://github.com/Azure/azure-sdk-for-python/tree/main/.github/prompts/).
85+
86+
### Key Workflows
87+
88+
#### 1. TypeSpec SDK Generation Workflow
89+
90+
**Prerequisites**:
91+
- GitHub CLI authenticated (`gh auth login`)
92+
- Feature branch (not `main`)
93+
- PowerShell installed (for MCP tools)
94+
- Python virtual environment active
95+
96+
**Steps**:
97+
1. **Environment Verification** - Use `verify_setup` MCP tool
98+
2. **SDK Generation** - Use azure-sdk-python-mcp generation tools (~2 minutes)
99+
3. **Static Validation** - Run sequential validation steps (~3-5 minutes each):
100+
- Pylint, MyPy, Pyright, Verifytypes
101+
- Sphinx, Mindependency, Bandit, Black
102+
- Samples, Breaking changes
103+
4. **Documentation Update** - Update CHANGELOG.md and version files
104+
5. **Commit & Push** - Stage, commit, and push changes
105+
6. **PR Creation** - Create draft PR with generated description
106+
7. **Handoff** - Provide PR link for azure-rest-api-specs agent
107+
108+
**Estimated Time**: 10-15 minutes
109+
110+
#### 2. Code Quality Workflow
111+
112+
**Running Validation**:
113+
```bash
114+
# Use azpysdk with appropriate environment from the package directory
115+
azpysdk <environment> .
116+
117+
# Examples:
118+
azpysdk pylint .
119+
azpysdk mypy .
120+
```
121+
122+
**Fixing Issues**:
123+
- Reference official guidelines:
124+
- [Pylint Guidelines](https://github.com/Azure/azure-sdk-tools/blob/main/tools/pylint-extensions/azure-pylint-guidelines-checker/README.md)
125+
- [MyPy Type Checking Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/static_type_checking_cheat_sheet.md)
126+
- [azpysdk Test Runner Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/tests.md)
127+
- Make minimal changes that address specific warnings
128+
- Avoid adding new dependencies or large refactoring
129+
- Rerun validation after each fix
130+
131+
#### 3. SDK Release Workflow
132+
133+
**Check Release Readiness**:
134+
- Use `CheckPackageReleaseReadiness` MCP tool
135+
- Validates: API review status, changelog, package approval, release date
136+
137+
**Release Package**:
138+
- Use `ReleasePackage` MCP tool
139+
- Triggers release pipeline (requires approval)
140+
141+
**Release Blocking Checks**:
142+
- MyPy: PASS
143+
- Pylint: PASS
144+
- Sphinx: PASS
145+
- Tests - CI: PASS
146+
147+
### Automation Boundaries
148+
149+
#### Safe Operations
150+
✅ Generate SDK code from TypeSpec specifications
151+
✅ Run linting and static analysis tools
152+
✅ Fix code quality warnings (with high confidence)
153+
✅ Update documentation (CHANGELOG, README)
154+
✅ Create and update PRs in draft mode
155+
✅ Run existing test suites
156+
✅ Validate CODEOWNERS entries
157+
158+
#### Restricted Operations
159+
⚠️ Modifying generated code (requires review)
160+
⚠️ Adding new dependencies (requires justification)
161+
⚠️ Changing API signatures (requires design review)
162+
⚠️ Disabling or removing tests (requires explanation)
163+
⚠️ Large-scale refactoring (requires approval)
164+
165+
#### Prohibited Operations
166+
❌ Merging PRs without human review
167+
❌ Releasing packages to PyPI
168+
❌ Modifying CI/CD pipeline definitions
169+
❌ Changing security or authentication logic without security review
170+
❌ Committing secrets or credentials
171+
❌ Force pushing to protected branches
172+
173+
### Environment Requirements
174+
175+
**Required Tools**:
176+
- Python 3.10 or later
177+
- Node.js (for TypeSpec generation)
178+
- azpysdk (test runner and automation)
179+
- GitHub CLI (for PR operations)
180+
- PowerShell (for MCP server on Windows)
181+
182+
**MCP Server Tools**:
183+
- `azure-sdk-python-mcp` - Python-specific SDK operations
184+
- `azure-sdk-mcp` - Cross-language SDK operations
185+
- `azsdk-tools` - Engineering system utilities
186+
187+
**Virtual Environment**:
188+
```bash
189+
# Create and activate virtual environment
190+
python -m venv .venv
191+
source .venv/bin/activate # Linux/macOS
192+
.venv\Scripts\activate # Windows
193+
```
194+
195+
### CI/CD Integration
196+
197+
**Pipeline System**: Azure DevOps
198+
199+
**Key Pipelines**:
200+
- **Python CI**: Core library tests and validation
201+
- **SDK Generation**: TypeSpec-based code generation
202+
- **Release**: Package publication to PyPI
203+
204+
**Status Monitoring**:
205+
- Use `get_pipeline_status` MCP tool
206+
- Check build logs for failures
207+
- Analyze failed tests with `get_failed_test_cases` tool
208+
209+
**Artifact Analysis**:
210+
- Download artifacts with `get_pipeline_llm_artifacts`
211+
- Review TRX test results
212+
- Analyze log files with `analyze_log_file` tool
213+
214+
### SDK-Specific Conventions
215+
216+
#### Package Naming
217+
- Client libraries: `azure-<service>-<component>` (e.g., `azure-storage-blob`)
218+
- Management libraries: `azure-mgmt-<service>` (e.g., `azure-mgmt-compute`)
219+
220+
#### Version Conventions
221+
- Semantic versioning: `MAJOR.MINOR.PATCH`
222+
- Preview versions: `MAJOR.MINOR.PATCHbN` (e.g., `1.0.0b1`)
223+
- Pre-release format in CHANGELOG: `## 1.0.0b1 (YYYY-MM-DD)`
224+
225+
#### Code Style
226+
- Follow [PEP 8](https://peps.python.org/pep-0008/)
227+
- Use Black for formatting
228+
- Type hints required (PEP 484)
229+
- Docstrings in NumPy/Google style
230+
231+
#### Testing
232+
- Use pytest framework
233+
- Separate live and recorded tests
234+
- Test recordings in `tests/recordings/`
235+
- Environment variables for credentials (never hardcode)
236+
237+
## Cross-References
238+
239+
**Detailed Copilot Instructions**: See [.github/copilot-instructions.md](https://github.com/Azure/azure-sdk-for-python/blob/main/.github/copilot-instructions.md) for:
240+
- Complete TypeSpec SDK generation workflow
241+
- Detailed validation steps and commands
242+
- Pylint and MyPy fixing guidelines
243+
- SDK health status interpretation
244+
- SDK release procedures
245+
246+
**Developer Documentation**: See [doc/dev/](https://github.com/Azure/azure-sdk-for-python/tree/main/doc/dev) for:
247+
- [TypeSpec Generation Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/ai/typespec_generation.md)
248+
- [Testing Guide](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/tests.md)
249+
- [Test Runner (azpysdk)](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/tests.md)
250+
- [Pylint Checking](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/pylint_checking.md)
251+
- [Type Checking Cheat Sheet](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/static_type_checking_cheat_sheet.md)
252+
253+
## Example Prompts
254+
255+
### SDK Generation
256+
```
257+
"Generate a Python SDK using TypeSpec from tspconfig.yaml at <path>"
258+
"Start TypeSpec SDK generation workflow"
259+
"Generate SDK from my local TypeSpec project at sdk/cognitiveservices/azure-ai-projects"
260+
```
261+
262+
### Validation & Fixes
263+
```
264+
"Run pylint validation and fix any warnings"
265+
"Check if my SDK passes all static validation steps"
266+
"Fix the mypy errors in the generated SDK"
267+
```
268+
269+
### Release Management
270+
```
271+
"Check if azure-ai-projects is ready for release"
272+
"What is the health status of azure-storage-blob?"
273+
"Release azure-ai-inference version 1.0.0"
274+
```
275+
276+
### Repository Health
277+
```
278+
"Show me the health status for azure-ai-projects"
279+
"Which checks are blocking the release of this library?"
280+
"Are there any open customer issues for this package?"
281+
```
282+
283+
## Agent Behavior Guidelines
284+
285+
### Best Practices
286+
1. **Always verify environment first** - Run `verify_setup` before SDK operations
287+
2. **Inform users of time expectations** - SDK generation takes 10-15 minutes
288+
3. **Make minimal changes** - Only modify files with validation errors
289+
4. **Reference official documentation** - Link to Azure SDK design guidelines
290+
5. **Run validation iteratively** - Fix and rerun each step before proceeding
291+
6. **Use MCP tools when available** - Leverage specialized SDK tooling
292+
7. **Create draft PRs** - Never create PRs in ready-for-review state
293+
8. **Report progress frequently** - Use incremental commits
294+
295+
### Error Handling
296+
- For TypeSpec errors: Direct users to fix in source repository
297+
- For authentication failures: Guide through `gh auth login`
298+
- For missing dependencies: Provide installation instructions with links
299+
- For validation failures: Reference specific fixing guidelines
300+
- For pipeline failures: Analyze logs and provide actionable feedback
301+
302+
### Communication Style
303+
- Don't repeat instructions - reference documentation links
304+
- Be concise and actionable
305+
- Use markdown formatting for commands and code
306+
- Provide time estimates for long operations
307+
- Highlight release-blocking issues clearly
308+
309+
## Reporting Issues
310+
311+
To report issues with AI agent interactions or suggest improvements:
312+
- **GitHub Issues**: [Azure SDK for Python Issues](https://github.com/Azure/azure-sdk-for-python/issues)
313+
- **Label**: Use `Agent` label for agent-related issues
314+
- **Include**: Agent name/version, prompt used, expected vs actual behavior
315+
316+
## Version
317+
318+
**AGENTS.md Version**: 1.0.0
319+
**Last Updated**: 2025-01-22
320+
**Specification**: Follows the AGENTS.md canonical structure

0 commit comments

Comments
 (0)