Skip to main content

Overview

Profile types represent runtime execution profiles captured by Garnet agents, primarily from GitHub Actions workflows.

Profile

Represents a runtime profile with execution data.
type Profile struct {
    RunID     string          `json:"runID" db:"run_id"`
    AgentID   string          `json:"agentID" db:"agent_id"`
    Data      ongoing.Profile `json:"data" db:"data"`
    CreatedAt time.Time       `json:"createdAt" db:"created_at"`
    UpdatedAt time.Time       `json:"updatedAt" db:"updated_at"`
}
runID
string
required
Unique run identifier (typically GitHub Actions run ID)
agentID
string
required
ID of the agent that captured this profile
data
ongoing.Profile
required
Profile data in ashkaal format
createdAt
time.Time
required
When the profile was created
updatedAt
time.Time
required
When the profile was last updated

CreateProfile

Request to create a new profile.
type CreateProfile struct {
    ongoing.Profile
}
The profile data is embedded from the ongoing.Profile type which contains:
  • Execution scenarios (GitHub, Kubernetes, etc.)
  • Process information
  • Network flows
  • File access patterns

Methods

  • Validate() error - Validates profile data
  • SetAgentID(agentID string) - Sets the agent ID (populated from JWT)
  • AgentID() string - Returns the agent ID
  • RunID() string - Returns the run ID from GitHub scenario

Validation Rules

  • run_id must be present in the GitHub scenario data
  • Agent ID is populated from JWT token

CreatedProfile

Response after creating a profile.
type CreatedProfile struct {
    Created   bool      `json:"created" db:"created"`
    CreatedAt time.Time `json:"createdAt" db:"created_at"`
    UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
created
bool
required
True if profile was newly created, false if it was updated (upsert)
createdAt
time.Time
required
When the profile was created
updatedAt
time.Time
required
When the profile was last updated

ListProfiles

Request to list profiles with filtering and pagination.
type ListProfiles struct {
    AgentID   *string
    ProjectID *string
    TimeStart *time.Time
    TimeEnd   *time.Time
    PageArgs  CursorPageArgs
}

Methods

  • Validate() error - Validates filter parameters

Validation Rules

  • Either agentID or projectID must be provided
  • IDs must be in valid format if provided
  • timeStart must be before timeEnd if both are provided
  • Pagination args must be valid

Example Usage

Creating a Profile

profile := types.CreateProfile{
    Profile: ongoing.Profile{
        Scenarios: ongoing.Scenarios{
            GitHub: ongoing.GitHub{
                RunID: "12345678",
                Repository: "owner/repo",
                Workflow: "ci.yml",
            },
        },
        // Additional profile data...
    },
}

// Agent ID is set from JWT token
profile.SetAgentID("agent_abc123")

if err := profile.Validate(); err != nil {
    // Handle validation error
}

Listing Profiles

listReq := types.ListProfiles{
    ProjectID: stringPtr("proj_123"),
    PageArgs: types.CursorPageArgs{
        First: uintPtr(50),
    },
}

if err := listReq.Validate(); err != nil {
    // Handle validation error
}

Notes

  • Profiles use an upsert pattern - creating a profile with an existing run ID will update the existing profile
  • The ongoing.Profile type from the ashkaal library contains the actual profile data structure
  • Profiles are primarily used for GitHub Actions workflows but the structure supports other scenarios
  • Profile data includes comprehensive execution information useful for security analysis and baselining

Build docs developers (and LLMs) love