Work IQ - Workplace intelligence for AI agents
In this lab, you’ll build an AI agent that accesses your Microsoft 365 workplace data using Work IQ - Microsoft’s contextual intelligence layer built on the Model Context Protocol (MCP). You’ll create a workplace intelligence agent that can prepare for meetings, track projects, extract action items, and answer workplace questions using real M365 data.
This lab takes approximately 40 minutes.
Note: This is an optional/advanced lab that requires a Microsoft 365 Copilot license. It’s designed for enterprise learners, Microsoft employees, or those with M365 Copilot access. Standard M365 accounts without Copilot will not work.
Learning Objectives
By the end of this lab, you’ll be able to:
- Understand Work IQ architecture and how it integrates with Microsoft 365
- Connect AI agents to Work IQ using the Model Context Protocol (MCP)
- Build workplace intelligence scenarios (meeting prep, project tracking, action items)
- Combine Work IQ (workplace signals) with Foundry IQ (knowledge base)
- Design effective queries for workplace data
- Handle authentication, permissions, and privacy correctly
Prerequisites
Before starting this lab, ensure you have:
- Basic understanding of AI agents and the Model Context Protocol (MCP)
- Microsoft 365 with Copilot License
- IT admin approval for Work IQ (organizational accounts only)
- Node.js 18 or higher installed
- Python 3.10 or higher installed
- Azure CLI (authenticated with
az login) - Active M365 data (emails, meetings, Teams chats) to query
Important: Work IQ only works with Microsoft 365 Copilot-enabled accounts. You cannot complete this lab without Copilot.
Scenario
You’ll build a Workplace Intelligence Agent that helps you:
- Meeting Prep: Gather context from emails, previous meetings, and shared documents
- Project Status: Track updates across emails, Teams, and files
- Action Items: Extract tasks from meetings, emails, and Teams mentions
- Combined Intelligence: Use both workplace data (Work IQ) and knowledge base (Foundry IQ)
- Custom Queries: Answer any workplace question using M365 data
Architecture
This lab demonstrates Work IQ integration with AI agents:
┌─────────────────────────────────────────┐
│ Your AI Agent │
│ (Microsoft Foundry Project) │
└────────┬────────────────────────────────┘
│
│ StdioMCPClient
│
┌────────▼────────────────────────────────┐
│ Work IQ MCP Server │
│ (npx @microsoft/workiq mcp) │
└────────┬────────────────────────────────┘
│
│ M365 APIs (Copilot license)
│
┌────────▼────────────────────────────────┐
│ Microsoft 365 Data Sources │
│ • Emails (Outlook) │
│ • Calendar & Meetings │
│ • Teams Messages & Chats │
│ • OneDrive & SharePoint Docs │
│ • People & Org Data │
└─────────────────────────────────────────┘
Setup
Install Work IQ
-
Open your terminal or command prompt.
-
Install Work IQ globally via npm:
npm install -g @microsoft/workiq -
Accept the End User License Agreement:
workiq accept-eula -
Test your Work IQ installation:
workiq ask -q "What meetings do I have today?" -
If the test succeeds - You’ll see meeting information from your M365 calendar. Continue to the next task!
-
If you see “Admin consent required”:
- The command will display a consent URL
- Send this URL to your IT administrator with the message: “I need Work IQ access for the Microsoft Learn AI Agents lab”
- Wait for admin approval, then retry the test command
-
If you see “No M365 Copilot license”:
- Unfortunately, you cannot complete this lab without a Copilot license
- You can still read through the instructions to understand the concepts
- Consider this lab optional and return to it when you have Copilot access
Prepare the lab environment
-
Open Visual Studio Code.
- Navigate to the lab folder:
C:\repos\mslearn-ai-agents\Labfiles\05b-work-iq-integration\PythonUse File > Open Folder in VS Code.
-
Create a Python virtual environment:
python -m venv venv -
Activate the virtual environment:
Windows:
venv\Scripts\activatemacOS/Linux:
source venv/bin/activate -
Install required Python packages:
pip install -r requirements.txt -
Configure your
.envfile:In the lab folder, open the
.envfile and update it with your Foundry project endpoint:PROJECT_ENDPOINT=https://your-project.services.ai.azure.com/api/projects/your-id MODEL_DEPLOYMENT_NAME=gpt-4.1Tip: To get your endpoint: In VS Code, open the Microsoft Foundry extension, right-click on your active project, and select Copy Endpoint.
Verify setup
Ensure you have:
- Work IQ installed and accessible (
workiq --versionworks) - Admin consent approved (or personal M365 account with Copilot)
workiq_lab.py- Main interactive applicationrequirements.txt- Python dependencies installed.envfile configured with your project endpoint
Explore Workplace Intelligence Scenarios
In this exercise, you’ll run a unified interactive application that demonstrates five workplace intelligence scenarios using a single AI agent with Work IQ tools.
Launch the lab application
-
Ensure you’re in the lab directory with your virtual environment activated.
-
Run the lab application:
python workiq_lab.py -
The application will:
- Validate Work IQ setup
- Connect to your Microsoft Foundry project
- Initialize the Work IQ MCP client
- Create a workplace intelligence agent
- Display an interactive menu with 5 scenarios
Meeting Prep scenario
This scenario helps you prepare for meetings by gathering relevant context.
-
From the main menu, select 1 - Meeting Prep.
- When prompted, enter a meeting topic or time, such as:
- “my 2pm meeting”
- “Q4 Planning session”
- “team standup”
- The agent will:
- Find your meeting details (time, attendees, agenda)
- Search recent emails about the topic
- Look for previous meetings on this subject
- Summarize key points and decisions
- Suggest discussion points
- Review the output and note:
- How sources are cited (emails, meetings, dates)
- How the agent synthesizes information from multiple sources
- The time saved compared to manual searching
Reflection: How does this differ from manually searching your email and calendar?
Project Status scenario
This scenario tracks project updates across your workplace tools.
-
From the main menu, select 2 - Project Status.
- Enter a project name you’re working on, such as:
- “Website redesign”
- “Q1 OKRs”
- “Customer onboarding”
- The agent will:
- Search emails and Teams messages about the project
- Find related meetings and their outcomes
- Identify recent decisions and changes
- List blockers or issues mentioned
- Summarize next steps and deadlines
- Analyze the results:
- How comprehensive is the status update?
- What sources did the agent use?
- Could this be built with traditional APIs? What’s the development effort difference?
Action Items scenario
This scenario extracts your open tasks from various sources.
-
From the main menu, select 3 - Action Items.
- Choose a time range (or press Enter for “this week”):
- “today”
- “last 3 days”
- “this month”
- The agent will:
- Search meeting notes for assigned action items
- Look for task-related emails sent to you
- Check Teams messages where you were mentioned
- Identify items with deadlines
- Prioritize by urgency if possible
- Examine the output:
- Are all your action items captured?
- How accurate is the prioritization?
- Where were action items found (meetings, emails, Teams)?
Combined Intelligence scenario
This scenario demonstrates using both Work IQ (workplace data) and Foundry IQ (knowledge base) together.
Note: This scenario requires Azure AI Search configured in your Foundry project with an indexed knowledge base.
-
From the main menu, select 4 - Combined Intelligence.
- Enter a topic that exists in both your workplace discussions and official documentation:
- “remote work policy”
- “expense reporting”
- “security guidelines”
- The agent will:
- Search workplace data (Work IQ): emails, meetings, Teams discussions
- Search knowledge base (Foundry IQ): official docs, policies, procedures
- Compare workplace discussions with official documentation
- Identify gaps or inconsistencies
- Provide a comprehensive summary with labeled sources
- Compare the two perspectives:
- What’s documented officially vs. discussed informally?
- Are there any contradictions?
- Which source is more up-to-date?
Key Insight:
- Work IQ tells you what people are actually doing and saying
- Foundry IQ tells you what’s officially documented
- Together they provide complete context for decision-making
Custom Query scenario
This scenario lets you explore your workplace data with your own questions.
-
From the main menu, select 5 - Custom Query.
-
Try different types of workplace questions:
Email searches:
Find emails about the budget from my managerMeeting summaries:
What was decided in yesterday's standup?Team activity:
What did the engineering team discuss this week?Document discovery:
Show me shared documents about security policies - Experiment with:
- Different time ranges
- Different data sources (emails vs. meetings vs. Teams)
- Different levels of specificity
- Follow-up questions to refine results
- Note what works well:
- Specific queries usually work better than vague ones
- Including time ranges improves relevance
- Names and keywords help narrow results
Explore and Experiment
Now that you’ve completed all scenarios, take 5-10 minutes to explore on your own.
Test edge cases
-
Try queries about data you don’t have - how does the agent respond?
-
Ask ambiguous questions - how does the agent handle them?
-
Search for very old information - what are the limits?
Explore different query styles
-
Very specific: “Find the email from John about Q3 budget sent on January 15th”
-
Very broad: “Tell me about recent developments”
-
Comparative: “Compare this week’s discussions to last week’s”
View Work IQ capabilities
From the main menu, select 6 - View Work IQ Capabilities to review:
- Architecture overview
- Data sources available
- Security and privacy model
- Work IQ vs. Foundry IQ comparison
- Common use cases
Understanding the Code
Let’s examine the key patterns used in this lab.
Pattern 1: Work IQ MCP Client Initialization
from azure.ai.projects.mcp import StdioMCPClient
# Connect to Work IQ MCP server
self.workiq_client = StdioMCPClient(
command="npx",
args=["-y", "@microsoft/workiq", "mcp"]
)
This launches Work IQ as an MCP server subprocess and connects via stdio (standard input/output).
Pattern 2: Creating Agent with Work IQ Tools
# Get Work IQ tools
workiq_tools = [tool.model_dump() for tool in self.workiq_client.tools]
# Create agent using Responses API
self.agent = self.openai_client.agents.create_version(
agent_name="workplace-intelligence-agent",
definition={
"kind": "prompt",
"model": self.model_deployment,
"instructions": "You are a workplace intelligence assistant...",
"tools": workiq_tools # Work IQ tools added here
}
)
The agent is given all available Work IQ tools for querying M365 data.
Pattern 3: Executing Queries with Responses API
# Create conversation
conversation = self.openai_client.conversations.create(
items=[{"type": "message", "role": "user", "content": query}]
)
# Create response with agent
response = self.openai_client.responses.create(
conversation=conversation.id,
extra_body={
"agent": {
"type": "agent_reference",
"name": self.agent.name,
"version": self.agent.version
}
}
)
This uses the Responses API pattern (not the old Runs/Threads pattern) for cleaner agent execution.
Clean Up
The lab automatically cleans up the agent when you exit:
self.openai_client.agents.delete_version(
agent_name=self.agent.name,
version=self.agent.version
)
No Azure resources are created in this lab (Work IQ uses your M365 license), so no additional cleanup is needed.
Troubleshooting
“Work IQ command not found”
Solution: Install Work IQ:
npm install -g @microsoft/workiq
“Admin consent required”
Solution:
- Run
workiq mcpto get the consent URL - Send to your IT admin for approval
- Or use a personal M365 account with Copilot
“No M365 Copilot license”
Solution: This lab requires Copilot. Either:
- Purchase M365 Copilot license ($30/month)
- Use organizational account with Copilot
- Read through the lab to understand concepts without hands-on
“MCP server not responding”
Solution: Test Work IQ directly:
workiq ask -q "What meetings do I have?"
If this fails, reinstall:
npm install -g @microsoft/workiq
“No data returned”
Solution:
- Ensure your M365 account has emails, meetings, Teams activity
- Try broader queries
- Check if your query matches your actual data
Summary
In this lab, you:
- Installed and configured Work IQ MCP server
- Built an AI agent that accesses Microsoft 365 workplace data
- Explored 5 workplace intelligence scenarios (meeting prep, project status, action items, combined intelligence, custom queries)
- Combined Work IQ with Foundry IQ for comprehensive context
- Learned MCP architecture and integration patterns
- Understood security, privacy, and authentication models
Key Takeaways
-
Work IQ enables workplace context - Agents can access the rich signals in M365 data that inform real work
-
MCP provides a standard interface - Work IQ uses the Model Context Protocol, making it easy to integrate with agents
-
Responses API simplifies agent execution - The new pattern is cleaner than the older Runs/Threads approach
-
Combined intelligence is powerful - Work IQ (workplace signals) + Foundry IQ (knowledge base) = complete context
-
Security is built-in - Work IQ respects M365 permissions and requires appropriate authentication
Next Steps
Consider building your own workplace intelligence solutions:
- Specialized meeting assistant
- Automated status reporter
- Task tracking agent
- Communication analyzer
- Decision history tracker