Email Setup Wizard

Chat with Your Email

Let's set up the Web Agent API with Gmail tools so you can chat with your inbox.

1
Detect Web Agent API
Check if a Web Agent API implementation is available
// Check for Web Agent API availability
if (window.ai && window.agent) {
  console.log('Web Agent API is ready!');
}
2
Request Permissions
Get access to the AI model and MCP tools
const result = await window.agent.requestPermissions({
  scopes: [
    'model:prompt',
    'model:tools',
    'mcp:tools.list',
    'mcp:tools.call'
  ],
  reason: 'Chat with your email inbox'
});
3
Check LLM Availability
Verify that an AI model is configured and responding
// Create a test session to verify LLM works
const session = await window.ai.createTextSession();
await session.destroy();
console.log('LLM is ready!');
4
Find Email Tools
Check for Gmail or email-related MCP tools
const tools = await window.agent.tools.list();
const emailTools = tools.filter(t => 
  t.name.includes('gmail') || 
  t.name.includes('email') ||
  t.name.includes('mail')
);
console.log(`Found ${emailTools.length} email tools`);
5
Ready to Chat!
Everything is set up — scroll down to start chatting with your email
// Launch the email chat interface
for await (const event of window.agent.run({
  task: 'Summarize my recent unread emails',
  maxToolCalls: 10
})) {
  console.log(event);
}
Email Chat Ready
Web Agent API
LLM Ready
Email Tools: —
šŸ“§

Ready to Chat

Ask questions about your inbox, search for emails, draft replies, or get summaries.

šŸ”§ Debug: Tool Events ā–¼