Skip to main content

Curadise monitoring agent - async metrics collection, heartbeats, and remediation

Project description

curadise-agent

Async monitoring agent for Curadise - collects system metrics, sends heartbeats, and executes remote commands with security-first design.

Features

  • Async-first architecture - Built on anyio for high-performance concurrent operations
  • System metrics collection - CPU, memory, disk, network via psutil
  • HTTP health checks - Monitor endpoints with customizable checks
  • Buffered transport - In-memory buffer with optional persistence for reliability
  • Heartbeat service - Regular health reporting with automatic reconnection
  • Remote command execution - Secure sandboxed execution with allowlist/denylist
  • mTLS support - Mutual TLS authentication for secure communication
  • JWT authentication - Token-based auth with automatic refresh
  • Hot-reload configuration - Watch config files for changes without restart
  • Structured logging - JSON logging via structlog for easy parsing

Requirements

  • Python 3.12+
  • Linux or macOS

Installation

# Using pip
pip install curadise-agent

# Using uv (recommended)
uv pip install curadise-agent

# From source
git clone https://github.com/pysingh09/curadise-agent.git
cd curadise-agent
uv pip install -e .

Quick Start

  1. Create a configuration file:
cp examples/agent.yaml /etc/curadise/agent.yaml
  1. Set your enrollment token:
export CURADISE_ENROLLMENT_TOKEN="your-token-here"
  1. Run the agent:
curadise-agent run --config /etc/curadise/agent.yaml

CLI Commands

# Run the agent
curadise-agent run --config agent.yaml

# Check agent version
curadise-agent version

# Validate configuration
curadise-agent config validate --config agent.yaml

# Show effective configuration
curadise-agent config show --config agent.yaml

Configuration

The agent is configured via YAML files with Jinja2 templating support for environment variables.

Minimal Configuration

server:
  url: "https://curadise.example.com"

auth:
  enrollment_token: "{{ env('CURADISE_ENROLLMENT_TOKEN') }}"

Key Configuration Sections

Section Description
server Server URL, timeout, SSL settings
auth Enrollment token, mTLS certificates
buffer Memory buffer size, persistence, batching
retry Retry attempts, backoff, circuit breaker
heartbeat Heartbeat interval and health metrics
collectors System metrics and HTTP check configuration
executor Command execution settings and allowlist
logging Log level, format, and file rotation
state Persistent state directory
tags Custom tags for metrics and heartbeats

See examples/agent.yaml for a complete configuration reference.

Environment Variables

Configuration values can reference environment variables:

auth:
  enrollment_token: "{{ env('CURADISE_ENROLLMENT_TOKEN') }}"

http_checks:
  - url: "https://api.example.com/health"
    headers:
      Authorization: "Bearer {{ env('API_TOKEN') }}"

Architecture

curadise-agent/
├── src/curadise_agent/
│   ├── auth/          # JWT tokens, mTLS, registration
│   ├── collectors/    # Metrics collectors (system, HTTP)
│   ├── config/        # Configuration loading, schema, watcher
│   ├── executor/      # Command execution with sandbox
│   ├── heartbeat/     # Heartbeat service and health checks
│   ├── models/        # Pydantic models (domain, API)
│   ├── state/         # Persistent state management
│   ├── transport/     # HTTP client, buffering, batching
│   └── utils/         # Logging, retry, shutdown handling
└── tests/
    ├── unit/          # Unit tests
    └── integration/   # Integration tests

Development

Setup

# Clone the repository
git clone https://github.com/pysingh09/curadise-agent.git
cd curadise-agent

# Create virtual environment
uv venv
source .venv/bin/activate

# Install with dev dependencies
uv pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=curadise_agent --cov-report=html

# Run only unit tests
pytest tests/unit/

# Run integration tests
pytest tests/integration/ -m integration

Code Quality

# Linting
ruff check src/ tests/

# Type checking
mypy src/

# Format code
ruff format src/ tests/

Security

The agent implements several security measures:

  • Command allowlist/denylist - Control which commands can be executed
  • Signature verification - Optionally require server signatures on commands
  • Sandboxed execution - Commands run in isolated subprocesses
  • mTLS support - Mutual TLS for server authentication
  • JWT with refresh - Short-lived tokens with automatic refresh
  • No secrets in config - Use environment variables for sensitive data

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

curadise_agent-0.1.2.tar.gz (66.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

curadise_agent-0.1.2-py3-none-any.whl (78.8 kB view details)

Uploaded Python 3

File details

Details for the file curadise_agent-0.1.2.tar.gz.

File metadata

  • Download URL: curadise_agent-0.1.2.tar.gz
  • Upload date:
  • Size: 66.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for curadise_agent-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4f1937b278573c43e64b497d6733d4a001eea1de0cee64c6cedb4fe8914c26f8
MD5 3144569d62032c7ce04689572b7d565d
BLAKE2b-256 9d7e47085a04a4be1e045c1ce8c6dd899cba5287399ad35e020f6984c0598f9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for curadise_agent-0.1.2.tar.gz:

Publisher: publish.yml on pysingh09/curadise-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file curadise_agent-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: curadise_agent-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 78.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for curadise_agent-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f01124b174bc7a9ed45deaef216d18ae1805398a116650c0b9779649a889df14
MD5 5c019a37cd5bd591e0fccee2bfeb2781
BLAKE2b-256 9123af59da709c99f4cc6033b1ff48dfee0f34109304fa7925c801702cafb929

See more details on using hashes here.

Provenance

The following attestation bundles were made for curadise_agent-0.1.2-py3-none-any.whl:

Publisher: publish.yml on pysingh09/curadise-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page