SDK
Files and environment
The office's shared drive, per-file permissions, and environment variables.
Shared files
Every office has one shared drive. Agents read and write it, and per-file permissions control which agent sees what.
await client.files.upload(officeId, 'report.md', Buffer.from(markdown));
const files = await client.files.list(officeId);
const res = await client.files.download(officeId, 'report.md');
const text = await res.text();
await client.files.delete(officeId, 'stale.csv');
| Method | Signature |
|---|---|
upload | upload(officeId, filename, data: Buffer | Uint8Array) |
list | list(officeId) |
download | download(officeId, filename) → Response |
delete | delete(officeId, filename) |
changes | changes(officeId, since?) |
getPermissions | getPermissions(officeId, filename) |
setPermissions | setPermissions(officeId, filename, perms) |
download returns a Response, so pick the body off it yourself with .text(),
.arrayBuffer(), or stream it.
Watching for changes
changes(officeId, since) takes a millisecond timestamp and returns what moved
since then. Poll it rather than re-listing the whole drive:
let cursor = Date.now();
setInterval(async () => {
const { changes, now } = await client.files.changes(officeId, cursor);
cursor = now ?? Date.now();
for (const c of changes) handle(c);
}, 3000);
Permissions
Permissions are per file, per agent. The default is that an agent sees the drive, and you narrow from there:
await client.files.setPermissions(officeId, 'payroll.csv', {
agent: 'scout',
access: 'none',
});
Environment variables
client.env holds per-office configuration injected into agent runtimes.
await client.env.set(officeId, 'REPORT_WEBHOOK', 'https://example.com/hook');
const vars = await client.env.list(officeId);
const values = await client.env.values(officeId);
const forOne = await client.env.getAgentEnv(officeId, 'scout');
await client.env.delete(officeId, 'REPORT_WEBHOOK');
| Method | Signature |
|---|---|
list | list(officeId) → EnvVar[] |
values | values(officeId) → Record<string, string> |
set | set(officeId, key, value) |
delete | delete(officeId, key) |
getAgentEnv | getAgentEnv(officeId, name) |