API Reference

Developer API

Complete reference for all IPC handlers, data models, and integration points. Use these APIs to extend Comet AI Browser with custom functionality.

50+

IPC Handlers

8

Categories

4

Data Models

5

Code Examples

Inter-Process Communication

IPC Handlers

All handlers are called via window.electron.invoke(channel, ...args).

Browser Control

7 handlers

get-open-tabs
Tab[]

Returns all open tabs with their URLs and titles

navigate-to(url: string)
void

Navigate the active tab to the specified URL

capture-browser-view-screenshot
Buffer

Capture screenshot of the current browser view

capture-page-html
string

Get the raw HTML of the current page

extract-page-content
string

Extract readable text content from the page

find-and-click-text(text: string)
boolean

Find text on page and click it

get-selected-text
string

Get currently selected text in the browser

Type Definitions

Data Models

Task

Represents a scheduled automation task

FieldTypeDescription
idstringUnique identifier
namestringHuman-readable task name
typeTaskTypepdf | scrape | prompt | workflow
triggerTriggerScheduling configuration
configTaskConfigTask-specific configuration
enabledbooleanWhether the task is active
priorityPriorityhigh | normal | low
modelstringAI model to use
outputDirstringOutput directory path
notifyOnCompletebooleanSend notification on completion
lastRunDate?Last execution time
nextRunDate?Next scheduled execution
runCountnumberTotal execution count
lastStatusstring?success | failed | running
lastErrorstring?Last error message

Trigger

Defines when a task should execute

FieldTypeDescription
typeTriggerTypecron | once | interval
schedulestring?Cron expression (for type=cron)
datetimestring?ISO datetime (for type=once)
intervalMsnumber?Interval in milliseconds (for type=interval)
timezonestring?Timezone (default: UTC)

TaskConfig

Configuration for different task types

FieldTypeDescription
promptstring?AI prompt to execute
pdfOptionsPDFOptions?PDF generation options
scrapeUrlsstring[]?URLs to scrape
workflowStepsWorkflowStep[]?Multi-step workflow definition
emailRecipientsstring[]?Email addresses to notify

ShellResult

Result of a shell command execution

FieldTypeDescription
successbooleanWhether the command succeeded
stdoutstringStandard output
stderrstringStandard error
exitCodenumberProcess exit code
durationnumberExecution time in ms

Usage Examples

Code Snippets

Best Practices

Error Handling

Best Practices

  • Always check the return value for success/error properties
  • Wrap IPC calls in try-catch for network failures
  • Use the status code to determine error type
  • Implement retry logic for transient failures
  • Log errors for debugging but don't expose to users

Security Notes

  • Shell commands require risk level and reason
  • High-risk actions need mobile approval via QR
  • Never expose raw command strings to users
  • Validate all inputs before passing to IPC
  • Rate limit sensitive operations

Start Building

Use these APIs to extend Comet AI Browser with custom automations, integrations, and features.

Edit on GitHub