The core package includes a CLI tool to generate a complete probe scaffold with all necessary boilerplate code and structure.
cd code/agents/core
make buildThis will create the core binary in the build/ directory.
Generate a new probe scaffold:
./build/core scaffold -name <probe-name>Example:
./build/core scaffold -name aws-probeThis will create a new directory ../aws-probe/ (relative to the core directory) with the complete probe structure.
The scaffold generates the following structure:
<probe-name>/
├── cmd/
│ └── main.go # Application entry point
├── internal/
│ ├── probe/
│ │ ├── probe.go # Probe wrapper around core
│ │ └── entities/
│ │ └── example_entity.go # Example entity implementation
│ ├── config/
│ │ └── config.go # Configuration loading and validation
│ ├── manager/
│ │ └── manager.go # State manager wrapper
│ ├── models/
│ │ └── models.go # Data models
│ └── <service-name>/
│ └── client.go # Service API client
├── config/
│ ├── probe.yml # Main configuration file
│ └── probe.example.yml # Example configuration
├── go.mod # Go module definition
├── Makefile # Build automation
├── README.md # Probe documentation
├── .gitignore # Git ignore rules
├── .tool-versions # Go version (1.23)
└── env.secrets # Environment variables (gitignored)
-
Navigate to the generated probe directory:
cd ../<probe-name>
-
Configure credentials:
- Edit
env.secretswith your service API credentials - This file is automatically gitignored and contains sensitive data
- Source it with:
source env.secretsbefore running the probe - Use environment variables in
config/probe.yml(e.g.,${SERVICE_TOKEN})
- Edit
-
Update the configuration:
- Edit
config/probe.ymlwith your service-specific configuration - Reference environment variables from
env.secretsusing${VARIABLE_NAME}syntax
- Edit
-
Implement your entities:
- Edit or create new entity files in
internal/probe/entities/ - Each entity must implement the
core.Entityinterface:Name() stringRefresh(client core.Client) (interface{}, error)Save(stateManager core.StateManager, data interface{}) error
- Edit or create new entity files in
-
Implement your service client:
- Edit
internal/<service-name>/client.go - Implement methods to interact with your service API
- The client will be passed to entities via the
Refresh()method
- Edit
-
Update data models:
- Edit
internal/models/models.goto define your data structures - Models should include YAML and JSON tags for serialization
- Edit
-
Register entities:
-
In
internal/probe/probe.go, register your entities:coreAgent.RegisterEntity(entities.NewYourEntity())
-
-
Start developing:
make dev
The generated config/probe.yml follows this structure:
probe:
name: "<probe-name>"
version: "1.0.0"
<service-name>:
api_url: "https://api.example.com"
token: "${FLUID_SERVICE_TOKEN}"
data:
entities:
- name: example
refresh_interval: "1h"
retention_frequencies:
days: 30
months: 12
state:
dir: "state"
format: "yaml"
cleanup_interval: 1Each entity in the configuration can specify:
name(required): Unique name for the entityrefresh_interval(required): How often to refresh this entity (e.g.,"5m","1h","8h")retention_frequencies(optional): Which historical state files to keep:seconds,minutes,hours,days,weeks,months,years- Each frequency defines how many states to keep (0 = unlimited)
cd code/agents/core
make build
./build/core scaffold -name aws-probe
cd ../aws-probe
# Edit config/probe.yml with AWS credentials
# Implement entities in internal/probe/entities/
# Implement AWS client in internal/aws/client.go
# Register entities in internal/probe/probe.go
make devAfter generation, you can customize:
- Service client: Implement your API client in
internal/<service-name>/client.go - Entities: Create multiple entities in
internal/probe/entities/ - Models: Define your data structures in
internal/models/models.go - Configuration: Add service-specific configuration fields in
internal/config/config.go
The scaffold generates an env.secrets file that is automatically gitignored. This file contains sensitive credentials and should never be committed to version control.
Format:
# Service Probe Credentials
# Source this file with: source env.secrets
# This file is ignored by git
# Service API Token
export FLUID_SERVICE_TOKEN="your_token_here"Usage:
-
Edit
env.secretswith your actual credentials -
Source it before running the probe:
source env.secrets make dev -
Reference variables in
config/probe.ymlusing${VARIABLE_NAME}syntax
- The scaffold generates code that uses the core framework
- All generated code follows Go best practices and conventions
- The probe structure is ready to use with minimal modifications
- Environment variables are supported in configuration files using
${VAR_NAME}syntax - The
env.secretsfile is automatically gitignored and should contain all sensitive credentials