Canvas apps run in a WebView, and like any web application, you need proper debugging tools to inspect elements, view console logs, and diagnose issues. This guide covers how to enable and use developer tools for Canvas app development.
Enabling Developer Tools
Canvas apps have Safari Web Inspector support built-in. When properly configured, you can:
- Inspect DOM elements
- View console logs
- Debug JavaScript
- Monitor network requests
- Profile performance
Prerequisites
- macOS 13.3 or later - Required for full WebView inspection support
- Safari Developer Menu enabled - Must be enabled in Safari preferences
Enable Safari Develop Menu
If you haven't already enabled Safari's Develop menu:
- Open Safari
- Go to Safari > Settings (or press
Cmd+,) - Click the Advanced tab
- Check "Show features for web developers" (or "Show Develop menu in menu bar")

Inspecting Canvas Apps
Once developer tools are enabled, you can inspect any Canvas app:
Method 1: Right-Click Context Menu
- Open a Canvas app in the Agentastic launcher
- Right-click anywhere on the Canvas content
- Select "Inspect Element" from the context menu

Method 2: Safari Develop Menu
- Open a Canvas app in the Agentastic launcher
- Open Safari
- Go to Develop menu in the menu bar
- Find your Mac's name in the submenu
- Select the agentastic-launcher WebView

Web Inspector Features
Safari's Web Inspector provides comprehensive debugging tools:
Elements Panel
Inspect and modify the DOM in real-time:
- View HTML structure
- Edit element attributes
- Modify inline styles
- Find elements by selector

Console Panel
View logs and execute JavaScript:
// Your app's console.log() calls appear here
console.log('App initialized');
// Execute code in the context of your app
Agentastic.llm.ask({ user: 'Hello' }).then(console.log);
Common console outputs:
- Bridge connection status
- LLM request/response logs
- Error messages and stack traces
- Custom debug logs from your app

Network Panel
Monitor all network activity:
- API calls to Agentastic services
- Asset loading (images, scripts, styles)
- Request/response headers and bodies
- Timing information

Sources Panel
Debug JavaScript with breakpoints:
- Find your script in the Sources tree
- Click line numbers to set breakpoints
- Use the debugger controls (pause, step, continue)
- Inspect variables in the scope panel

Debugging Common Issues
"Not authenticated" Error
If you see "Error: Not authenticated. Please sign in." in your Canvas app:
- Open the Console panel in Web Inspector
- Look for authentication-related errors
- Verify you're signed into Agentastic
- Check that your app has the required permissions in
manifest.yaml
# Ensure your manifest includes necessary permissions
permissions:
- llm
- net:fetch
Bridge Connection Issues
If Agentastic object is undefined:
- Ensure the bridge script is loaded:
<script src="agentastic://sdk/bridge.js"></script> - Wait for the bridge to be ready:
document.addEventListener('agentastic:ready', () => { // Bridge is now available console.log('Bridge ready:', Agentastic); });
LLM Request Failures
Debug LLM issues by wrapping calls in try-catch:
try {
const response = await Agentastic.llm.ask({
user: 'Hello',
model: 'gpt-4.1-mini'
});
console.log('Response:', response);
} catch (error) {
console.error('LLM Error:', error);
console.error('Error details:', error.message);
}
Console Logging Best Practices
Add structured logging to your Canvas apps:
// Use different log levels
console.log('Info: App loaded');
console.warn('Warning: Using fallback model');
console.error('Error: Failed to fetch data');
// Log objects for inspection
console.log('State:', { user: 'John', theme: 'dark' });
// Group related logs
console.group('LLM Request');
console.log('Prompt:', prompt);
console.log('Model:', model);
console.log('Response:', response);
console.groupEnd();
// Time operations
console.time('llm-request');
const result = await Agentastic.llm.ask({ user: prompt });
console.timeEnd('llm-request'); // Outputs: llm-request: 1234ms
Testing Workflows
Development Cycle
- Make changes to your Canvas app code
- Reload the app - Right-click and select "Reload" in the Canvas
- Check console for errors
- Inspect elements to verify UI changes
- Test functionality and monitor network
Testing Checklist
- App loads without console errors
- All UI elements render correctly
- LLM requests complete successfully
- Error states are handled gracefully
- Permissions are properly declared
- Works in both light and dark themes
Performance Profiling
Use the Timelines panel to profile your app:
- Open Web Inspector
- Go to the Timelines tab
- Click the record button
- Interact with your app
- Stop recording and analyze:
- JavaScript execution time
- Layout/paint operations
- Memory usage

Troubleshooting Web Inspector
"Inspect Element" Not Appearing
If right-click only shows "Reload":
- Verify you're running macOS 13.3+
- Check that Safari's Develop menu is enabled
- Ensure the app was built with debugging enabled
- Try restarting the Agentastic launcher
WebView Not Appearing in Safari Develop Menu
- Close and reopen Safari
- Restart the Agentastic launcher
- Open a Canvas app
- Check Develop menu again
Inspection Works But Console Is Empty
- Add explicit console.log statements to your code
- Check that your script is actually being loaded
- Look for JavaScript errors that might be blocking execution
- Verify the bridge script is loaded before your app code
Tips for Effective Debugging
- Start with the Console - Most issues show up as errors or warnings
- Use breakpoints - Pause execution at key points
- Check Network tab - Verify API calls are being made
- Inspect the DOM - Ensure elements are rendering as expected
- Profile performance - Find bottlenecks in complex apps
- Test authentication - Many issues stem from auth problems
Next Steps
- SDK API Reference - Detailed API documentation
- Canvas App Examples - Learn from sample code
- Troubleshooting Guide - Common issues and solutions