Build Custom Copilot Agents in Seconds: Meet CreateAgentYAML.py – A Hidden Gem for Microsoft 365 Copilot Fans
YAML Hell? Nah, Just Run This Script and Watch Your Agent Manifest Write Itself (While You Grab Coffee)
If you’re deep in the Microsoft 365 Copilot ecosystem (or the new “Agent” wave with Copilot Studio), you know one of the biggest pain points: creating the agent manifest YAML file by hand.
That YAML file defines everything about your custom agent:
Name, description, icons
Instructions (the system prompt)
Capabilities (web search, file access, etc.)
Actions (API calls, plugins)
Authentication settings
And a dozen other fields that are easy to get wrong
One tiny indentation error and your agent fails to deploy. 😩
Enter a tiny but insanely useful Python script:
CreateAgentYAML.py
What does it do?
It asks you a series of friendly questions in the terminal (or you can pass arguments), then spits out a perfectly formatted, ready-to-use agent.yaml manifest for Microsoft Copilot Studio / Microsoft 365 Agents.
No more copying from half-broken samples.
No more guessing which fields are required vs optional in 2025.
No more YAML syntax nightmares.
Just run the script → answer ~20 simple questions → get a deploy-ready file.
Why this is awesome right now (November 2025)
Microsoft has been rapidly evolving the agent platform:
Declarative agents in Copilot Studio
The new “Bring Your Own Agent” model in Microsoft 365
Built-in support for custom instructions + tools + auth
The official templates exist, but they’re scattered across docs and they get outdated fast. Rod’s script appears to be kept current with the latest schema (as of late 2025 it includes the newest fields like icon_url, categories, model_override, multi-language support, etc.).
How to use it (30-second guide)
# Clone Rod’s junk drawer (yes, that’s literally the repo name 😂)
git clone https://github.com/rod-trent/JunkDrawer.git
cd JunkDrawer/AgentBuilder
# Run the script
python CreateAgentYAML.pyCommand line to run the tool:
python createagentyaml.py --prompt "Create a researcher agent for AI news" --output "custom_agent.yaml"When you’re done, it creates agent.yaml in the current folder.
Drop that file into Copilot Studio → New Agent → Import manifest → boom, your custom agent is live.
Get and Implement an xAI Key
To implement the API key in the provided Python script for generating CrewAI agent YAML files using the Grok API, start by creating a .env file in the same directory as the script. Inside this file, add a line in the format XAI_API_KEY=your_actual_api_key_here, replacing the placeholder with your valid xAI API key obtained from their developer portal. The script automatically loads this environment variable using the load_dotenv() function from the python-dotenv library, which reads the .env file and makes the key accessible. Then, when initializing the OpenAI-compatible client, it retrieves the key via os.getenv(”XAI_API_KEY”) and passes it to the api_key parameter. This approach ensures the key remains secure and not hardcoded in the source code, allowing for easy management across different environments while preventing accidental exposure in version control systems.
Bonus: It’s in the “JunkDrawer” repo
Rod Trent (aka @rodtrent on X/Mastodon) is famous for dropping ridiculously useful Sentinel KQL, SOAR playbooks, and random automation gold into his JunkDrawer repo. This AgentBuilder folder is just the latest treasure.
If you live in Microsoft 365, Defender, or Sentinel, star that repo. You’ll thank yourself later.
Final thoughts
In a world where everyone is racing to build the next killer agent, the winners will be the ones who can prototype fastest. Tools like CreateAgentYAML.py shave hours off that loop.
Huge thanks to Rod for open-sourcing yet another time-saver.
Go grab it here:
https://github.com/rod-trent/JunkDrawer/blob/main/AgentBuilder/CreateAgentYAML.py
Now stop hand-crafting YAML and start shipping agents 🤖
P.S. If you build something cool with it, tag me! I’d love to see what people are creating in 2026.


