- Home
- Skills
- Tencentblueking
- Bk Ci
- Go Agent Development
go-agent-development_skill
- Kotlin
2.5k
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill tencentblueking/bk-ci --skill go-agent-development- SKILL.md4.1 KB
Overview
This skill is a concise Go Agent development guide for building CI/CD build agents. It covers architecture, heartbeat and startup flows, task execution patterns, logging, upgrade handling, and interaction with the Dispatch/Backend. Use it to implement robust, maintainable build agents and supporting libraries in Go.
How this skill works
The guide describes a two-process layout: a DevopsDaemon (watchdog) and DevopsAgent (main process), and outlines core packages such as api, config, job, pipeline and util. It explains common operations: agent startup and heartbeat via HTTP clients, task dispatch and execution via the job package, logging patterns, concurrency with goroutines and channels, and retry/error handling strategies. Examples show HTTP client usage, configuration access, and safe goroutine lifecycle and panic recovery.
When to use it
- When implementing a build machine agent responsible for executing CI jobs in Go.
- When integrating agent lifecycle actions (startup, heartbeat, upgrade) with backend APIs.
- When designing task execution logic, parallelism, and resource cleanup for jobs.
- When adding monitoring, logs, or telemetry collection from an agent host.
- When writing Go utility libraries that interact with the agent runtime or config.
Best practices
- Centralize configuration in a single AgentConfig object and expose safe getters.
- Always log with context (Debug/Info/Error) and include errors via WithError.
- Wrap goroutine entry points with defer recover to avoid process crashes.
- Use retry loops with backoff for network calls and persist until success when needed.
- Use channels and defer unsubscribe/cleanup for deterministic resource release.
Example use cases
- Implementing agent startup sequence that posts machine info to backend and retries until success.
- Building a job runner that pulls tasks, executes them concurrently up to ParallelTaskCount, and reports results.
- Adding a lightweight collector that periodically gathers host metrics and posts them via the HTTP client.
- Implementing an in-place agent upgrade flow coordinated by the daemon process.
- Creating utility APIs for standardized HTTP calls that convert responses into DevopsResult objects.
FAQ
Target Go 1.19 or newer to ensure compatibility with the code patterns and modules referenced.
How should I handle transient network failures?
Use retry loops with logging and a sleep/backoff interval. Persist critical steps like startup until they succeed, and surface errors for diagnostics.