// 에이전트에서 브라우저 도구 사용
const result = await tool('browser_navigate', {
url: 'https://example.com'
});
const screenshot = await tool('browser_screenshot', {
selector: 'body',
fullPage: true
});
const click = await tool('browser_click', {
selector: '#submit-button'
});// A2UI 예시: 푸시된 React 컴포넌트
interface A2UIProps {
title: string;
data: unknown;
onEvent: (event: unknown) => void;
}
// 예: 차트 A2UI
const ChartA2UI: React.FC<A2UIProps> = ({ title, data, onEvent }) => {
return (
<div>
<h2>{title}</h2>
<Chart data={data} />
<button onClick={() => onEvent({ type: 'export' })}>
Export
</button>
</div>
);
};// 에이전트에서 Canvas 사용
await tool('canvas_update', {
html: '<h1>Hello, Canvas!</h1>',
width: 800,
height: 600
});
await tool('canvas_a2ui', {
component: 'ChartA2UI',
props: {
title: 'Sales Data',
data: salesData
},
onEvent: { type: 'export' }
});// 노드 연결 요청
{
"type": "req",
"method": "connect",
"params": {
"role": "node",
"deviceId": "device-uuid",
"name": "My iPhone",
"caps": [
"camera.snap",
"screen.record",
"location.get"
],
"permissions": {
"camera": true,
"screen": false,
"location": true
}
}
}// 에이전트에서 노드 명령 사용
const photo = await tool('camera_snap', {
quality: 'high'
});
const location = await tool('location_get', {
accuracy: 'high'
});
const screen = await tool('screen_record', {
duration: 30,
format: 'mp4'
});// 크론 작업 정의
interface CronJob {
id: string;
schedule: string; // cron syntax: "0 9 * * 1-5"
agent: string; // 워크스페이스 이름
message: string; // 에이전트에 보낼 메시지
enabled: boolean;
}{
cron: {
jobs: {
"daily-report": {
schedule: "0 9 * * 1-5",
agent: "main",
message: "오늘의 일정을 정리해줘",
enabled: true
},
"weekly-summary": {
schedule: "0 18 * * 5",
agent: "main",
message: "이번 주 목표를 정리해줘",
enabled: true
}
}
}
}// 웹훅 정의
interface Webhook {
path: string;
secret: string;
method: 'POST' | 'GET';
agent: string;
message?: string;
enabled: boolean;
}{
webhooks: {
"/api/triggers/backup": {
secret: "webhook-secret-key",
method: "POST",
agent: "backup-agent",
message: "백업을 실행해줘",
enabled: true
},
"/api/triggers/deploy": {
secret: "deploy-secret-key",
method: "POST",
agent: "deploy-agent",
enabled: true
}
}
}// Gmail 기반 트리거
interface GmailPubSub {
enabled: boolean;
agent: string;
filters?: {
from?: string[];
subject?: string[];
body?: string[];
};
}// 모든 세션 목록 조회
const sessions = await tool('sessions_list');
// => [
// { id: 'whatsapp:+1234567890', workspace: 'main', ... },
// { id: 'telegram:@bot', workspace: 'main', ... }
// ]
// 특정 세션 기록 조회
const history = await tool('sessions_history', {
session: 'whatsapp:+1234567890'
});
// 다른 세션으로 메시지 전송
await tool('sessions_send', {
to: 'telegram:@other_bot',
message: '이 작업을 처리해줘'
});
// 다른 세션 컨텍스트 업데이트
await tool('sessions_context_update', {
session: 'whatsapp:+1234567890',
context: {
data: sharedData,
lastUpdated: '2026-01-26'
}
});// 파일 읽기
const content = await tool('read', {
path: '~/clawd/config/settings.json'
});
// 파일 쓰기
await tool('write', {
path: '~/clawd/output/result.txt',
content: 'Hello, World!'
});
// 파일 편집
await tool('edit', {
path: '~/clawd/src/app.ts',
edits: [
{
search: 'console.log("Hello")',
replace: 'console.log("Updated!")'
}
]
});// 도구 권한 체크
interface ToolPermission {
tool: string;
allowed: boolean;
reason?: string;
}
// 권한 검사 로직
function checkPermission(tool: string, session: Session): boolean {
if (session.isMain) {
return true; // main 세션은 모든 도구 허용
}
if (sandbox.mode === 'non-main') {
return sandbox.allowlist.includes(tool);
}
return false;
}{
sandbox: {
mode: "non-main",
allowlist: [
"bash",
"process",
"read",
"write",
"edit",
"sessions_list",
"sessions_history"
],
denylist: [
"browser",
"canvas",
"nodes",
"cron",
"discord",
"slack",
"gateway"
]
}
}