Skip to main content

Agent

Testing Phase

The Agent feature is currently still in a testing phase; the following APIs and behavior may change before the official release.

Overview

ScriptCat v1.4 introduces the Agent system, giving user scripts a set of capabilities including AI conversation, browser automation, file management, and scheduled tasks.

Scripts call these capabilities through the CAT.agent.* namespace, and every API requires the corresponding permission to be declared with @grant.

Feature Modules

ModulePermissionDescription
Conversation@grant CAT.agent.conversationCreate AI conversations, send messages, stream responses, define custom tools
DOM Operations@grant CAT.agent.domPage navigation, screenshots, clicking, filling, scrolling, DOM monitoring
Skill@grant CAT.agent.skillsInstall/uninstall/invoke Skill packages
Scheduled Tasks@grant CAT.agent.taskCron scheduled tasks, event listening
Model@grant CAT.agent.modelQuery configured model information (read-only)
OPFS Files@grant CAT.agent.opfsRead/write Agent workspace files
MCP@grant CAT.agent.mcpManage MCP server connections
Skill DevelopmentSKILL.cat.md + SkillScript development guide

Quick Start

The simplest possible Agent script:

// ==UserScript==
// @name Hello Agent
// @match *://*/*
// @grant CAT.agent.conversation
// ==/UserScript==

const conv = await CAT.agent.conversation.create();
const reply = await conv.chat("Hi, please introduce yourself");
console.log(reply.content);

Architecture Overview

The Agent system spans multiple isolated contexts within the browser extension:

User script → Sandbox (isolated execution)
↓ WindowMessage
Offscreen (DOM access)
↓ ExtensionMessage
Service Worker (core scheduling)
├── LLM Provider (OpenAI / Anthropic)
├── ToolRegistry (tool registration and execution)
├── SkillScriptExecutor (Skill script execution)
├── MCPClient (MCP protocol client)
└── TaskScheduler (scheduled task scheduling)

Storage Structure

The Agent stores data using the browser's OPFS (Origin Private File System):

agents/
├── conversations/ # conversation history
├── attachments/ # attachments (images, files)
├── skills/{name}/ # Skill package files
│ ├── SKILL.cat.md
│ ├── scripts/
│ └── references/
├── tasks/ # scheduled task config and execution records
└── workspace/ # user workspace files (the directory opfs_* tools operate on)

Supported Models

ProviderFormatFeatures
OpenAI-compatibleOpenAI Chat Completions APISupports GPT-4o, DeepSeek, and other compatible models
AnthropicAnthropic Messages APISupports the Claude family, Prompt Caching
ZhipuZhipu APISupports the GLM model family

Add a Provider and API Key under "Model Configuration" in the dashboard to use it.

The Skill Ecosystem

A Skill is a package combining prompts + tool scripts + reference material, letting you inject domain-specific knowledge and custom tools into the Agent.

Official Skill repository: scriptscat/skills

Includes ready-to-use Skills for browser automation, scheduled tasks, a Skill-creation tool, conversation/DOM/config examples, and more.

Installation methods:

  • URL install — open the SKILL.cat.md URL directly in the browser; ScriptCat automatically intercepts it and shows the install page. You can also paste the URL under the dashboard's Agent → Skill Management.
  • Script install — install programmatically via the CAT.agent.skills.install() API

Checking for updates:

A Skill installed via URL records its install source; the dashboard lets you check for updates and upgrade with one click (based on semver comparison of the version field).

See Skill Management API and Skill Development Guide for details.