Skip to content

Agent Service Architecture

The agent services are Go applications built on Google ADK (Agent Development Kit). Three agents — Buck, Dolly, and Pearl — share a common platform layer and each implement agent-specific modules with custom tools and prompts. Events arrive via NATS JetStream, are processed by Claude (via AWS Bedrock), and responses are routed back to the originating platform.

graph TD
    subgraph Platform["Platform Layer (shared)"]
        Webhook["Webhook handlers"]
        Bedrock["Bedrock LLM"]
        K8s["K8s orchestrator"]
        NATS["NATS client"]
        JiraClient["Jira client"]
        SlackClient["Slack client"]
        Storage["Storage (S3/CloudFront)"]
        SessionIdx["Session Index"]
        GitHubClient["GitHub client"]
        Celestials["Celestials"]
        ConfluenceClient["Confluence client"]
        GDriveClient["Google Drive client"]
        FigmaClient["Figma client"]
    end

    subgraph BuckMod["Buck Modules"]
        BuckConfig["Config"]
        BuckAgent["Agent (ADK + tools)"]
        BuckDash["Dashboard (Connect RPC, GORM, runner API, terminal tunnel)"]
        BuckMetrics["Metrics"]
        BuckProm["Prometheus"]
    end

    subgraph DollyMod["Dolly Modules"]
        DollyConfig["Config"]
        DollyAgent["Agent (ADK + tools)"]
        DollyDash["Dashboard (sessions, team settings, user memory, decompositions)"]
    end

    subgraph PearlMod["Pearl Modules"]
        PearlConfig["Config"]
        PearlAgent["Agent (ADK + tools)"]
        PearlDash["Dashboard (sessions, snippets, components, design languages)"]
        PearlFigma["Figma client"]
    end

    Platform --> BuckMod
    Platform --> DollyMod
    Platform --> PearlMod
ModulePathPurpose
Webhookinternal/platform/webhook/HTTP server, event handlers, NATS publishing
Bedrockinternal/platform/bedrock/Custom model.LLM for AWS Bedrock Converse API
K8sinternal/platform/k8s/EKS pod orchestrator, pod-bound JWT auth, exec streaming
NATSinternal/platform/nats/JetStream client, stream/consumer management, publish/subscribe
Jirainternal/platform/jira/Jira REST API v3 client
Slackinternal/platform/slack/Slack Web API client with image downloading, Block Kit support
Storageinternal/platform/storage/Image store (S3 + CloudFront)
Session Indexinternal/platform/sessionindex/Platform identifier to session UUID mapping
GitHubinternal/platform/github/GitHub API client via App installation tokens
Celestialsinternal/platform/celestials/Team/Pack lookup via celestials service
Confluenceinternal/platform/confluence/Confluence REST API client
Google Driveinternal/platform/gdrive/Google Drive client via service account
Figmainternal/platform/figma/Figma REST API client via personal access token
ModulePathPurpose
Configinternal/buck/config/Environment variable loading with validation and defaults
Agentinternal/buck/agent/ADK agent factory, custom tools, prompt management
Dashboardinternal/buck/dashboard/Connect RPC API, GORM models, runner API, terminal tunnel
Metricsinternal/buck/metrics/OTel custom metrics (bucky.* prefix)
Prometheusinternal/buck/prometheus/Prometheus HTTP API client, PromQL query catalog
ModulePathPurpose
Configinternal/dolly/config/Environment variable loading with validation and defaults
Agentinternal/dolly/agent/ADK agent factory, custom tools (Jira, Confluence, Drive, decomposition)
Dashboardinternal/dolly/dashboard/Sessions, team settings, user memory, decompositions
ModulePathPurpose
Configinternal/pearl/config/Environment variable loading with validation and defaults
Agentinternal/pearl/agent/ADK agent factory, custom tools (design, Figma, snippets, components)
Dashboardinternal/pearl/dashboard/Sessions, snippets, components, design languages
Figma clientinternal/pearl/figma/Figma file/node/component/style/variable access

The agents use AWS Bedrock’s Converse API to call Claude. The custom model.LLM implementation in internal/platform/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 between ADK and Bedrock formats
  • Supports multimodal input (images from Slack threads to Bedrock ImageBlock)
  • Uses the ECS task role for AWS credentials

Each agent can specify a different default model:

AgentDefault ModelConfig Variable
BuckClaude Sonnet (configurable)BEDROCK_MODEL_ID
DollyClaude OpusDOLLY_BEDROCK_MODEL_ID
PearlClaude OpusPEARL_BEDROCK_MODEL_ID

Webhook handlers return 200 OK immediately. Events are published to NATS JetStream and processed by per-agent consumers:

  • Each agent runs its own NATS consumer with a webhooks.{agent}.* subject filter
  • 256-slot sharded mutex (FNV32a hash) ensures per-session ordering — events for the same session execute sequentially
  • Deduplication for Slack events (by event ID) and GitHub webhooks (by comment ID)
  • Backoff retry schedule: 0s, 5s, 30s, 2m, 10m — terminates after 5 attempts

When POSTHOG_PROJECT_API_KEY is set (applies to all agents):

  • 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