Streamlined Sitecore Agents with Microsoft Agent Framework
Last week I shared a Gradio-based Sitecore Agent playground that demonstrated how to build interactive AI agents on top of the Sitecore Agent API. While that sample was great for understanding the concepts and creating demos, sometimes you need something lighterβa simple console application that gets straight to the point.
Enter the MAF-Sitecore-Agent-API repository: another teaching example that uses Microsoft Agent Framework and Azure OpenAI to strip away the web UI complexity and focus purely on the agent mechanics. Like the Gradio version, this is educational code designed to help developers understand integration patterns, not a production-ready application.
Why Microsoft Agent Framework?
While LangChain is powerful and flexible, Microsoft Agent Framework offers a more opinionated, enterprise-ready approach that integrates seamlessly with Azure services. For teams already invested in the Microsoft ecosystem, it provides:
- Native Azure OpenAI integration with built-in authentication and scaling
- Simplified agent orchestration without the complexity of custom ReAct loops
- Enterprise-grade logging and monitoring through Azure Application Insights
- Consistent patterns that align with other Microsoft AI services
The tradeoff is less flexibility compared to LangChain, but for straightforward agent scenarios like Sitecore API automation, thatβs often exactly what you want.
Architecture comparison
The Gradio version used LangChainβs ReAct pattern with custom tool generation. This Microsoft Agent Framework approach simplifies the stack:
βββββββββββββββββββββββββββ
β Console Interface β
β - Natural language β
β - Command loop β
ββββββββββββ¬βββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββ
β Microsoft Agent Frameworkβ
β - Built-in reasoning β
β - Tool orchestration β
ββββββββββββ¬βββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββ
β Azure OpenAI β
β - GPT-4o integration β
β - Managed scaling β
ββββββββββββ¬βββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββ
β Sitecore Agent API β
β - Auto-generated toolsβ
β - OAuth authenticationβ
βββββββββββββββββββββββββββ
Getting started
The setup is intentionally minimal. Clone the repo and configure three key pieces:
git clone https://github.com/kevinpbuckley/MAF-Sitecore-Agent-API.git
cd MAF-Sitecore-Agent-API
pip install -r requirements.txt
cp .env.sample .env
Edit .env with your credentials:
# Azure OpenAI
AZURE_OPENAI_API_KEY=your-azure-openai-key
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4o
# Sitecore (from XM Cloud Deploy automation credentials)
SITECORE_CLIENT_ID=your-client-id
SITECORE_CLIENT_SECRET=your-client-secret
Then run:
python sitecore_agent.py
The agent downloads the latest Sitecore OpenAPI spec, generates tools for all 39 operations, and drops you into an interactive chat session.
Example interactions
The console interface accepts natural language commands and translates them into appropriate API calls:
- βlist sitesβ β Calls the sites endpoint and formats the response
- βshow pages for nextjs-skate-park siteβ β Retrieves pages for a specific site
- βget site details for alarisβ β Fetches comprehensive site information
- βsearch for content items with βheroβ in the nameβ β Queries content across the instance
Each command follows the same pattern: the agent parses your intent, selects the appropriate Sitecore operation, handles OAuth authentication, and returns formatted results.
Key differences from the Gradio version
| Aspect | Gradio Sample | MAF Console |
|---|---|---|
| Interface | Web UI with chat + status indicators | Terminal-only interaction |
| Framework | LangChain with custom ReAct loop | Microsoft Agent Framework |
| Model | OpenAI API (various providers) | Azure OpenAI only |
| Dependencies | Heavy (Gradio + LangChain + Pydantic) | Minimal (Agent Framework + requests) |
Looking ahead
Both samples demonstrate the same core concept: modern AI agents can consume OpenAPI specifications and provide natural language interfaces to complex APIs. The choice between LangChain flexibility and Agent Framework opinions depends on your teamβs priorities and existing infrastructure.
For teams exploring Sitecore automation you should probably explore Sitecoreβs MCP Server and Agent Studio as well.