The Canvas App SDK enables you to build interactive applications that run inside the Agentastic launcher. Canvas apps have access to AI capabilities, the file system, network, and more through a secure bridge API.
What are Canvas Apps?
Canvas Apps are lightweight, sandboxed applications that render in a WebView within the Agentastic launcher. They can:
- Make LLM calls - Request AI completions with custom prompts
- Display rich UI - Use HTML, CSS, and JavaScript for interactive interfaces
- Access tools - Leverage Agentastic's built-in tools like file operations, calendar, etc.
- Communicate - Send and receive messages via the bridge API
App Types
Declarative Apps (ViewSpec)
Define your UI using a simple YAML structure. Perfect for forms, wizards, and simple tools.
id: hello-world
name: Hello World
view_spec:
type: container
children:
- type: heading
content: "Hello, Canvas!"
- type: input
name: user_name
label: "Your Name"
- type: button
label: "Greet Me"
action: greet
Packaged Apps (HTML)
Build with full HTML, CSS, and JavaScript for complex applications.
my-app/
├── manifest.yaml
├── index.html
├── styles.css
└── app.js
Quick Example
Here's a minimal Canvas app that greets the user with an AI-generated message:
manifest.yaml:
id: greeter
name: AI Greeter
version: 1.0.0
entrypoint: index.html
permissions:
- llm
index.html:
<!DOCTYPE html>
<html>
<head>
<title>AI Greeter</title>
<script src="agentastic://sdk/bridge.js"></script>
</head>
<body>
<input type="text" id="name" placeholder="Enter your name">
<button onclick="greet()">Greet Me</button>
<div id="response"></div>
<script>
async function greet() {
const name = document.getElementById('name').value;
const result = await Agentastic.llm.ask({
user: `Generate a friendly, creative greeting for ${name}`,
model: 'gpt-4.1-mini'
});
document.getElementById('response').textContent = result;
}
</script>
</body>
</html>
SDK Namespaces
The Canvas App SDK provides several namespaces:
| Namespace | Purpose |
|---|---|
Agentastic.llm | AI completions and streaming |
Agentastic.ui | Toasts, modals, theme, and window control |
Agentastic.agent | Context, tool registration, and conversation injection |
Agentastic.ipc | Inter-app communication |
Agentastic.fs | Sandboxed file system operations |
Agentastic.net | Network requests |
Agentastic.context | Runtime environment information |
New in v0.2.0
Agent Namespace Enhancements:
agent.sendMessage()- Inject messages into the conversation as user or assistantagent.setInput()- Populate the input field without sendingagent.unregisterTool()- Remove previously registered toolsagent.onThinking()- Subscribe to thinking state changes
UI Namespace Enhancements:
ui.openExternal()- Open URLs in the default browserui.setHeight()/ui.setSize()- Control app dimensionsui.requestExpand()/ui.requestCollapse()- Toggle fullscreen modeui.onDisplayModeChange()- React to display mode changes
Context API:
- Access runtime environment via
Agentastic.context- locale, platform, color scheme, display mode, and more
Response Visibility Scoping:
- Control what data is visible to AI models vs. your app only
- Configure via
responseScopingin manifest actions
Filesystem Security
Canvas apps have sandboxed filesystem access:
- App directory - Always accessible at
~/Library/Application Support/agentastic/apps/<app-slug>/ - External paths - Require explicit permissions in
manifest.yaml - System paths - Always blocked (
/System,/private, etc.)
# Example: Request access to user's Documents folder
permissions:
filesystem:
read:
- ~/Documents/MyApp
write:
- ~/Documents/MyApp
See the Filesystem API documentation for details.
Getting Started
- Create a manifest - Define your app's metadata and permissions
- Build your UI - Use ViewSpec YAML or custom HTML/JS
- Connect the bridge - Import the SDK to access Agentastic features
- Test locally - Use the developer tools to debug
- Package and deploy - Distribute your app
Next Steps
- Filesystem API - Sandboxed file access and permissions
- Testing & Debugging - Learn how to debug Canvas apps
- API Reference - Complete SDK documentation
- Examples - Sample Canvas apps