Skip to content

Sample code for: How to Write an AGENTS.md File for a Python Project#781

Open
lpozo wants to merge 1 commit into
masterfrom
agents-md
Open

Sample code for: How to Write an AGENTS.md File for a Python Project#781
lpozo wants to merge 1 commit into
masterfrom
agents-md

Conversation

@lpozo

@lpozo lpozo commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Where to put new files:

  • New files should go into a top-level subfolder, named after the article slug. For example: my-awesome-article

How to merge your changes:

  1. Make sure the CI code style tests all pass (+ run the automatic code formatter if necessary).
  2. Find an RP Team member on Slack and ask them to review & approve your PR.
  3. Once the PR has one positive ("approved") review, GitHub lets you merge the PR.
  4. 🎉

Code examples for the How to Write an AGENTS.md File for a Python Project tutorial. Files live in the agents-md/ top-level folder, named after the article slug.

Generated from the tutorial markdown with the post-materials skill, then verified locally before pushing.

Contents:

  • original_main.py — the starter FastAPI app
  • run1_main.py — the agent's output without an AGENTS.md (the flawed run)
  • run2_main.py — the agent's output with the AGENTS.md in place
  • test_main.py — tests against run2_main.py (both pass)
  • cars.json — the sample dataset
  • AGENTS.md — the complete config file built across the tutorial

@stephengruppetta stephengruppetta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@lpozo just a minor comment here

Comment thread agents-md/run1_main.py
Comment on lines +29 to +41
def create_car(car: dict):
car["id"] = len(cars) + 1
cars.append(car)
return {"message": "Car created successfully", "car": car}


@app.delete("/cars/{car_id}")
def delete_car(car_id: int):
for i in range(len(cars)):
if cars[i]["id"] == car_id:
cars.pop(i)
return {"message": "Car deleted"}
return {"error": "Car not found"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The original code in the tutorial uses single quotes for the strings in the dicts and for 'id', and this is one of the "flaws" you discuss from the first run. I suggest breaking our convention for proper formatting in the materials and use the original single quotes here, even if CI complains!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants