Skip to content

Latest commit

 

History

History
961 lines (752 loc) · 74 KB

API.md

File metadata and controls

961 lines (752 loc) · 74 KB

VXControl Cloud Platform API Reference

Overview

The VXControl Cloud Platform provides a comprehensive suite of cybersecurity services accessible through secure, PoW-protected APIs. The platform serves as the backbone for advanced security operations, threat intelligence, vulnerability management, and AI-powered security analysis.

API Request Flow

sequenceDiagram
    participant App as Security Application
    participant SDK as VXControl SDK
    participant Anon as Data Anonymizer
    participant API as Cloud API
    participant PoW as PoW Service

    App->>SDK: Configure endpoints & Build()

    opt Client applies the anonymizer
        App->>Anon: Anonymize sensitive data
        Anon-->>App: PII/secrets masked
        Note over Anon: Applied by the client, optional<br/>300+ pattern recognition
    end

    App->>SDK: Support API call request

    SDK->>PoW: Request challenge ticket
    PoW-->>SDK: Challenge (nonce, difficulty)
    SDK->>SDK: Solve memory-hard PoW puzzle

    SDK->>API: HTTP request with PoW signature
    Note over SDK,API: AES-GCM encrypted<br/>AES-CBC signed

    API->>API: Validate PoW & license
    API->>API: Process request
    API-->>SDK: Encrypted response

    SDK->>SDK: Decrypt & validate
    SDK-->>App: Response body (bytes/reader/writer)
    App->>App: models.ParseEnvelope[T] unwraps {status,data}

    Note over App,API: All data validated<br/>with Go models
Loading

Technical Components

  • PoW System: Memory-hard challenges whose parameters are set by each ticket, for FPGA resistance
  • Data Anonymization: A client-side anonymizer the integrating application may apply before it sends data
  • Cryptographic Validation: Ed25519 + SHA-512 signatures validate package downloads (over the bare SHA-512), license modules (over models.LicenseModuleDigest of their SHA-512) and knowledge packages (over models.KnowledgePackageDigest of the SHA-512 of their plain ZIP); AES-GCM authentication tags protect every request/response chunk
  • Type Safety: 24 strongly-typed call patterns with built-in Go model validation
  • Streaming Architecture: Memory-efficient processing with AES-GCM chunk encryption (16KB default)

Authentication & Security

All API endpoints require:

  • PoW Challenge: Memory-hard proof-of-work with parameters that vary per ticket
  • License Validation: Cryptographic verification of the licence key, when the call carries one, with tier-based access control
  • End-to-End Encryption: AES-128-GCM streaming encryption with 16KB chunks
  • Session Keys: A fresh session key for every request, sealed to the server's public key; the proof-of-work key changes daily

Terms of Use

⚠️ Important Legal Notice: Use of PentAGI Cloud services is subject to the Terms of Use, and some services require a licence key; for PentAGI Enterprise the EULA governs.

The platform provides access to sensitive cybersecurity capabilities including:

  • Threat Intelligence: IOC/IOA databases and real-time threat analysis
  • Vulnerability Data: CVE databases, exploit information, and security assessments
  • AI-Powered Support: Automated troubleshooting with access to system logs and configurations
  • Computational Resources: Cloud-based security analysis and processing

These services may ONLY be used for authorized, ethical, and legal cybersecurity purposes.

Before using any API endpoints, ensure you understand and comply with all applicable terms and restrictions outlined in the Terms of Use.

API Services

Service Host Endpoint Method Models Status Description
Update Service update.pentagi.com /api/v1/proxy/updates/check POST CheckUpdatesRequest → CheckUpdatesResponse ✓ Production Check for component updates with changelogs
Package Service update.pentagi.com /api/v1/proxy/packages/info GET PackageInfoRequest → PackageInfoResponse ✓ Production Get package metadata and signatures
Package Service update.pentagi.com /api/v1/proxy/packages/download GET DownloadPackageRequest → Binary stream ✓ Production Download signed packages with validation
Support Service support.pentagi.com /api/v1/proxy/errors/report POST SupportErrorRequest → SupportErrorResponse ✓ Production Error reporting; the client may anonymise the data first
Support Service support.pentagi.com /api/v1/proxy/support/issues POST SupportIssueRequest → SupportIssueResponse ✓ Production Create support issues with AI assistance; the client may anonymise the data first; error_details is read as a SupportIssueDetails document, and the request has limits; endpoint code support_issues
Support Service support.pentagi.com /api/v1/proxy/support/issues/:issueID/status GET Path args → SupportIssueStatusResponse ✓ Production What runs on an issue — processing, processed or answering — and when its conversation last changed (see Support Issue Status Format); endpoint code support_issue_status
Support Service support.pentagi.com /api/v1/proxy/support/issues/:issueID/messages GET Path args → SupportIssueMessagesResponse ✓ Production The conversation of an issue as the server keeps it: the questions, the steps of the assistant and its answers, [] before the first question; endpoint code support_issue_messages
AI Investigation support.pentagi.com /api/v1/proxy/support/investigate POST SupportInvestigationRequest → SupportInvestigationResponse ✓ Production AI-powered troubleshooting with secure data handling: one question of the conversation of an issue, taken only while the issue is processed; endpoint code support_investigate
Language Models features.pentagi.com /api/v1/proxy/llm/chat/completions POST chat completion request of the OpenAI API → event stream (chunk or result) ✓ Production Chat completions of the agents of a licence with Cloud LLM; model names an agent
Language Models features.pentagi.com /api/v1/proxy/llm/embeddings POST embeddings request of the OpenAI API, input a string or an array of strings (token ids are refused) → event stream (result) ✓ Production Embeddings of the agents of a licence with Cloud LLM
Language Models features.pentagi.com /api/v1/proxy/llm/models GET → LLMModelsResponse ✓ Production The agents a licence may name in model, with what each takes: the list object of the OpenAI API ({"object":"list","data":[…]}) in the envelope of every JSON answer, each agent a model object whose id is its name
Licence Status update.pentagi.com /api/v1/proxy/license/status GET → LicenseStatusResponse ✓ Production The tier of a licence, the features it enables and the share of each of its quotas of the support assistant and of Cloud LLM used today and this month, in whole percent (-1 for no ceiling); endpoint code license_status
Licence Module update.pentagi.com /api/v1/proxy/license/module GET module_id (the module described, see Licence Module Format) → Binary stream ✓ Production The bytes of the module described, refused as License.ModuleSuperseded when another one is served now; endpoint code license_module
Knowledge Package update.pentagi.com /api/v1/proxy/knowledge/download GET KnowledgeDownloadRequest (hash, schema) → Binary stream ✓ Production The envelope of the knowledge package a content answer offered, sealed for the licence, refused as Knowledge.NotCurrent when the package is not the one offered now (see Knowledge Package Download); endpoint code knowledge_download
Threat Intelligence ti.vxcontrol.com /api/v1/threats/query POST ThreatQueryRequest → ThreatIntelResponse 🚧 Planned, not served Access real-time threat intelligence and IOC databases
Vulnerability Assessment ti.vxcontrol.com /api/v1/vulns/scan POST VulnScanRequest → VulnScanResponse 🚧 Planned, not served Vulnerability assessment and exploit database queries
Knowledge Base kb.vxcontrol.com /api/v1/knowledge/search GET Query params → KnowledgeResponse 🚧 Development Search cybersecurity knowledge base (MITRE ATT&CK, IOCs, vulnerabilities)
Computational Resources compute.pentagi.com /api/v1/compute/submit POST ComputeTaskRequest → ComputeTaskResponse 🚧 Development Submit intensive computational tasks (password cracking, analysis)
Computational Resources compute.pentagi.com /api/v1/compute/results/:taskId GET Path args → ComputeResultResponse 🚧 Development Retrieve computational task results

SDK Architecture

Request Lifecycle

  1. SDK Configuration: Define endpoints with CallConfig structs
  2. Function Generation: SDK creates typed functions for each endpoint
  3. Data Anonymization: The client may apply the anonymizer to the data it sends; what a service receives depends on the feature and on the client
  4. PoW Challenge: Automatic challenge solving before each request
  5. Request Signing: AES-CBC signature (nonce + timestamp + content length + CRC32) with installation ID XOR-masking
  6. Key Exchange: NaCL box (Curve25519) encrypts the ephemeral session key to the server
  7. Encryption: AES-128-GCM streaming encryption of request/response bodies (16KB chunks)
  8. Type Validation: Go models ensure data integrity throughout

Core Components

  • Call Patterns: 24 function types handle different request/response scenarios
  • Data Anonymizer: Optional client-side PII/secrets masking engine with 300+ patterns
  • Transport Layer: HTTP/2 with connection pooling and custom TLS configuration
  • Cryptographic Engine: NaCL box (Curve25519) for session-key exchange + AES-128-GCM for body encryption + AES-128-CBC for PoW request signatures; Ed25519 + SHA-512 used only to validate downloads (models/signature.go): a package over its bare SHA-512, a license module over models.LicenseModuleDigest of its SHA-512 (models/license.go), a knowledge package over models.KnowledgePackageDigest of the SHA-512 of its plain ZIP (models/knowledge.go)
  • PoW Solver: Memory-hard algorithm implementation with configurable timeout
  • License Manager: Cryptographic license validation and tier enforcement

Data Models

All API requests and responses use strongly-typed Go models with built-in validation.

Available Models

  • Component Management: models/types.go - Component types, statuses, OS/architecture enums, and their mapping to product stacks
  • Artefact Delivery & Update Vocabulary: models/artefacts.go, models/answer.go - Whether a component is a pulled image or a downloaded file, and the shared vocabulary for update answers (ComponentAction, ComponentReason, StackResolution, StackStatus)
  • Update Service: models/update.go - Update checking split by images/files, with a per-component action and the curated releases crossed on the way
  • Package Service: models/package.go - Package metadata, downloads, signatures
  • Support Service: models/support.go - Error reporting, AI-powered issue creation and investigation, including the streamed answer form, the status and the conversation of an issue (see Support Issue Status Format), the SupportIssueDetails document an issue is reported with and the limits of an issue (see Support Issue Format)
  • Signature Validation: models/signature.go, models/knowledge.go - Ed25519 cryptographic signature validation, the ID of the release key and the verification of a knowledge package (see Knowledge Package Signature)
  • Language Models: models/llm.go - The list of the agents of Cloud LLM (the list object of the OpenAI API, with the bounds and the supported_parameters of each agent) and the events of an LLM call (chunk, result); llm/ is the client that speaks the OpenAI API over these calls
  • Licence Status: models/license.go - The tier of a licence, the features it enables and the share of its quotas used, in whole percent (see Licence Status Format)
  • Licence Module: models/license.go - The description of the license module served for a licence, LicenseModuleInfo (see Licence Module Format); licensing/ is the client that downloads the module it describes
  • Content Components: models/content.go - The cloud content an installation reports in its product check, ContentComponentInfo with its vocabularies ContentKind, ContentObjectKind and ContentObjectReason (see Content Component Format), and the answer to each, ContentUpdate with its vocabulary ContentReason (see Content Answer Format); KnowledgeDownloadRequest is the query of the download of the package an answer offers, and content/ is the client that makes it (see Knowledge Package Download)
  • Response Envelope: models/envelope.go - ParseEnvelope[T] unwraps the {"status":…,"data":…} wrapper every JSON response arrives in
  • Data Anonymization: anonymizer/ - PII/secrets masking with pattern recognition
  • System Utilities: system/ - Cross-platform installation ID generation and machine identification

Model Features

  • IValid Interface: All models implement validation with comprehensive rules
  • IQuery Interface: GET endpoints support automatic query parameter generation
  • Database Integration: SQL driver support with Scan() and Value() methods
  • Type Safety: Enum validation prevents invalid API calls

SDK Call Patterns

The SDK provides 24 strongly-typed function patterns covering all request/response scenarios:

Request Types

  • None: Simple requests without parameters
  • Query: URL query parameters (?limit=10&offset=20)
  • Args: Path arguments (/users/:id/posts/:postId)
  • QueryWithArgs: Combined path arguments and query parameters

Request Body Types

  • None: GET requests without body
  • Bytes: []byte request body for JSON/binary data
  • Reader: io.Reader for streaming large uploads

Response Types

  • Bytes: []byte response for JSON/binary data
  • Reader: io.Reader for streaming large downloads
  • Writer: io.Writer for direct output streaming

Complete Pattern Matrix

Every combination of request shape, request body and response shape that the SDK generates:

Request Body Response Function Type Use Case
None None Bytes CallReqRespBytes Simple data retrieval
None None Reader CallReqRespReader Large file downloads
None None Writer CallReqRespWriter Direct output streaming
Query None Bytes CallReqQueryRespBytes Filtered data queries
Query None Reader CallReqQueryRespReader Query-based downloads
Query None Writer CallReqQueryRespWriter Query-based streaming (packages/download)
Args None Bytes CallReqWithArgsRespBytes Resource-specific requests
Args None Reader CallReqWithArgsRespReader Resource-specific downloads
Args None Writer CallReqWithArgsRespWriter Resource-specific streaming
Query+Args None Bytes CallReqQueryWithArgsRespBytes Combined path + query lookups
Query+Args None Reader CallReqQueryWithArgsRespReader Combined lookups, streamed response
Query+Args None Writer CallReqQueryWithArgsRespWriter Combined lookups streamed to a writer
None Bytes Bytes CallReqBytesRespBytes JSON API calls
None Bytes Reader CallReqBytesRespReader JSON request, SSE/streamed response
None Bytes Writer CallReqBytesRespWriter JSON request, response streamed to a writer
None Reader Bytes CallReqReaderRespBytes Large file uploads
None Reader Reader CallReqReaderRespReader Stream-to-stream processing
None Reader Writer CallReqReaderRespWriter Streamed upload with streamed output
Args Bytes Bytes CallReqBytesWithArgsRespBytes Resource updates
Args Bytes Reader CallReqBytesWithArgsRespReader Resource updates with a streamed response
Args Bytes Writer CallReqBytesWithArgsRespWriter Resource updates streamed to a writer
Args Reader Bytes CallReqReaderWithArgsRespBytes Streamed uploads to a specific resource
Args Reader Reader CallReqReaderWithArgsRespReader Resource-targeted stream processing
Args Reader Writer CallReqReaderWithArgsRespWriter Resource-targeted streamed upload/download

Only Bytes-body calls are retried automatically on a temporary failure (see Error Handling); a Reader-body call cannot be rewound after a failed attempt, so the SDK forces a single attempt for it.

Data Anonymization

Client-Side PII Protection

The SDK provides an anonymizer that the integrating application may apply to data before it sends it, as the support-errors and support-issues examples do. The SDK does not anonymise anything on its own; each service receives the data the client sends to it. The anonymizer covers:

Protected Data Categories:

  • Credentials: API keys, tokens, passwords, database connections
  • PII: Email addresses, phone numbers, SSNs, credit cards, personal identifiers
  • Network Data: IP addresses, domains, URLs, network configurations
  • Cloud Secrets: AWS/Azure/GCP credentials, service tokens, certificates
  • System Data: File paths, configuration values, session tokens

Anonymization Process:

// Before transmission to AI services
if err := anonymizer.Anonymize(&errorDetails); err != nil {
    return fmt.Errorf("failed to anonymize data: %w", err)
}
if err := anonymizer.Anonymize(&logs); err != nil {
    return fmt.Errorf("failed to anonymize logs: %w", err)
}

Technical Features:

  • Structure Preservation: admin@company.com → §**SSH Connection**§ (maintains analytical value)
  • Comprehensive Coverage: Multiple pattern databases (General, PII, Secrets) with extensive pattern recognition
  • Reflection-Based: Deep anonymization of complex Go structures and nested data
  • Performance Optimized: High throughput for production workloads
  • Memory Efficient: Fixed memory footprint with chunk-based streaming

Rate Limiting & PoW Protection

The platform uses a sophisticated memory-hard proof-of-work system designed for GPU and FPGA resistance:

PoW Algorithm Specifications

  • Memory Requirement: Dynamic allocation with step variation (prevents FPGA optimization)
  • Sequential Operations: Variable AES iterations with configurable key rotation intervals
  • Memory Access: Cryptographically derived offsets with uniform distribution
  • Parameter Variation: Parameters vary per ticket, which prevents hardware specialization

Dynamic Anti-FPGA Protection

type TicketSettings struct {
    MemorySize        uint16  // Dynamic memory allocation
    AESIterations     uint16  // Variable iteration count
    KeyUpdateInterval uint8   // Configurable rotation frequency
    MemoryReads       uint16  // Memory access operations
    ChunkSize         uint8   // Variable chunk sizes
    RetryDelaySeconds uint16  // Client backoff time
    AllowedRPM        uint16  // Rate limit threshold
}

Security Properties

  • Multi-Threading Resistance: High difficulty levels provide significant delays even with multi-core attacks
  • GPU Resistance: Memory-hard properties substantially reduce GPU optimization advantages
  • Daily Key: The proof-of-work key changes daily

Error Handling

All endpoints return structured error responses. The SDK parses them into typed Go errors:

{
  "status": "error",
  "code": "TooManyRequestsRPM"
}

Error Codes

Server Code SDK Error Retry Notes
BadGateway sdk.ErrBadGateway Yes (3s) Temporary backend overload
Internal sdk.ErrServerInternal Yes (3s) Temporary server error
BadRequest sdk.ErrBadRequest No Invalid request format
Forbidden sdk.ErrForbidden No Invalid license, a license the endpoint does not serve, or an unknown endpoint, Name, path or method
NotFound sdk.ErrNotFound No A named resource that does not exist, or a host the endpoint is not served on
Blocked sdk.ErrBlocked Never The client is temporarily blocked
TooManyRequests *sdk.RateLimitError (General) Yes (5s) General rate limit
TooManyRequestsRPM *sdk.RateLimitError (RPM) Yes (Retry-After, max 10s) Per-minute window
TooManyRequestsRPH *sdk.RateLimitError (RPH) No Per-hour window — too long to auto-retry
TooManyRequestsRPD *sdk.RateLimitError (RPD) No Per-day window — too long to auto-retry
QuotaBlocked *sdk.QuotaError (Blocked) Never Endpoint unavailable for this license tier
QuotaExceededDaily *sdk.QuotaError (Daily) No (Retry-After) Daily quota exhausted
QuotaExceededMonthly *sdk.QuotaError (Monthly) No (Retry-After) Monthly quota exhausted
RequestClockSkew *sdk.ClockSkewError (sdk.ErrRequestClockSkew) No The time of the request, read from the host clock, is outside the window the proxy accepts; the X-Server-Time header (RFC 3339) carries the proxy's time, which the error holds as ServerTime beside Skew()

A code the SDK maps to no sentinel — a code of one route, like those below, or a code of a server newer than the SDK — comes back as a *sdk.RefusalError. Its Code is the code and its RetryAfter the wait the refusal asked for in its Retry-After header, zero when it asked for none; sdk.RetryAfterOf(err) reads it. It matches sdk.ErrRequestFailed under errors.Is, its message is the code followed by : request execution failed, and the SDK never retries it, whatever the wait. Inside an event stream read with sdk.ErrorFromCode the same refusal is an *sse.Error whose chain holds the same *sdk.RefusalError. The SDK knows no route: the package of a route gives the codes of that route errors of its own.

The update and package endpoints refuse some calls with codes of their own. Neither is retried.

Server Code HTTP Meaning
Updates.InvalidRequest 400 The request cannot be read or is not valid
Updates.NotFound 404 The package asked for does not exist

The support endpoints refuse some calls with codes of their own, each a *sdk.RefusalError (Support.Busy: request execution failed); inside an event stream the code is also the Code of the *sse.Error. None of them is retried.

Server Code HTTP Meaning
Support.InvalidRequest 400 The request cannot be read: a body that is not the JSON of the request or is larger than models.MaxSupportIssueRequestBytes, an issue ID that is not a UUID
Support.InvalidData 500 The request was read and is not valid: what Valid of its model refuses, the limits of an issue included
Support.NotFound 404 No issue of this ID belongs to the licence of the caller
Support.Busy 409 A question sent while the issue is not processed: its logs are still processed, or another question of it is being answered (see Support Issue Status Format)

The download of a licence module refuses with two codes of its own, mapped the same way; licensing.Client.DownloadModule gives them errors of the licensing package. Neither is retried.

Server Code HTTP Error of DownloadModule Meaning
License.ModuleSuperseded 409 licensing.ErrModuleSuperseded Another module is served now than the one the download named: ask for the description again
License.ModuleNotReady 503 licensing.ErrModuleNotReady No module is served for the licence now: ask for the description again later, when it says how long to wait

The download of a knowledge package refuses with four codes of its own, mapped the same way; content.Client.Download gives them errors of the content package. None of them is retried.

Server Code HTTP Error of Download Meaning
Knowledge.NotCurrent 409 content.ErrNotCurrent The hash is not the target of the licence for the schema sent: another package is offered now, or none. Check again once and download what that answer offers
Knowledge.KeyServiceUnavailable 503 content.ErrKeyServiceUnavailable The envelope can be neither computed nor sealed now: the server could not read the target of the licence or get the key to seal the envelope with. The refusal carries Retry-After: ask again no sooner than sdk.RetryAfterOf(err)
Knowledge.Busy 429 content.ErrBusy As many downloads as the server serves at once already run, for the licence or in all: ask again at the next check
Knowledge.Held 403 content.ErrHeld The licence is held or not registered for content, and the check answers unknown with the reason held: ask again at the next check

Retry-After Header

Rate-limit and quota responses carry a Retry-After: <seconds> header, and so may the refusal of a route. The SDK embeds it in *RateLimitError.RetryAfter, *QuotaError.RetryAfter and *RefusalError.RetryAfter. Use sdk.RetryAfterOf(err) to read it from any error without type-asserting:

if wait := sdk.RetryAfterOf(err); wait > 0 {
    time.Sleep(wait) // server-suggested cooldown
}

*RateLimitError wraps temporary rate-limit sentinels (General/RPM are auto-retried by the SDK; RPH/RPD are surfaced to the caller). *QuotaError wraps license-tier quota sentinels — all quota errors are fatal and never auto-retried.

SDK Integration

Use the VXControl Cloud SDK for seamless integration with the platform:

import (
    "github.com/vxcontrol/cloud/sdk"
    "github.com/vxcontrol/cloud/system"
)

// Configure endpoints for multiple services
configs := []sdk.CallConfig{
    {
        Calls:  []any{&checkUpdates},
        Host:   "update.pentagi.com",
        Name:   "updates_check",
        Path:   "/api/v1/proxy/updates/check",
        Method: sdk.CallMethodPOST,
    },
    {
        Calls:  []any{&reportError},
        Host:   "support.pentagi.com",
        Name:   "errors_report",
        Path:   "/api/v1/proxy/errors/report",
        Method: sdk.CallMethodPOST,
    },
    {
        Calls:  []any{&queryThreats},
        Host:   "service.example.com", // placeholder: a service of your own
        Name:   "your_endpoint",
        Path:   "/api/v1/your/path",
        Method: sdk.CallMethodPOST,
    },
}

// Build SDK with stable installation ID
err := sdk.Build(configs,
    sdk.WithClient("MySecTool", "1.0.0"),
    sdk.WithInstallationID(system.GetInstallationID()),
    sdk.WithLicenseKey("XXXX-XXXX-XXXX-XXXX"),
)

Endpoint Health Check

Use sdk.Check() to probe endpoint reachability and inspect allowed RPM without making an actual API call. Useful at startup or in health-check routines:

statuses, err := sdk.Check(ctx, configs,
    sdk.WithClient("MySecTool", "1.0.0"),
    sdk.WithLicenseKey("XXXX-XXXX-XXXX-XXXX"),
)
if err != nil {
    log.Fatal("SDK setup failed:", err)
}

for name, s := range statuses {
    log.Printf("[%s] reachable=%v allowedRPM=%d err=%v",
        name, s.IsReachable(), s.AllowedRPM(), s.LastError())
}

// Re-probe later (e.g. after a rate-limit cooldown)
_ = statuses["updates_check"].Recheck(ctx)

### Working Examples

Production-ready examples are available in the [examples/](examples/) directory:

- **[examples/check-update/](examples/check-update/)** - Update service integration with component management
- **[examples/download-installer/](examples/download-installer/)** - Package downloads with streaming signature validation
- **[examples/report-errors/](examples/report-errors/)** - Support workflow with automated data anonymization
- **[examples/knowledge-download/](examples/knowledge-download/)** - Product check of a knowledge component and the download of the package it offers

### Integration Example

```go
// Complete multi-service integration
type Client struct {
    UpdatesCheck     sdk.CallReqBytesRespBytes
    PackageDownload  sdk.CallReqQueryRespWriter
    ErrorReport      sdk.CallReqBytesRespBytes
    IssueInvestigate sdk.CallReqBytesRespReader  // Stream response support
}

configs := []sdk.CallConfig{
    {
        Calls:  []any{&client.UpdatesCheck},
        Host:   "update.pentagi.com",
        Name:   "updates_check",
        Path:   "/api/v1/proxy/updates/check",
        Method: sdk.CallMethodPOST,
    },
    {
        Calls:  []any{&client.ErrorReport},
        Host:   "support.pentagi.com",
        Name:   "errors_report",
        Path:   "/api/v1/proxy/errors/report",
        Method: sdk.CallMethodPOST,
    },
}

// SDK automatically handles:
// - PoW ticket generation and solving
// - AES-GCM streaming encryption
// - Retry logic with exponential backoff

// A client that sends free text to support services may initialize the anonymizer:
// - PII/secrets masking before transmission
// - Comprehensive pattern recognition (credentials, emails, IPs, etc.)
// - Structure-preserving anonymization maintains analytical value
anonymizer, _ := anonymizer.NewAnonymizer(nil)

err := sdk.Build(configs, options...)

Performance Characteristics

Architecture Benefits

Server Performance:

  • High-Throughput: Optimized ticket generation with microsecond latency
  • Efficient Validation: Millions of PoW validations per second
  • Scalable Proxy: Throughput scales based on security validation requirements

Client Performance:

  • Dynamic Scaling: PoW solving scales exponentially with difficulty for effective rate limiting
  • Optimized Processing: High-performance path templates and function generation
  • Efficient Cryptography: Sub-millisecond license and signature validation
  • Streaming Architecture: Memory-efficient processing for large data transfers

Memory Efficiency:

  • Minimal Footprint: Optimized memory usage per request and SDK instance
  • Dynamic Allocation: PoW memory reused across multiple attempts
  • Streaming Processing: Fixed memory usage regardless of data size
  • Connection Pooling: Efficient transport layer resource management

Production Deployment

Security Requirements

  • TLS 1.2+: All API communications encrypted
  • Certificate validation: Verify server certificates in production
  • License management: Secure storage of license keys
  • Signature verification: Validate all downloaded packages

Performance Tuning

  • PoW timeout: Adjust based on hardware capabilities and security requirements
  • Connection pooling: Optimized connection limits per host and total idle connections
  • HTTP/2 optimization: Automatic protocol negotiation with multiplexing
  • Transport layer: Configurable response timeouts for backend processing

Monitoring Integration

  • Endpoint Statistics: Per-endpoint request/error/timing metrics with atomic counters
  • PoW Performance: Solve time distribution and retry rate monitoring
  • Cryptographic Operations: Signature validation and encryption performance tracking
  • Backend Health: Response time and error rate tracking for proxy services

Proxy Architecture

The platform uses a dynamic reverse proxy for unified API management:

Components

  • Protocol Proxy: Acts as API gateway with integrated PoW validation
  • Dynamic Routing: Configuration-driven endpoint generation
  • Middleware Chain: Unified security validation across all backends
  • Statistics Collection: Real-time performance and error metrics

Benefits

  • Backend Isolation: Services receive only validated, decrypted requests
  • Unified Security: Single point for PoW validation and rate limiting
  • Transparent Encryption: No security complexity for backend services
  • Health Monitoring: Built-in /api/health endpoint for load balancers

Technical Details

Request Headers

Ticket request (GET /api/v1/ticket/:name):

X-Installation-ID: <stable-machine-uuid>
X-Request-ID:      <random-uuid>
X-Request-Key:     <base64(clientPublicKey[32] + nonce[24] + encrypted(sessionKey+sessionIV+ts+len)[64])>
X-License-Key:     <base64-encrypted-license>  (optional)
User-Agent:        MyApp/1.0.0 sdk/1.0.0

Main API request:

X-Installation-ID: <stable-machine-uuid>
X-Request-ID:      <pow-derived-request-uuid>
X-Request-Sign:    <base64-AES-CBC-signature[48]>
X-License-Key:     <base64-encrypted-license>  (optional)
User-Agent:        MyApp/1.0.0 sdk/1.0.0
Content-Type:      application/json  (when body is present)

Installation ID Generation

The SDK uses cross-platform machine identification for stable installation tracking:

Implementation:

// Automatic stable ID generation
installationID := system.GetInstallationID()
// Returns same UUID for same machine across application restarts

Platform Support:

  • Linux: /var/lib/dbus/machine-id + SMBIOS data (when available)
  • macOS: IOPlatformUUID from hardware registry
  • Windows: Registry MachineGuid + system product information

Features:

  • Deterministic: Same machine always generates same UUID
  • Cross-Platform: Works on Linux, macOS, Windows
  • Fallback Logic: Uses hostname when machine ID unavailable
  • UUID Format: RFC4122 compliant UUID v3 (MD5-based)

Response Format

Successful responses return JSON data wrapped in an envelope:

{
  "status": "success",
  "data": { /* model-specific response */ }
}

Error responses contain only status and code (see Error Handling for all codes):

{
  "status": "error",
  "code": "TooManyRequestsRPM"
}

Always decode the body through models.ParseEnvelope[T], never straight into the payload type. Unmarshalling {"status":"success","data":{...}} directly into e.g. CheckUpdatesResponse does not fail — it silently produces a zero-value response, which reads as "nothing to report" instead of the actual answer:

// Wrong: "succeeds" and yields an empty CheckUpdatesResponse
var resp models.CheckUpdatesResponse
json.Unmarshal(body, &resp)

// Right: unwraps the envelope, and returns *models.APIError on a "status":"error" body
resp, err := models.ParseEnvelope[models.CheckUpdatesResponse](body)

Event streams (text/event-stream) are the exception, not wrapped in this envelope: the answer of a streamed investigation (SupportInvestigationRequest.UseStream: true) and the answer of every LLM call (/api/v1/proxy/llm/chat/completions, /api/v1/proxy/llm/embeddings). A refusal before such a stream begins, and the list of agents (/api/v1/proxy/llm/models), are enveloped like any JSON answer; a package download and a module download are the file itself.

Event Stream Format

A streamed answer is a sequence of frames: event: <name>, data: <one JSON value on one line>, a blank line. The grammar is start, then any number of heartbeat frames and of the events of the call, then exactly one of done and error; nothing follows the last frame.

Event Data Meaning
start what identifies the call, or nothing: {"issue_id":"…"} for an investigation, {} for an LLM call the first frame
heartbeat {"timestamp":<unix seconds>} keeps the connection alive every few seconds; carries nothing else
error {"code":"<code>","message":"<text>"} the server refused or failed after the response began; code is the code of the error envelope the same refusal has before it
done {} the answer is complete

An answer is complete if and only if done arrived. The end of the body before done or error means the stream was cut: what arrived is not an answer, and the request must not be repeated on account of it. The sdk/sse package reads the stream by these rules (sse.Read, sse.NewReader): it hands the caller start and the events of the call, consumes the heartbeats, returns *sse.Error for an error event — matched by errors.Is against the errors of the sdk package when given sdk.ErrorFromCode — and sse.ErrStreamCut for a cut one.

Requests ask for Accept-Encoding: identity: the body of an answer is ciphertext, and a hop that compresses would hold frames back.

Licence Status Format

The endpoint license_status (GET /api/v1/proxy/license/status, no request body) answers a licensed installation with what its licence gives it, in the envelope of every JSON answer. The caller builds the call itself — the endpoint code is the Name of the call and is not the caller's to choose — and reads the answer with ParseEnvelope, then Valid:

var licenseStatus sdk.CallReqRespBytes
err := sdk.Build([]sdk.CallConfig{{
    Calls:  []any{&licenseStatus},
    Host:   "update.pentagi.com",
    Name:   "license_status",
    Path:   "/api/v1/proxy/license/status",
    Method: sdk.CallMethodGET,
}}, options...)

body, err := licenseStatus(ctx)
status, err := models.ParseEnvelope[models.LicenseStatusResponse](body)
err = status.Valid() // refuse what is not a status rather than read it as one with nothing used
{"tier":"enterprise","features":{"updates":true,"support":true,"knowledge_base":false,"cloud_llm":true,"engine":true},"quotas":[
  {"limit":"llm_agent","daily":{"requests":-1},"monthly":{"requests":-1}},
  {"limit":"llm_automation","daily":{"requests":100},"monthly":{"requests":30}},
  {"limit":"llm_completion","daily":{"requests":1,"tokens":13},"monthly":{"requests":1,"tokens":4}},
  {"limit":"llm_embedding","daily":{"requests":0,"tokens":0},"monthly":{"requests":1,"tokens":2}}
]}
Field Meaning
tier the tier of the licence
features updates, support, knowledge_base, cloud_llm, engine — the flags of the key, cloud_llm as served: false on a tier Cloud LLM does not serve, even when the key carries the flag
quotas[].limit the name of the limit (llm_agent, llm_automation, llm_completion, llm_embedding; a limit added later is read by its name like these)
daily / monthly today, a UTC day; this month of the licence, counted from the day of the month its first key was issued
requests the share of the calls
tokens the larger of the shares of the input and of the output tokens; absent for a limit that meters no tokens

Every share is a whole percent of the quota used, with the overrides of the licence applied, computed by the server: 0 is nothing used, any use is at least 1, a share between is rounded down and stays below 100, and 100 is a quota used up — the next call of that limit is refused (QuotaExceededDaily, QuotaExceededMonthly). -1 (models.LicenseQuotaUnlimited) is no ceiling in that period; tokens is -1 only when neither kind of token has one. A limit the licence cannot call, or calls with no quota kept, is not in the list; quotas is [] for none, never null. The endpoint counts against no quota and has rate limits of its own per licence; a licence the API does not serve is refused, either as Forbidden like any other call of it or as QuotaBlocked: read both as the licence not served, not as a failure to retry.

Licence Module Format

The client of the licensing package downloads the license module of a licence in one call, license_module (GET /api/v1/proxy/license/module), and verifies the download as it streams; replace a module before its refresh_by. The caller supplies the models.LicenseModuleInfo the download needs:

client, err := licensing.New("update.pentagi.com",
    sdk.WithClient("MySecTool", "1.0.0"),
    sdk.WithInstallationID(system.GetInstallationID()),
    sdk.WithLicenseKey(licenseKey),
)
var info models.LicenseModuleInfo // supplied by the caller
if err == nil && info.Ready && info.ModuleID != runningModuleID {
    err = client.DownloadModule(ctx, info, file) // put the file in place only on nil
}

The description has one of two forms: a module served, and none served yet.

{"ready":true,"module_id":"9f86d081884c7d659a2feaa0c55ad015","built_at":"2026-11-04T09:30:00Z","refresh_by":"2026-12-04T09:30:00Z","size":5579009,"hash":"4867c051097fca37bdc60f5f0669a694f31032c3ff4419f02b51ce187e9cc1d8","signature":"/qVFpJ8CTXgF4DZmsIsztDiLg7Wdr2OUolaWnNCBGB7CP8XHq7Mb9t8wo4vOU9tC3iiPKMaDiz1wN04KfyJxCw","retry_after_seconds":0}
{"ready":false,"retry_after_seconds":300}
Field Meaning
ready whether a module is served for the licence now
module_id the ID of the module: 32 lowercase hex digits
built_at / refresh_by when the module was built, and by when the installation needs a newer one (RFC 3339, UTC)
size the length of the module in bytes, 1 to 40 MiB (models.LicenseModuleMaxSize)
hash the SHA-256 of the module, in lowercase hex
signature the Ed25519 signature, in the form PackageInfoResponse.Signature carries, over models.LicenseModuleDigest of the module's SHA-512: SHA-512("pentagi/license-module/v1\x00" ‖ SHA-512(module)), so a module's signature never verifies as a package's
retry_after_seconds when no module is served, in how many seconds to ask again (at least 1); 0 when one is

When ready is false, only ready and retry_after_seconds are present. LicenseModuleInfo.Valid refuses a description that is not one of the two forms, and DownloadModule refuses one that is not ready or not valid before it asks for anything.

The download names the module it expects (module_id) and answers its bytes, which DownloadModule writes to the caller's writer as they arrive. Their length, their SHA-256 and their signature are checked in the same pass, and a byte past size is refused before it is written; a mismatch is licensing.ErrModuleMismatch. The module is verified only once its last byte is written, so after any error the writer holds a partial or unverified module: download into a file that is put in place only after DownloadModule returned nil. A module the API replaced since its description was given is refused as License.ModuleSuperseded (licensing.ErrModuleSuperseded): get a new description. The download has no deadline of its own beyond the context of the call.

The download only delivers a module: whether it is one of this licence, and whether it opens, is for the runtime of the module to check. A licence whose key carries sdk.LicenseFlagOffline is served like any other; the flag only lets its installation also be given a module by hand. The endpoint counts against no quota and has rate limits of its own per licence: after a *sdk.RateLimitError ask again no sooner than sdk.RetryAfterOf(err), and download only a module whose ID is not the one that runs. A licence the API does not serve is refused, either as Forbidden or as QuotaBlocked.

Content Component Format

The product check (pentagi_updates_check, POST /api/v1/proxy/updates/pentagi/check, models.ProductUpdateRequest) carries, beside its state document, the cloud content the installation holds: components, at most four (models.MaxContentComponents), each a models.ContentComponentInfo. A request that reports none writes no components member at all, so a server that predates the member never sees it.

{"kind":"knowledge","file_hash":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08","tier":"pro","version":"1.4.0","package_id":41,"schema":1,"lease":"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWG","lease_not_after":"2026-12-20T10:00:00Z","errors":1,"failed":[{"kind":"agent_plugin","key":"nmap-recon","reason":"validation_failed"},{"kind":"report_template","key":"pentest-report","reason":"requires_newer_product"},{"kind":"agent_profile","key":"web-auditor","reason":"name_taken"}]}
{"kind":"knowledge","schema":1}
Field Meaning
kind the kind of content: knowledge (models.ContentKindKnowledge), the only one so far
file_hash the SHA-256 of the plain ZIP of the active package, 64 lowercase hex digits; absent when no package is active, as on a fresh install
tier the tier of the line of that package, a lowercase code: a letter, then at most 31 letters, digits, _ or -
version the version of the line: MAJOR.MINOR.PATCH and nothing else — no leading zeros, no prerelease, no build metadata, never latest
package_id the ID of the package
schema the highest package schema the build reads, at least 1; the server offers no package of a higher one
lease the sealed lease the installation uses now, base64: its .lease file, otherwise the lease slot of its envelope; 1 to 256 bytes (models.MaxContentLeaseBytes), 135 today, and only with a file_hash. A current answer to a component that carried one always carries a lease, so the exchange looks the same either way; a component without one gets a lease only when its lease_not_after is absent, past or near, and otherwise none. It counts toward the 3072 bytes of the component and Fit never trims it
lease_not_after when the lease of the active package ends (RFC 3339); the server cannot read a sealed lease, so it renews on this field, and only the lease itself bounds what opens
errors how many objects of the active package are invalid: those with the reasons validation_failed, hash_mismatch, reserved_id and profile_id_taken
failed the first 16 objects of the active package not taken (models.MaxContentFailures): kind (task_template, report_template, agent_profile, agent_plugin), key (at most 64 bytes of UTF-8) and reason — the four invalid ones above, requires_newer_product, unsupported_format and registry_limit for an object this build skips, and name_taken for one an object of the installation shadows

tier, version, package_id and lease describe the active package and need a file_hash; a file_hash alone is valid. A component is at most 3072 bytes (models.MaxContentComponentBytes) as json.Marshal writes it into the request: compact, with each <, > and & as the six bytes of its \u00XX escape, the same measure as info. The server measures the bytes of each component as they arrive, which are the same bytes. Four components at the limit and an info of 16 KiB stay under the server's body cap of 32 KiB.

A component is checked on its own, never as part of the request. ProductUpdateRequest.Valid counts the components and checks none of them; before sending, call Fit on each — it keeps the first 16 entries of failed, replaces invalid UTF-8 in their keys, cuts each key to 64 bytes on a rune boundary and drops entries from the end until the component fits — then Valid, and leave out a component that still fails rather than the whole check. The server answers a component it cannot read for that component alone, and the product half of its answer is unaffected.

Content Answer Format

The answer of the product check (models.ProductUpdateResponse) carries components: one models.ContentUpdate for each component of the request, in the order of the request, each with the kind it answers. An answer to a request without components writes no components member.

{"kind":"knowledge","action":"install","tier":"pro","version":"1.4.0","package_id":41,"file_hash":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08","size":3881000,"plain_size":3879731,"schema":1,"summary":"Recon plugins and the pentest report template","published_at":"2026-11-20T10:00:00Z"}
{"kind":"knowledge","action":"current","file_hash":"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08","lease":"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWG"}
{"kind":"knowledge","action":"unknown","reason":"not_published"}
Field Meaning
kind the kind of the component answered
action install, upgrade, downgrade, current or unknown — the vocabulary of models.ComponentAction
reason why, from models.ContentReason (below)
tier / version / package_id the line of the target package: a lowercase tier code, MAJOR.MINOR.PATCH, and the ID of the package
file_hash the SHA-256 of the plain ZIP of the target; on current, the hash the answer confirms
size the exact length of the envelope the download delivers, above plain_size and at most models.KnowledgeEnvelopeMaxSize: 64 MiB of ZIP, 16 KiB of chunk tags and 4 KiB for the header. Nothing else tells the length of a download, so count its bytes against this one
plain_size the length of the plain ZIP, 1 byte to 64 MiB (models.KnowledgePackageMaxSize)
schema the package schema of the target, at most the one the component reported
summary / published_at what the package brings, at most 200 runes (models.MaxContentSummaryRunes), and when it was published (RFC 3339)
lease the lease of the file the installation holds, on current alone and never with its dates: the lease the component brought, echoed, or a renewed one; the sealed record in base64, 135 bytes today (180 characters) and at most 256 (models.MaxContentLeaseBytes). The installation reads its dates from the lease itself, never from the answer

Which fields an answer carries depends on its action:

action reason Fields
install none the target in full — tier, version, package_id, file_hash, size, plain_size and schema — with summary and published_at optional
upgrade optional: withdrawn, tier_changed, reissued or new_version as install
downgrade optional: tier_changed; none for a same-line target below the reported package as install
current none file_hash, optional, and lease, optional and alone
unknown required: invalid_component, temporarily_unavailable, not_licensed, held, not_published, schema_unsupported or withdrawn none
Reason Meaning
invalid_component the server could not read the component
temporarily_unavailable the server failed to work out an answer; any doubt about the licence is answered with it, never with not_licensed
not_licensed the licence positively does not give this kind of content. It is the only answer that takes away the package an installation holds, and only once two such answers an hour or more apart agree
held the licence is held or not yet registered for content, and a download would be refused as well
not_published the line of the licence has no package at any schema; the package held lasts until its lease ends, and no lease is renewed
schema_unsupported every package of the line needs a higher schema, that is, a newer build
withdrawn the reported package was withdrawn: never activate that file again, not even to fall back to it. On an unknown the holder keeps the package, its lease not renewed, until its lease ends or the next package of the line replaces it
tier_changed the target is of another tier than the reported package: delete the files it replaces once it is active
reissued the target has the reported tier and version under another hash
new_version the target is a newer version of the reported line

On an upgrade the reason is the first in this order that applies, so a withdrawn package is reported as withdrawn even when a newer version replaces it; a downgrade takes only tier_changed. On an unknown with any reason but not_licensed, withdrawn included, keep the package the installation holds until its lease ends. ContentReason is closed and apart from ComponentReason: a server sends a new reason only to a build that knows it.

A current answer to a component that carried a lease always carries one: the same bytes while more than the renewal window remains, a renewed lease when the window is reached and the service can renew it, the same bytes again when it cannot, and never its dates, so every answer has the same shape and size (180 base64 characters). An echo inside the window is a normal answer, not an error. A component without a lease gets one only when the reported lease_not_after is absent, past or near, and the service can renew it; otherwise none. The lease is of the same file and lies outside what the chunks of the envelope authenticate, so the installation keeps the envelope and replaces only its lease, once the lease opens.

An answer is checked on its own. ProductUpdateResponse.Valid checks none of them: call ContentUpdate.Valid on each and ignore one that fails, keeping the product half of the answer and the other components. models.KnowledgeEnvelopeMaxSize also bounds an envelope uploaded to an installation by hand.

Knowledge Package Download

The client of the content package downloads the package a content answer offers in one call, knowledge_download (GET /api/v1/proxy/knowledge/download). Its query is models.KnowledgeDownloadRequest: hash, the file_hash of the answer, and schema, the schema the component of that check reported, which is not the schema of the answer. The server works the target out again from the licence and the schema sent and serves the hash of that target alone, so a hash it no longer offers, or never offered to the licence, is refused as Knowledge.NotCurrent.

client, err := content.New("update.pentagi.com",
    sdk.WithClient("MySecTool", "1.0.0"),
    sdk.WithInstallationID(system.GetInstallationID()),
    sdk.WithLicenseKey(licenseKey),
)
var update models.ContentUpdate // the answer to a component that reported schema
if err == nil {
    err = client.Download(ctx, update, schema, file) // put the file in place only on nil
}

Download takes an install, upgrade or downgrade answer that passes ContentUpdate.Valid and a schema of at least 1, and refuses anything else as sdk.ErrInvalidRequest before it asks for anything.

What arrives is the envelope of the package, sealed for the licence. The encrypted response carries no Content-Length, so the size of the answer is the only length the download has: Download counts the bytes as they arrive, a byte past size never reaches the caller's writer, and a download of any other length is content.ErrSizeMismatch. After any error the writer holds a partial envelope: download into a file that is renamed into place only after Download returned nil, and delete it otherwise. The endpoint serves no ranges, so a download cut short starts again from the first byte. The hash and the signature belong to the plain ZIP inside, so Download checks neither: verify them once the envelope is opened (see Knowledge Package Signature).

The call is made once, whatever sdk.WithMaxRetries the caller passes: content.New adds sdk.WithMaxRetries(1) after its options. Every attempt takes a ticket that the rate limits of the licence count, so a refusal the SDK would retry, such as Internal or a general rate limit, reaches the caller, who asks again at its next check. The refusals of the download itself are listed under Error Codes. The endpoint counts against a quota of the licence only for a download served in full, and has rate limits of its own per licence: after a *sdk.RateLimitError or a *sdk.QuotaError, ask again no sooner than sdk.RetryAfterOf(err). A licence the API does not serve is refused, either as Forbidden or as QuotaBlocked.

examples/knowledge-download makes the check and the download from the command line. It sends one knowledge component, as a fresh installation or for the active package -hash names, prints the answer, downloads what an install, upgrade or downgrade offers into -out and writes the renewed lease of a current answer raw into <out>.lease. -download-hash asks for a hash without checking first, and -throttle takes the envelope at most that many bytes a second.

Knowledge Package Signature

A knowledge package is a ZIP signed once, by the release key that signs installer packages and license modules, and delivered inside an envelope encrypted for one licence. The envelope header carries the 64-byte signature and the 8-byte ID of the key that made it. The signature covers the plain ZIP, so the installation verifies it after decrypting:

sum := sha512.Sum512(plainZIP)
err := models.VerifyKnowledgePackage(sum[:], signature, keyID) // both as the envelope header carries them
switch {
case errors.Is(err, models.ErrPackageSignedByAnotherKey):
    // signed by a release key this build does not carry: the key was replaced
case err != nil:
    // models.ErrPackageSignatureInvalid: not the package that was signed
}
Function Meaning
models.KnowledgePackageDigest(sha512) the digest the signature covers: SHA-512("pentagi/knowledge-package/v1\x00" ‖ SHA-512(zip)); the context keeps a package's signature apart from a license module's, and from an installer package's — signed over its bare SHA-512 — but for an installer of exactly 93 bytes, this context followed by a SHA-512
models.ReleaseKeyID() the ID of the release key compiled into the SDK: the first 8 bytes of the SHA-256 of its public key, 57ae16906139e561 today; the server records it for every package it signs, and writes it into the envelope header
models.VerifyKnowledgePackage(sha512, signature, keyID) verifies the signature over that digest under the compiled release key

The signature is verified with the one release key compiled into the SDK, never with a key chosen by the header: the key ID is not looked at when the signature verifies, and only names a refusal. A refusal is models.ErrPackageSignedByAnotherKey when the key ID is not models.ReleaseKeyID() — the release key was replaced, and the package verifies only under a build that carries the new one — and models.ErrPackageSignatureInvalid when it is, or when the SHA-512 or the signature is not 64 bytes long. Every refusal matches models.ErrPackageSignatureInvalid. The release key changes only when it is compromised; there is no second key to accept in the meantime.

Support Issue Format

The endpoint support_issues (POST /api/v1/proxy/support/issues) creates an issue from a models.SupportIssueRequest and answers 201 with its issue_id (models.SupportIssueResponse) — the ID every later call of the issue names. An issue is read only by its ID; there is no list of them.

Limits. A request past any of them is refused, and nothing is created. SupportIssueRequest.Valid checks the lines and error_details, which no tag can state; the size of the body is the sender's to check after encoding it.

Limit Value Refused as
the body of the request models.MaxSupportIssueRequestBytes: 2 MiB (2097152 bytes) Support.InvalidRequest
the lines of logs, of all components together models.MaxSupportIssueLogLines: 2000 Support.InvalidData
one line of logs 1–8192 characters Support.InvalidData
error_details, its value as json.Encoder writes it after SetEscapeHTML(false), numbers as they were written models.MaxSupportIssueDetailsBytes: 256 KiB (262144 bytes) Support.InvalidData

Error Details. error_details is any JSON value: the server keeps its value with the issue, and other clients send forms of their own. A document of the schema models.SupportIssueDetails is what the support assistant reads as the context of the issue — what the user wrote about the problem and what the product could tell about itself and the flow concerned; a value of any other form is kept and tells the assistant nothing. The schema is versioned by schema (now 1) and grows by adding fields: a reader skips the fields it does not know, and a document of a later schema is read by the fields of schema 1.

Part Fields Meaning
top level schema (at least 1), description (at most 4000 characters), collected_at The version of the schema; what the user wrote about what does not work — a report, not a question to the assistant; when the document was collected
product (always) version (a semantic version; 0.0.0 for a build that has none), develop, os, arch, binary_hash, uptime_seconds, debug, docker_inside, default_image, multi_tenant The process of the product; os and arch are the platform it was built for — always linux for a product in Docker
host docker_version, os, os_type, architecture, kernel, cpus, memory_bytes The machine the Docker daemon of the product runs on, as the daemon describes it; the name of the host is not part of it
license tier, state, features (as in Licence Status Format), expires_at, checked_at The licence as the product last read its status; the key is not part of it, masked or not; checked_at is absent before the first answer
providers[] (at most 32) ref, type, source, created_at, models The LLM providers the product can use, without their names, addresses or keys: ref (p1, p2, …) is what a flow and the use of a model point to; source is env or user; created_at is set for a provider a user added; models maps a type of agent to its model
installation embedding_provider, oauth[], features (name → boolean), counts (name → number) What the installation is made of; the use of tokens over the whole installation is not part of it
flow id, status, language, provider_ref, provider_type, model, created_at, updated_at, time_budget_seconds, max_subtasks, max_subagents; tasks, subtasks, assistants (each total and by_status); usage (in, out, cache_in, cache_out, cost_in, cost_out); toolcalls (total, failed, duration_seconds, by_function[] of at most 10, each name, is_agent, count, failed); usage_by_model[] of at most 10 (model, provider_ref, agents[] and the six numbers of usage); usage_by_agent[] (agent and the six numbers); chains (reflector, tool_call_fixer, subagents, each total and failed); container (image, status, live: running, stopped or unknown); errors[] of at most 30 (kind, name, status, error_class, result_length, created_at) The flow the issue is reported for, when there is one. provider_ref is the ref of its provider in providers, null when that provider is gone, never absent. No title, input or result of the flow travels: a failure is told by its kind, its status, the length of its result and error_class, a word of a closed vocabulary the product infers from the result
logs (always) available, lines, matched, files, from, to, truncated, dropped_long, filter (scope, admin, redacted_keys[]), counts (name → number) The lines of logs sent with the issue: lines sent and matched before repeats were folded, the times of the first and the last, how they were chosen — scope the flow they were chosen for, admin a reporter who may send the lines of every user, redacted_keys the keys whose values were replaced by their length — and the counts of the patterns of trouble by name
findings[] (at most 64) code, severity (info, warning, error), detail The known problems the product detected in what it collected
skipped[] (at most 32) names The parts the product failed to collect or could not collect in time; the document is built from the rest

A part not marked "(always)" is absent when there is nothing to tell, and so are the lists, the maps, the times and filter.scope (lines chosen for no flow) that the model marks omitempty; every other field is written, zero or not. A document of only the parts that are always there:

{"schema":1,"description":"The terminal of a flow never starts.","collected_at":"2026-10-16T10:00:00Z","product":{"version":"1.2.0","develop":false,"os":"linux","arch":"amd64","binary_hash":"","uptime_seconds":0,"debug":false,"docker_inside":false,"default_image":"","multi_tenant":false},"logs":{"available":false,"lines":0,"matched":0,"files":0,"truncated":false,"dropped_long":0,"filter":{"admin":false}}}

The document with every part present is goldenSupportIssueDetails in models/contract_test.go.

Anonymisation. Free text is anonymised by the sender: pass a pointer to the document to Anonymize of the anonymizer package, as for the logs. The fields of closed vocabularies, versions and references (schema, version, type, source, status, ref, provider_ref, agent, code, severity, …) carry anonymizer:"skip" and stay as a reader matches them; numbers, booleans and the keys of maps — names of closed sets — are never touched. No field is []byte or json.RawMessage: the walk leaves their bytes as they are, and raw text in them would pass unmasked.

Sending. Call SupportIssueDetails.Valid after anonymising — a marker can be longer than the text it replaces, and the description is bounded as it is sent — then SupportIssueRequest.Valid for the limits of the server. Write the request with a json.Encoder after SetEscapeHTML(false): json.Marshal writes each <, > and & of tool output as six bytes, which grows the body toward its limit; error_details is measured without them either way.

Support Issue Status Format

The endpoint support_issue_status (GET /api/v1/proxy/support/issues/:issueID/status, no request body) answers with what runs on an issue, in the envelope of every JSON answer. The ID of the issue is the argument of the path, so the call is a CallReqWithArgsRespBytes; the endpoint code is the Name of the call and is not the caller's to choose. Read the answer with ParseEnvelope, then Valid:

var issueStatus sdk.CallReqWithArgsRespBytes
err := sdk.Build([]sdk.CallConfig{{
    Calls:  []any{&issueStatus},
    Host:   "support.pentagi.com",
    Name:   "support_issue_status",
    Path:   "/api/v1/proxy/support/issues/:issueID/status",
    Method: sdk.CallMethodGET,
}}, options...)

body, err := issueStatus(ctx, []string{issueID.String()})
status, err := models.ParseEnvelope[models.SupportIssueStatusResponse](body)
err = status.Valid() // refuse what is not a status rather than wait on it
{"status":"processing"}
{"status":"processed","updated_at":"2026-10-16T10:00:00.123456Z"}
Field Meaning
status processing — the server is working through the lines of logs the issue was reported with; processed — nothing runs, and a question may be sent; answering — the assistant is answering a question of the issue
updated_at when the conversation of the issue last changed — a question asked, a call of the model — to the microsecond; absent before the first question. The answer of a turn is written after its last move, before the status returns to processed

An issue is processing from its creation while there are lines of logs to work through, and processed from the start when there are none. Processing ends in processed whatever its outcome: there is no failed status, and the assistant answers from what was found. A question moves the issue from processed to answering and back; there is no move from processing to answering. The status is processed again before the last frame of the answer is written, so a status read after the done or the error of one's own stream does not show that question still running. The status is kept by the server, not by a connection: a turn this caller did not send reads answering too, and after a stream that was cut the status tells when the turn ended.

Compare updated_at with the one read before: when it moved, the conversation changed — read it again, and once more when the status leaves answering, since the answer of a turn is written after the last move of updated_at — from the endpoint support_issue_messages (GET /api/v1/proxy/support/issues/:issueID/messages, bound the same way), which answers models.SupportIssueMessagesResponse: the question (input), the steps of the assistant and its answer (done), each with created_at, and [] before the first question, never null. A streamed answer carries the answer as content and update events, not as a done message; the messages hold it once the turn ended.

{"messages":[{"type":"input","message":"Why does the terminal of flow 12 never start?","created_at":"2026-10-16T10:01:00Z"},{"type":"search","message":"searching FAQ for terminal startup errors","created_at":"2026-10-16T10:01:02Z"},{"type":"done","message":"The image of the flow could not be pulled; check the registry the installation uses.","created_at":"2026-10-16T10:01:30.5Z"}]}

A question (support_investigate) is taken only while the issue is processed, one at a time whoever sends it; at any other time it is refused before the stream begins with Support.Busy (HTTP 409), and the refusal is not charged to a quota: wait for processed and send the question again. An issue belongs to the licence that created it, not to the installation that sent it: its status, its messages and its questions are open to every installation of that licence, also after the key of the licence was regenerated, and an issue of another licence is Support.NotFound (HTTP 404), as one that does not exist. The support endpoints serve a licence whose features include support; another caller is refused, either as Forbidden or as QuotaBlocked: read both as support not served, not as a failure to retry.

The status has rate limits of its own per licence and, on some tiers, a quota of its own, apart from those of the questions and the messages; the licence status does not report it. Poll it while an issue is processing or answering — every 30 seconds is enough — and seldom otherwise; after a *sdk.RateLimitError or a *sdk.QuotaError stop polling until sdk.RetryAfterOf(err). The conversation does not depend on the status: a question may be sent while the status cannot be read, and the server answers Support.Busy if it comes too early.

Streaming Encryption

Request and response bodies use AES-GCM chunk encryption:

┌─────────────────┬───────┬─────────────────┐
│ Length (4 bytes)│ Nonce │ GCM Ciphertext  │
│ (Big Endian)    │       │ (Data + Auth)   │
└─────────────────┴───────┴─────────────────┘

Features:

  • Configurable Chunks: Optimized chunk size for different workloads
  • Authenticated Encryption: Tampering detection per chunk
  • Streaming Processing: No memory accumulation for large files
  • Random Nonces: Unique nonce per chunk for GCM security

PoW Signature Format

Validation Process:

  1. Nonce Verification: XOR unmask with installation ID
  2. Timestamp Check: The time of the request must lie within the window the server accepts, otherwise RequestClockSkew
  3. Content Length: Match actual request body size
  4. Integrity Check: CRC32 validation of signature payload
  5. AES Decryption: CBC decrypt with PoW-derived key
  6. Binding (version 2): the signature also binds the method, the URL, the nonce and the installation ID

Client-Side Anonymization

A client may anonymise the data it sends with the anonymizer package; the example below does so for support and investigation requests:

Implementation:

type Client struct {
    errorReport  sdk.CallReqBytesRespBytes
    issueCreate  sdk.CallReqBytesRespBytes
    anonymizer   anonymizer.Anonymizer  // applied by the application, as in the examples
}

// The example application anonymises before sending and stops if that fails
func (c *Client) ReportError(ctx context.Context,
    component models.ComponentType, errorDetails map[string]any) error {

    if err := c.anonymizer.Anonymize(&errorDetails); err != nil {
        return fmt.Errorf("failed to anonymize error details: %w", err)
    }
    // ... proceed with anonymized data
}

Pattern Recognition:

  • Regex Engine: go-re2 with experimental.Set for efficient multi-pattern matching
  • Pattern Database: 3 categories (General, PII, Secrets) with comprehensive coverage
  • Structural Processing: Reflection-based deep anonymization of complex Go structures
  • Tag-Based Control: anonymizer:"skip" struct tags preserve critical system identifiers

Anonymization Examples:

// before anonymization:
"message": "Failed to connect ssh://admin@company.com with API key sk-1234567890abcdef"
"database_url": "postgres://user:password123@db.internal:5432/app"
"target_host": "192.168.1.100"

// after anonymization:
"message": "Failed to connect §*SSH Connection*§ with API key §*****api_key*****§"
"database_url": "§*****Database Connection Generic*****§"
"target_host": "§***ipv4****§"

For complete implementation examples, see the examples/ directory.