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.
Architecture
Section titled “Architecture”┌──────────────────────────────────────────────┐│ 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) │└──────────────────────────────────────────────┘Key modules
Section titled “Key modules”| Module | Path | Purpose |
|---|---|---|
| Config | internal/config/ | Environment variable loading with validation and defaults |
| Webhook | internal/webhook/ | HTTP server and event handlers |
| Bedrock | internal/model/bedrock/ | Custom model.LLM for AWS Bedrock Converse API |
| Agent | internal/agent/ | ADK agent factory, custom tools, prompt management |
| Jira | internal/jira/ | Jira REST API v3 client |
| Slack | internal/slack/ | Slack API client with image downloading |
| Storage | internal/storage/ | Image store (S3 + CloudFront) |
| Session Index | internal/sessionindex/ | Platform → session UUID mapping |
| GitHub | internal/github/ | GitHub API client via GitHub App |
LLM integration
Section titled “LLM integration”The agent uses AWS Bedrock’s Converse API to call Claude. The custom model.LLM implementation in internal/model/bedrock/:
- Translates between ADK’s
genaitypes 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
Async processing
Section titled “Async processing”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)
Observability
Section titled “Observability”When POSTHOG_PROJECT_API_KEY is set:
- LLM analytics:
$ai_generationevents captured via ADK callbacks with token counts, latency, and input/output for every LLM call - Error tracking:
$exceptionevents captured automatically viaslog.Error()calls with stack traces - Tracing: Each
runner.Run()invocation maps to a PostHog trace; each LLM call within is a generation span