Skip to content

Agent Service Overview

The agent service is a Go application built on Google ADK (Agent Development Kit) that acts as Bucky’s brain and interactive front-door. It receives events from Slack, Jira, and GitHub, uses a Claude-powered LLM agent to reason about them, and dispatches work through the GitHub issue → Claude session pipeline.

┌──────────────────────────────────────────────┐
│ HTTP Server (net/http) │
│ /webhooks/slack/events │
│ /webhooks/slack/interactivity │
│ /webhooks/jira │
│ /webhooks/jira/comments │
│ /webhooks/github │
│ /webhooks/workflow-callback │
│ /api/upload │
│ /healthz │
└──────────────┬───────────────────────────────┘
│ async goroutine pool (10 workers)
┌──────────────────────────────────────────────┐
│ ADK Agent Runner │
│ - Bedrock Claude model │
│ - MCP toolsets (Sourcegraph, Grafana) │
│ - Custom function tools │
│ - Session service (PostgreSQL / in-memory) │
└──────────────────────────────────────────────┘
ModulePathPurpose
Configinternal/config/Environment variable loading with validation and defaults
Webhookinternal/webhook/HTTP server and event handlers
Bedrockinternal/model/bedrock/Custom model.LLM for AWS Bedrock Converse API
Agentinternal/agent/ADK agent factory, custom tools, prompt management
Jirainternal/jira/Jira REST API v3 client
Slackinternal/slack/Slack API client with image downloading
Storageinternal/storage/Image store (S3 + CloudFront)
Session Indexinternal/sessionindex/Platform → session UUID mapping
GitHubinternal/github/GitHub API client via GitHub App

The agent uses AWS Bedrock’s Converse API to call Claude. The custom model.LLM implementation in internal/model/bedrock/:

  • Translates between ADK’s genai types and Bedrock’s message/content block types
  • Handles message role mapping and consecutive same-role merging
  • Converts tool use/result blocks
  • Supports multimodal input (images from Slack threads → Bedrock ImageBlock)
  • Uses the ECS task role for AWS credentials

Webhook handlers return 200 OK immediately. Work is processed via a goroutine worker pool:

  • Buffered channel with 10 concurrent workers
  • Panic recovery per worker
  • Deduplication for Slack events (by event ID) and GitHub webhooks (by comment ID)

When POSTHOG_PROJECT_API_KEY is set:

  • LLM analytics: $ai_generation events captured via ADK callbacks with token counts, latency, and input/output for every LLM call
  • Error tracking: $exception events captured automatically via slog.Error() calls with stack traces
  • Tracing: Each runner.Run() invocation maps to a PostHog trace; each LLM call within is a generation span