Skip to content

DenisVCode/agy-slack-agent

Repository files navigation

Antigravity Trello Slack Agent

A Slack Agent integrated with Google's Antigravity Managed Agent and a secure, remote sandboxed Linux environment. This agent allows Slack users to query their Trello boards dynamically using natural language. It writes and executes scripts on-the-fly to read card status, recent edits, and comments history safely and securely.

This agent is a proof of concept for the Google Antigravity Managed Agent API. Article describing the decisions and architecture: Build your own Google Antigravity agent in Slack


Features

  • Google Antigravity Integration: Leverages Google GenAI's Interactions API to manage a persistent, remote Linux sandbox for code execution (Python, Node.js, bash) and data analysis.
  • Stateful Slack Conversations: Seamlessly maps Slack thread timestamps (thread_ts) to Antigravity environment IDs (environment_id), maintaining context and file states across multiple consecutive user messages.
  • Strictly Read-Only Trello Access: Dynamically executes secure retrieval code in the sandbox to fetch Trello board actions, cards, lists, and search queries. Modifying operations are strictly restricted.
  • Egress Proxy Credentials Injection: Employs Google GenAI's Egress Proxy Header Transformations (environment.network.allowlist.transform) to dynamically and securely inject Trello credentials (oauth_consumer_key, oauth_token) at the proxy level. No Trello API keys or tokens are ever embedded in scripts, prompts, or environment variables inside the sandbox.
  • Slack Agent View Experience: Custom UI using Slack's agent_view feature complete with:
    • Dynamic suggested prompts pinned in the Messages tab (e.g., Recent Edits, Card Status, Comments History).
    • Native Slack Assistant typing indicators (assistant.threads.setStatus).
  • Smart Response Optimization: To prevent Slack's standard 4,000-character limitation (msg_too_long errors), responses under ~3,500 characters are posted directly, while larger documents are dynamically bundled and uploaded directly to the thread as an elegant Markdown (.md) file using Slack's files.uploadV2 API.
  • Built with Strict Best Practices: Powered by ESM, Node 24, pnpm 11, strict TypeScript, Vitest, Hono.js for server endpoints, and Docker.

Technical Architecture

[ Slack Workspace ]
       │
       │ (Socket Mode Event: message.im)
       ▼
 [ Hono.js Server ]
       │
       │ 1. Set assistant thread status ("is provisioning...")
       │ 2. Create/Retrieve persistent Google Agent ("trello-slack-agent")
       │ 3. Execute Task on Google GenAI Interactions API
       ▼
[ Google Antigravity Remote Sandbox ]
       │
       │ (Executes sandbox script to fetch Trello board data)
       │ (Sends request to api.trello.com)
       ▼
[ Google Egress Proxy ] ──(Injects OAuth Header)──► [ Trello REST API ]
       │
       ▼ (Returns parsed data)
[ Hono.js Server ]
       │
       ├─► Response <= 3,500 chars ──► Updates original message text
       └─► Response >  3,500 chars ──► Uploads response as `.md` file in thread

Getting Started

Prerequisites

  • Node.js: v24.0.0 or higher
  • pnpm: v11.5.3 or higher

Environment Variables

Copy the .env.example file to .env and fill in the required keys:

cp .env.example .env
PORT=3000
NODE_ENV=development

# Google Gemini / Antigravity Managed Agent API Configuration
GEMINI_API_KEY=your-gemini-api-key-here

# Slack App Credentials (from Slack Developer Console)
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_APP_TOKEN=xapp-your-app-token

# Read-only Trello Board Configuration
TRELLO_API_KEY=your-trello-api-key
TRELLO_TOKEN=your-trello-token
TRELLO_BOARD_IDS=your-comma-separated-trello-board-ids

Installation

Install all workspace dependencies:

pnpm install

Available Scripts

Development

Run the Hono server and Slack Socket Mode listener in development watch mode:

pnpm run dev

Production Build

Compile the TypeScript source code to production-ready JavaScript (ESM):

pnpm run build

Run the production build:

pnpm run start

Tests

Execute the Vitest test suite:

pnpm run test:run

Linting & Formatting

Format the codebase with Prettier and lint with ESLint:

pnpm run format
pnpm run lint

Configuration

Slack Application Manifest

To configure your Slack App with the exact permissions, scopes (chat:write, files:write, assistant:write), Socket Mode settings, and suggested prompts, copy the contents of slack-manifest.json into your app configuration in the Slack Developer Console.

Sandboxed Shell Reset

To reset your remote Linux sandbox environment at any point and clear the conversation context, run the /reset slash command in your Slack workspace, or send the message reset directly to the agent.


Docker Deployment

Deploy the agent within a secure, multi-stage production container.

Build the Image

docker build -t antigravity-slack-agent .

Run the Container

docker run -d --name slack-agent --env-file .env -p 3000:3000 antigravity-slack-agent

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors