Agent Development
The agent service is a Go application in agent/. It requires Go 1.25+.
Commands
Section titled “Commands”cd agentmake build # build binary to bin/ad-tools-agentmake test # run all testsmake lint # golangci-lint runmake run # build + run locallyLocal development setup
Section titled “Local development setup”- Copy the env template and fill in values:
cd agentcp .env.example .env- (Optional) Start PostgreSQL for persistent sessions:
docker compose up -d- Run the agent:
make runWithout DATABASE_HOST, the agent uses in-memory sessions (lost on restart).
Key patterns
Section titled “Key patterns”- Error handling: Fail fast on startup errors (
os.Exit(1)); async processing errors logged and surfaced to Slack when possible - Async webhooks: Handlers return 200 immediately; work processed via goroutine worker pool (buffered channel, 10 workers) with panic recovery
- Interfaces: API clients (
SlackClient,GitHubClient,JiraClient) defined as interfaces for testability - Prompts: Large LLM prompts live in
internal/agent/prompts/*.md, embedded at compile time via//go:embed - ADK integration: Bedrock Claude model + MCP toolsets + custom function tools registered via
functiontool.New - Logging: Structured JSON logging via
log/slog
Adding a new tool
Section titled “Adding a new tool”- Create the tool function in
internal/agent/(e.g.,my_tool.go) - Define typed args and result structs
- Register with
functiontool.New("tool_name", "description", handler) - Add the tool to the agent’s tool list in
internal/agent/agent.go - Update the system prompt in
internal/agent/prompts/system.mdif the agent needs guidance on when to use it
Testing
Section titled “Testing”Tests use interface mocks for external dependencies:
type mockSlackClient struct { // implement SlackClient interface}Run all tests:
cd agent && make testDeployment
Section titled “Deployment”The agent is deployed to ECS via FSD. The deployment config is at agent/ad-tools-agent.yml.
When adding or changing environment variables:
- Update
internal/config/config.go - Update
agent/.env.example - Update
agent/ad-tools-agent.yml(add toenvironment_variablesorsecrets) - Update the Agent Configuration docs page