Sample project demonstrating how to use the Microsoft Agent Framework with the Sitecore Agent API using OpenAPI specifications.
- Automatically generates function tools from Sitecore Agent API OpenAPI spec
- Downloads latest API spec on each run
- OAuth 2.0 authentication with Sitecore Cloud
- Interactive chat interface for Sitecore operations
- All 39 Sitecore API operations available (Sites, Pages, Content, Components, Assets, Jobs, etc.)
- Python 3.13+
- Azure OpenAI account with deployment
- Sitecore XM Cloud instance
- Sitecore automation client credentials
- Clone the repository:
git clone https://github.com/kevinpbuckley/MAF-Sitecore-Agent-API.git
cd MAF-Sitecore-Agent-API- Install dependencies:
pip install -r requirements.txt- Create
.envfile from sample:
cp .env.sample .env- Configure your environment variables in
.env:- Azure OpenAI credentials
- Sitecore client ID and secret (from XM Cloud Deploy automation credentials)
- Go to Sitecore Cloud Portal
- Open XM Cloud Deploy
- Navigate to Credentials > Environment > Create credentials > Automation
- Copy the client ID and client secret to your
.envfile
Run the interactive agent:
python sitecore_agent.pyExample commands:
- "list sites"
- "show pages for nextjs-skate-park site"
- "get site details for alaris"
- "search for content items"
Type exit or quit to stop.
The agent automatically:
- Downloads the latest Sitecore Agent API OpenAPI spec
- Generates Python function tools for all 39 operations
- Authenticates with Sitecore using OAuth 2.0
- Uses Azure OpenAI to understand natural language commands
- Calls appropriate Sitecore API operations based on user intent
- Sites: List sites, get site details, list pages, get site ID from item
- Pages: Create pages, add languages, add components, search, get HTML/screenshots
- Content: Create, read, update, delete content items
- Components: List components, create datasources, search datasources
- Assets: Upload, search, get info, update metadata
- Environments: Get available languages
- Personalization: Create personalized variants
- Jobs: View job details, revert operations
MAF-Sitecore-Agent-API/
├── sitecore_agent.py # Main agent implementation
├── index.json # Cached OpenAPI spec (auto-updated)
├── requirements.txt # Python dependencies
├── .env.sample # Environment variables template
├── .gitignore # Git ignore file
└── README.md # This file
MIT