Skip to content

Deploying the Agent

The @swenyai/agent package is an agentic harness that orchestrates coding sessions. The model backend and messaging channel are pluggable — deploy it as a Slack bot (more channels planned) or run it locally as an interactive CLI.

The first supported channel is Slack. More channels are planned.

  • A Slack app with Socket Mode enabled
  • Bot token scopes: chat:write, app_mentions:read, im:history, im:read, im:write
  • An app-level token with connections:write scope

Create a sweny.config.ts in your project root:

import { defineConfig } from "@swenyai/agent";
import { noAuth } from "@swenyai/providers/auth";
import { fsStorage } from "@swenyai/providers/storage";
import { memoryPlugin, workspacePlugin } from "@swenyai/agent";
export default defineConfig({
name: "sweny",
auth: noAuth(),
storage: fsStorage({ baseDir: "./.sweny-data" }),
plugins: [memoryPlugin(), workspacePlugin()],
model: {
maxTurns: 25,
},
});

See Agent Configuration for the full config reference.

Terminal window
SLACK_BOT_TOKEN=xoxb-...
SLACK_APP_TOKEN=xapp-...
CLAUDE_CODE_OAUTH_TOKEN=... # or ANTHROPIC_API_KEY
Terminal window
npm run dev

Run the agent as a local REPL without Slack:

Terminal window
npm run cli

The CLI uses the same config, plugins, and model runner as the bot.

The agent supports custom tool plugins. Each plugin can expose tools to the model and inject sections into the system prompt:

import { z } from "zod";
import { agentTool } from "@swenyai/providers/agent-tool";
import type { ToolPlugin } from "@swenyai/agent";
export function httpPlugin(): ToolPlugin {
return {
name: "http",
description: "Make HTTP requests",
createTools() {
return [
agentTool(
"http_get",
"Fetch a URL and return its body",
{ url: z.string().url() },
async (args) => ({
content: [{ type: "text", text: await (await fetch(args.url as string)).text() }],
}),
),
];
},
};
}

Add it to your config:

export default defineConfig({
// ...
plugins: [memoryPlugin(), workspacePlugin(), httpPlugin()],
});

See Plugin System for the full API reference and Built-in Plugins for the tools included out of the box.

The agent persists sessions, memory, and workspace files. Choose a backend:

// Local filesystem (development)
import { fsStorage } from "@swenyai/providers/storage";
const storage = fsStorage({ baseDir: "./.sweny-data" });
// Amazon S3 (production)
import { s3Storage } from "@swenyai/providers/storage";
const storage = s3Storage({ bucket: "my-sweny-bucket", prefix: "agent" });