runtime

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package runtime implements attack-path execution detection: observed agent actions are matched against the graph's known attack paths, and alerts fire when an agent's behavior advances along a dangerous path (PRD section 68 - "EDR for AI agents").

Index

Constants

View Source
const (
	LevelHigh     = "HIGH"
	LevelCritical = "CRITICAL"
	LevelComplete = "COMPLETE"
)

Alert levels.

Variables

This section is empty.

Functions

func FormatAlert

func FormatAlert(a Alert) string

FormatAlert renders one alert in the PRD section 68 style.

Types

type Alert

type Alert struct {
	Level     string    `json:"level"`
	PathID    string    `json:"path_id"`
	Agent     string    `json:"agent"`
	Target    string    `json:"target"`
	Stages    int       `json:"stages_observed"`
	Total     int       `json:"total_stages"`
	NextNode  string    `json:"next_node,omitempty"`
	Risk      int       `json:"risk"`
	Severity  string    `json:"severity"`
	Timestamp time.Time `json:"timestamp"`
}

Alert is raised when observed events advance an attack path.

type Detector

type Detector struct {
	// contains filtered or unexported fields
}

Detector matches event streams against known attack paths. It supports both batch processing (Process) and incremental streaming (ProcessEvent), which powers live tailing.

func New

func New(g *graph.Graph, opts paths.Options) *Detector

New returns a detector for a graph.

func (*Detector) Init added in v0.5.0

func (d *Detector) Init() error

Init enumerates attack paths and prepares per-path state. Called lazily by ProcessEvent on first use.

func (*Detector) Process

func (d *Detector) Process(events []Event) ([]Alert, error)

Process consumes a batch of events in order and returns alerts.

func (*Detector) ProcessEvent added in v0.5.0

func (d *Detector) ProcessEvent(ev Event) ([]Alert, error)

ProcessEvent consumes one event and returns any alerts it triggered. Safe to call concurrently with nothing else; designed for sequential streaming.

type Event

type Event struct {
	Timestamp time.Time      `json:"timestamp"`
	Agent     string         `json:"agent"`
	Action    string         `json:"action,omitempty"` // tool_call, mcp_call, ...
	Tool      string         `json:"tool,omitempty"`   // tool or MCP server name
	Target    string         `json:"target,omitempty"` // target node id or name
	Detail    map[string]any `json:"detail,omitempty"`
}

Event is one observed agent action (e.g. from an MCP gateway log, audit log, or agent telemetry).

type Summary

type Summary struct {
	TotalAlerts int
	Complete    int
	Critical    int
	High        int
	PathsAtRisk map[string]int
}

Summary aggregates alerts for reporting.

func Summarize

func Summarize(alerts []Alert) *Summary

Summarize aggregates a set of alerts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL