Overview
The Garnet API Go SDK is the official client library for interacting with the Garnet platform. It provides a comprehensive set of tools for managing runtime security agents, monitoring events, and implementing network policies across your infrastructure.Quickstart
Get up and running with the SDK in minutes
API Reference
Explore all available methods and types
Core Concepts
Learn about agents, events, and policies
GitHub
View source code and contribute
Key Features
Agent Management
Agent Management
Create, update, and monitor security agents across your infrastructure. Support for multiple agent types including GitHub Actions, Kubernetes, and vanilla deployments.
- Register agents with custom metadata and labels
- Track agent health with heartbeat monitoring
- Filter and query agents by environment, version, or custom attributes
- Manage agent lifecycle across different platforms
Event Ingestion & Monitoring
Event Ingestion & Monitoring
Ingest and query security events from your agents in real-time.
- Stream events using the ashkaal format
- Filter events by agent, time range, or metadata
- Block malicious events with network policies
- Paginated event queries with flexible sorting
Network Policy Management
Network Policy Management
Implement granular network policies to control and block suspicious traffic.
- Define policies at project, cluster, or agent scope
- Create rules based on event patterns
- Automatic policy enforcement across agents
Multi-tenant Support
Multi-tenant Support
Built-in support for organizations and projects with role-based access control.
- Project-level resource isolation
- Multiple authentication methods (user, agent, project tokens)
- Organization-wide settings and policies
Architecture
The SDK is built around a centralClient type that handles all HTTP communication with the Garnet API. It supports:
- Multiple Authentication Types: User tokens, agent tokens, and project tokens
- Flexible Base URL: Connect to different Garnet environments or self-hosted instances
- Cursor & Offset Pagination: Efficient data retrieval for large datasets
- Type-safe API: Comprehensive type definitions for all request and response models
The SDK uses
github.com/garnet-org/jibril-ashkaal for event formatting and requires Go 1.25.0 or later.Authentication Methods
Garnet supports three token types for different use cases:| Token Type | Use Case | Header |
|---|---|---|
| User Token | API access for authenticated users | Authorization: Bearer <token> |
| Agent Token | Agent-to-API communication | X-Agent-Token: <token> |
| Project Token | Project-scoped automation | X-Project-Token: <token> |
Agent Types
Garnet supports multiple agent deployment models:Pagination Strategies
The SDK supports two pagination methods:Cursor-based Pagination
Recommended for real-time data and large datasets. Used byAgents() and similar methods.
Offset-based Pagination
Traditional page-based pagination. Used by legacy endpoints.Error Handling
The SDK uses typed errors from thetypes/errs package:
Support
Documentation
Comprehensive guides and tutorials
GitHub Issues
Report bugs or request features
Next Steps
Follow the Quickstart
Learn how to initialize the client and make your first API call
View Quickstart →
Explore Core Concepts
Learn about agents, events, issues, and network policies
View Core Concepts →
