computeid

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 15 Imported by: 0

README

ComputeID Go SDK

Cryptographic identity for AI compute infrastructure and agentic AI systems — for Go.

Every GPU needs a passport. Every AI agent needs an identity.

Go Reference

A pure-stdlib Go port of the Python ComputeID SDK, with the server-backed /v1/agents/* REST surface wired up from day one.


What ComputeID is

Two things:

  1. DeviceID — cryptographic passports for GPUs, servers, and compute hardware.
  2. AgentID — cryptographic passports for AI agents and autonomous systems.

Think of it as a passport system for AI infrastructure: every device and every agent gets a unique cryptographic identity, a certificate of what it is allowed to do, and an immutable audit trail of everything it has done.


Install

go get github.com/ComputeID/computeid-go

Requires Go 1.22+. The SDK package itself has zero third-party dependencies.

Not published yet? See PUBLISHING.md for how to push to the org, stage on a personal account first, or wire up a local-only go.mod replace for development.


Run a local API server

The SDK ships with a Postgres-backed implementation of the ComputeID API so you can develop, test, and run examples without hitting api.aicomputeid.com. See server/README.md for details.

# Option A: against an existing Postgres
createdb computeid
export DATABASE_URL=postgres://localhost/computeid?sslmode=disable
export JWT_SECRET=local-dev-secret
go run ./cmd/computeid-server

# Option B: full bundle (Postgres + server) via Docker
docker compose up --build

# Then point the SDK at it
export COMPUTEID_API_BASE=http://localhost:8088
go run ./examples/serverbacked

Quick start

Agent passport (local model)
import "github.com/ComputeID/computeid-go"

passport, err := computeid.IssueAgentPassportQuick(
    "ResearchAgent", "Acme Corp", "admin@acme.com",
    "claude-sonnet-4-6", computeid.TrustStandard,
)
if err != nil { log.Fatal(err) }

if passport.IsTrusted() {
    runYourAgent(passport)
}

// Gate by capability — denied actions are logged automatically.
if passport.VerifyAction(computeid.ActionBrowseWeb) {
    doWebSearch()
}

passport.LogAction("web_search", map[string]any{"query": "market research"}, computeid.OutcomeSuccess)

passport.Revoke("Unexpected behaviour detected")
Server-backed agent passport (REST)
c := computeid.NewClient(computeid.WithAPIKey(os.Getenv("COMPUTEID_API_KEY")))

sp, err := c.RegisterAgent(ctx, computeid.AgentRegistration{
    Name:         "ResearchAgent",
    Organization: "Acme Corp",
    Capabilities: []string{"read", "web_browse", "api_call"},
})

// Authoritative check: active AND signature_valid.
v, _ := c.VerifyAgent(ctx, sp.PassportID)
if !v.IsTrusted() { return errors.New("not trusted") }

cap, _ := c.CheckCapability(ctx, sp.PassportID, "web_browse")
if cap.Granted {
    doWork()
    c.LogAgentAction(ctx, sp.PassportID, computeid.LogActionRequest{
        Action: "web_search",
        Details: map[string]any{"query": "GPU prices"},
        Outcome: "success",
    })
}

c.RevokeAgent(ctx, sp.PassportID, "Task complete")
Register a GPU
dev, err := computeid.RegisterGPU(ctx, "NVIDIA A100", "192.168.1.10", apiKey)
fmt.Println(dev.DeviceCode) // GPU-001
fmt.Println(dev.IsValid())  // true once admin approves

Trust levels

Level Preset Use case
restricted RestrictedCapabilities() Read only, human oversight required
standard StandardCapabilities() Most production agents
elevated ElevatedCapabilities() Code execution, spawn child agents
autonomous AutonomousCapabilities() Full autonomy — use with care

Or build a custom set:

caps := computeid.AgentCapabilities{
    CanBrowseWeb:      true,
    CanCallAPIs:       true,
    CanExecuteCode:    false,
    TrustLevel:        computeid.TrustStandard,
    HumanInLoop:       true,
    MaxActionsPerHour: 100,
    AllowedDomains:    []string{"example.com"},
}

Multi-agent trust chain

orchestrator, _ := computeid.IssueAgentPassport(computeid.IssueOptions{
    AgentName:    "OrchestratorAgent",
    AgentType:    "orchestrator",
    OwnerOrg:     "Acme Corp",
    OwnerEmail:   "admin@acme.com",
    Capabilities: computeid.ElevatedCapabilities(),
    Model:        "claude-opus-4-7",
})

child, err := computeid.IssueAgentPassport(computeid.IssueOptions{
    AgentName:      "SubAgent",
    AgentType:      "worker",
    OwnerOrg:       "Acme Corp",
    OwnerEmail:     "admin@acme.com",
    Capabilities:   computeid.StandardCapabilities(),
    Model:          "claude-sonnet-4-6",
    ParentPassport: orchestrator, // fails unless orchestrator has CanSpawnAgents
})

Org-wide registry

office := computeid.NewPassportOffice("Acme Corp", "")
office.RegisterAgent(orchestrator)
office.RegisterAgent(child)
office.RegisterDevice(dev)

if office.IsTrusted(child.AgentID) {
    allowAccess()
}

report := office.AuditReport()
fmt.Println(report.ActiveAgents, "/", report.TotalAgents)

TrustRegistry is a type alias for PassportOffice to match the Python SDK.


Gating functions with a passport

Generic helper that wraps any func(*AgentPassport, A) (R, error) with the same checks the Python @requires_passport decorator runs:

search := computeid.RequirePassport(computeid.ActionBrowseWeb,
    func(p *computeid.AgentPassport, q string) ([]string, error) {
        return doSearch(q), nil
    })

results, err := search(passport, "GPU rental prices")

Returns ErrAuthentication if the passport is missing or untrusted, ErrTrust if the capability is denied. Match with errors.Is.


Errors

All errors wrap typed sentinels you can match with errors.Is:

_, err := computeid.IssueAgentPassport(opts)
switch {
case errors.Is(err, computeid.ErrAuthentication):
    // 401/403 from the API
case errors.Is(err, computeid.ErrTrust):
    // capability or trust-chain violation
case errors.Is(err, computeid.ErrRegistration):
    // bad input or server registration failure
case errors.Is(err, computeid.ErrAPI):
    // generic transport / decode failure
    var apiErr *computeid.APIError
    if errors.As(err, &apiErr) {
        log.Println(apiErr.StatusCode, apiErr.Endpoint, apiErr.Message)
    }
}

Examples

Example What it shows
examples/basic Local-model passport, trust chain, registry, audit log
examples/serverbacked Live /v1/agents/* REST flow against api.aicomputeid.com
examples/devices Register and authenticate a GPU

Run any example:

go run ./examples/basic

Mapping from the Python SDK

Python Go
AgentCapabilities(...) AgentCapabilities{...}
AgentCapabilities.standard() StandardCapabilities()
AgentPassport.issue(...) IssueAgentPassport(IssueOptions{...})
passport.log_action(a, d, o) passport.LogAction(a, d, o)
passport.verify_action(a) passport.VerifyAction(ActionBrowseWeb)
passport.is_trusted() passport.IsTrusted()
passport.revoke(reason) passport.Revoke(reason)
passport.export() / .load(s) passport.Export() / LoadAgentPassport(b)
DevicePassport.register(...) RegisterDevice(ctx, req, apiKey) or Client.RegisterDevice
DevicePassport.authenticate(...) AuthenticateDevice(ctx, code)
PassportOffice(...) NewPassportOffice(name, apiKey)
TrustRegistry type alias TrustRegistry = PassportOffice
@requires_passport(capability=...) RequirePassport[A,R](capability, fn)
issue_agent_passport(...) IssueAgentPassportQuick(...)
register_gpu(...) RegisterGPU(ctx, name, ip, apiKey)

Additions over the Python SDK (1.1.0):

  • Server-backed /v1/agents/* REST clientRegisterAgent, VerifyAgent, CheckCapability, LogAgentAction, ListAgentActions, RevokeAgent, ListAgents. The Python SDK currently runs AgentPassport offline; the Go SDK ships both modes.
  • context.Context on every network call.
  • Typed errors (errors.Is/errors.As) instead of string-keyed exceptions.
  • Pluggable *http.Client, base URL, and User-Agent via functional options.

License

MIT. Copyright 2026 ComputeID / TrustedAI Compute.

Documentation

Overview

Package computeid is the Go SDK for ComputeID — cryptographic identity for AI compute infrastructure and agentic AI systems.

Every GPU needs a passport. Every AI agent needs an identity.

Three core abstractions:

  • AgentPassport — local cryptographic passport for an AI agent.
  • DevicePassport — server-issued passport for a GPU/server.
  • PassportOffice — organisation-wide registry and audit trail.

Two server-backed REST surfaces, both exposed through *Client:

  • /v1/agents/* — issue, verify, log, revoke server-side agent passports.
  • /api/devices/* — register and authenticate devices.

Quickstart — local agent passport (no network):

caps := computeid.StandardCapabilities()
passport, err := computeid.IssueAgentPassport(computeid.IssueOptions{
    AgentName:    "ResearchAgent",
    AgentType:    "researcher",
    OwnerOrg:     "Acme Corp",
    OwnerEmail:   "admin@acme.com",
    Capabilities: caps,
    Model:        "claude-sonnet-4-6",
})
if passport.VerifyAction(computeid.ActionBrowseWeb) {
    // run the agent
}

Quickstart — register a GPU:

dev, err := computeid.RegisterGPU(ctx, "NVIDIA A100", "192.168.1.10", apiKey)

Quickstart — server-backed agent passport:

client := computeid.NewClient(computeid.WithAPIKey(apiKey))
sp, err := client.RegisterAgent(ctx, computeid.AgentRegistration{
    Name:         "ResearchAgent",
    Organization: "Acme Corp",
    Capabilities: []string{"read", "web_browse", "api_call"},
})

Docs: https://compute-id.com GitHub: https://github.com/ComputeID/computeid-sdk

Index

Constants

View Source
const (
	DefaultAPI = "https://api.aicomputeid.com"
	SDKVersion = "1.0.0"
)

Default API endpoints. Both can be overridden per-Client via options.

Variables

View Source
var (
	ErrComputeID      = errors.New("computeid")
	ErrAuthentication = errors.Join(ErrComputeID, errors.New("authentication"))
	ErrRegistration   = errors.Join(ErrComputeID, errors.New("registration"))
	ErrRevocation     = errors.Join(ErrComputeID, errors.New("revocation"))
	ErrTrust          = errors.Join(ErrComputeID, errors.New("trust"))
	ErrCapability     = errors.Join(ErrComputeID, errors.New("capability"))
	ErrAPI            = errors.Join(ErrComputeID, errors.New("api"))
)

Functions

func AuthenticateDevice

func AuthenticateDevice(ctx context.Context, deviceCode string) (string, error)

AuthenticateDevice exchanges a device_code for a short-lived access token against the default API.

func RequirePassport

func RequirePassport[A any, R any](capability Action, fn func(p *AgentPassport, arg A) (R, error)) func(p *AgentPassport, arg A) (R, error)

RequirePassport wraps a function with passport + capability checks. The wrapper returns an error matching ErrAuthentication / ErrTrust if the passport is nil, not trusted, or lacks the required capability. On success it logs the call as an action on the passport and invokes fn.

Example:

search := computeid.RequirePassport(computeid.ActionBrowseWeb,
    func(passport *computeid.AgentPassport, query string) (string, error) {
        return doSearch(query), nil
    })
res, err := search(passport, "GPU rental prices")

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Endpoint   string
}

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

type Action

type Action string

Action is the canonical name of an action that AgentPassport.VerifyAction gates on. Pass any of these to VerifyAction or check raw via the Can* fields directly.

const (
	ActionBrowseWeb      Action = "browse_web"
	ActionExecuteCode    Action = "execute_code"
	ActionAccessFiles    Action = "access_files"
	ActionCallAPI        Action = "call_api"
	ActionSpawnAgent     Action = "spawn_agent"
	ActionAccessDatabase Action = "access_database"
	ActionSendEmail      Action = "send_email"
)

type ActionOutcome

type ActionOutcome string

ActionOutcome is the result label written into the audit trail.

const (
	OutcomeSuccess ActionOutcome = "success"
	OutcomeBlocked ActionOutcome = "blocked"
	OutcomeFailure ActionOutcome = "failure"
)

type AgentAuditEntry

type AgentAuditEntry struct {
	Summary
	AuditLog []AuditEntry `json:"audit_log"`
}

AgentAuditEntry is a per-agent record in the audit report.

type AgentCapabilities

type AgentCapabilities struct {
	CanBrowseWeb      bool           `json:"can_browse_web"`
	CanExecuteCode    bool           `json:"can_execute_code"`
	CanAccessFiles    bool           `json:"can_access_files"`
	CanCallAPIs       bool           `json:"can_call_apis"`
	CanSpawnAgents    bool           `json:"can_spawn_agents"`
	CanAccessDatabase bool           `json:"can_access_database"`
	CanSendEmail      bool           `json:"can_send_email"`
	MaxActionsPerHour int            `json:"max_actions_per_hour"`
	TrustLevel        TrustLevel     `json:"trust_level"`
	HumanInLoop       bool           `json:"human_in_loop"`
	AllowedDomains    []string       `json:"allowed_domains,omitempty"`
	AllowedTools      []string       `json:"allowed_tools,omitempty"`
	MaxTokenBudget    *int           `json:"max_token_budget,omitempty"`
	CustomPermissions map[string]any `json:"custom_permissions,omitempty"`
}

AgentCapabilities declares what an AI agent is permitted to do. Embed one in every AgentPassport. The zero value is safe but grants nothing useful; prefer one of the preset constructors.

func AutonomousCapabilities

func AutonomousCapabilities() AgentCapabilities

AutonomousCapabilities — full autonomy; use with care.

func CapabilitiesFor

func CapabilitiesFor(level TrustLevel) AgentCapabilities

CapabilitiesFor returns the preset matching a trust level, defaulting to StandardCapabilities for any unknown level.

func ElevatedCapabilities

func ElevatedCapabilities() AgentCapabilities

ElevatedCapabilities — code execution, can spawn child agents.

func RestrictedCapabilities

func RestrictedCapabilities() AgentCapabilities

RestrictedCapabilities — minimal permissions, human oversight required.

func StandardCapabilities

func StandardCapabilities() AgentCapabilities

StandardCapabilities — web browsing, API calls, file read.

func (AgentCapabilities) Allows

func (c AgentCapabilities) Allows(a Action) bool

Allows reports whether the capability set grants a given action.

type AgentPassport

type AgentPassport struct {
	AgentID       string            `json:"agent_id"`
	AgentName     string            `json:"agent_name"`
	AgentType     string            `json:"agent_type"`
	OwnerOrg      string            `json:"owner_org"`
	OwnerEmail    string            `json:"owner_email"`
	Model         string            `json:"model"`
	Version       string            `json:"version"`
	Status        AgentStatus       `json:"status"`
	TrustLevel    TrustLevel        `json:"trust_level"`
	ParentAgentID string            `json:"parent_agent_id,omitempty"`
	IssuedAt      time.Time         `json:"issued_at"`
	ExpiresAt     time.Time         `json:"expires_at"`
	RevokedAt     *time.Time        `json:"revoked_at,omitempty"`
	RevokeReason  string            `json:"revoke_reason,omitempty"`
	Capabilities  AgentCapabilities `json:"capabilities"`
	Fingerprint   string            `json:"fingerprint"`
	// contains filtered or unexported fields
}

AgentPassport is a local cryptographic passport for an AI agent. It carries who built it, what it may do, what it has done, and whether it is currently trusted. AgentPassports are mutated only through the methods on this type — the audit log in particular is append-only.

func IssueAgentPassport

func IssueAgentPassport(opts IssueOptions) (*AgentPassport, error)

IssueAgentPassport mints a new AgentPassport. When a ParentPassport is provided it must be trusted and have CanSpawnAgents=true, mirroring the Python SDK's parent-child trust chain.

func IssueAgentPassportQuick

func IssueAgentPassportQuick(agentName, ownerOrg, ownerEmail, model string, level TrustLevel) (*AgentPassport, error)

IssueAgentPassportQuick mints a passport in one call using a trust-level preset, mirroring the Python issue_agent_passport quickstart.

func LoadAgentPassport

func LoadAgentPassport(data []byte) (*AgentPassport, error)

LoadAgentPassport rebuilds a passport previously serialised by Export.

func (*AgentPassport) AuditLog

func (p *AgentPassport) AuditLog() []AuditEntry

AuditLog returns a defensive copy of the full immutable audit trail.

func (*AgentPassport) Export

func (p *AgentPassport) Export() ([]byte, error)

Export serialises the passport to JSON. Round-trips through Load.

func (*AgentPassport) IsTrusted

func (p *AgentPassport) IsTrusted() bool

IsTrusted reports whether the passport is active and not expired. Expiry flips the status to expired the first time it is observed.

func (*AgentPassport) LogAction

func (p *AgentPassport) LogAction(action string, details map[string]any, outcome ActionOutcome) AuditEntry

LogAction appends an entry to the immutable audit trail. Returns the entry written so callers can record its log_id.

func (*AgentPassport) Revoke

func (p *AgentPassport) Revoke(reason string)

Revoke immediately moves the passport to revoked status. Subsequent IsTrusted/VerifyAction calls will fail.

func (*AgentPassport) String

func (p *AgentPassport) String() string

String returns a short debug representation, mirroring Python __repr__.

func (*AgentPassport) Summary

func (p *AgentPassport) Summary() Summary

Summary returns a compact snapshot of the passport.

func (*AgentPassport) VerifyAction

func (p *AgentPassport) VerifyAction(action Action) bool

VerifyAction returns true iff the passport is trusted and the capability for the action is granted. A negative result writes a blocked entry to the audit log with a reason, matching the Python SDK behaviour.

type AgentRegistration

type AgentRegistration struct {
	Name         string   `json:"name"`
	Description  string   `json:"description,omitempty"`
	Organization string   `json:"organization"`
	Capabilities []string `json:"capabilities"`
}

AgentRegistration is the request body for RegisterAgent.

type AgentStatus

type AgentStatus string

AgentStatus is the lifecycle state of an AgentPassport.

const (
	StatusActive  AgentStatus = "active"
	StatusRevoked AgentStatus = "revoked"
	StatusExpired AgentStatus = "expired"
)

type AuditEntry

type AuditEntry struct {
	LogID     string         `json:"log_id"`
	AgentID   string         `json:"agent_id"`
	Action    string         `json:"action"`
	Details   map[string]any `json:"details,omitempty"`
	Outcome   ActionOutcome  `json:"outcome"`
	Timestamp time.Time      `json:"timestamp"`
}

AuditEntry is one immutable record in an AgentPassport audit log.

type AuditReport

type AuditReport struct {
	OrgName       string            `json:"org_name"`
	GeneratedAt   time.Time         `json:"generated_at"`
	TotalAgents   int               `json:"total_agents"`
	ActiveAgents  int               `json:"active_agents"`
	TotalDevices  int               `json:"total_devices"`
	ActiveDevices int               `json:"active_devices"`
	Agents        []AgentAuditEntry `json:"agents"`
}

AuditReport summarises everything the office knows.

type CapabilityCheck

type CapabilityCheck struct {
	Granted    bool           `json:"granted"`
	Capability string         `json:"capability,omitempty"`
	Scope      map[string]any `json:"scope,omitempty"`
	BoundAt    *time.Time     `json:"bound_at,omitempty"`
	Reason     string         `json:"reason,omitempty"`
}

CapabilityCheck is the response from /v1/agents/{id}/capabilities/{cap}.

type Client

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

Client is the HTTP client for the ComputeID REST API. It covers both /v1/agents/* (server-backed agent passports) and /api/devices/* (device passports). Construct one with NewClient.

func NewClient

func NewClient(opts ...Option) *Client

NewClient returns a Client wired to the default API. Pass options to override the base URL, API key, HTTP client, or User-Agent.

func (*Client) AuthenticateDevice

func (c *Client) AuthenticateDevice(ctx context.Context, deviceCode string) (string, error)

AuthenticateDevice exchanges a device_code for a JWT access token.

func (*Client) CheckCapability

func (c *Client) CheckCapability(ctx context.Context, passportID, capability string) (*CapabilityCheck, error)

CheckCapability tests a single capability grant on a passport.

func (*Client) ListAgentActions

func (c *Client) ListAgentActions(ctx context.Context, passportID string, limit int) ([]ServerActionLog, error)

ListAgentActions reads the audit trail for a passport. limit <= 0 omits the parameter (server default applies).

func (*Client) ListAgents

func (c *Client) ListAgents(ctx context.Context, status string) ([]ServerAgentPassport, error)

ListAgents enumerates passports. Pass an empty status to list all.

func (*Client) LogAgentAction

func (c *Client) LogAgentAction(ctx context.Context, passportID string, req LogActionRequest) error

LogAgentAction appends to the server-side audit log.

func (*Client) RegisterAgent

func (c *Client) RegisterAgent(ctx context.Context, reg AgentRegistration) (*ServerAgentPassport, error)

RegisterAgent issues a server-backed agent passport.

func (*Client) RegisterDevice

func (c *Client) RegisterDevice(ctx context.Context, req RegisterDeviceRequest) (*DevicePassport, error)

RegisterDevice registers a new device.

func (*Client) RevokeAgent

func (c *Client) RevokeAgent(ctx context.Context, passportID, reason string) error

RevokeAgent immediately revokes a server-backed passport.

func (*Client) VerifyAgent

func (c *Client) VerifyAgent(ctx context.Context, passportID string) (*VerificationResult, error)

VerifyAgent returns status + signature validity for a passport.

type DevicePassport

type DevicePassport struct {
	DeviceID   string       `json:"device_id"`
	DeviceCode string       `json:"device_code"`
	Name       string       `json:"name"`
	DeviceType string       `json:"type"`
	IPAddress  string       `json:"ip_address"`
	Status     DeviceStatus `json:"status"`
	IssuedAt   time.Time    `json:"issued_at"`
}

DevicePassport is a cryptographic passport for a GPU, server, or other compute device. Unlike AgentPassport it is server-backed: registration and authentication round-trip through the ComputeID API.

func RegisterDevice

func RegisterDevice(ctx context.Context, req RegisterDeviceRequest, apiKey string) (*DevicePassport, error)

RegisterDevice registers a new device with the default API and returns the issued passport. For a customised client use Client.RegisterDevice.

func RegisterGPU

func RegisterGPU(ctx context.Context, name, ipAddress, apiKey string) (*DevicePassport, error)

RegisterGPU is a one-liner over RegisterDevice with DeviceType="GPU".

func (*DevicePassport) IsPending

func (d *DevicePassport) IsPending() bool

IsPending reports whether the passport is awaiting admin approval.

func (*DevicePassport) IsValid

func (d *DevicePassport) IsValid() bool

IsValid reports whether the passport is active.

func (*DevicePassport) String

func (d *DevicePassport) String() string

type DeviceStatus

type DeviceStatus string

DeviceStatus is the lifecycle state of a DevicePassport.

const (
	DeviceStatusPending DeviceStatus = "pending"
	DeviceStatusActive  DeviceStatus = "active"
	DeviceStatusRevoked DeviceStatus = "revoked"
)

type IssueOptions

type IssueOptions struct {
	AgentName      string
	AgentType      string
	OwnerOrg       string
	OwnerEmail     string
	Capabilities   AgentCapabilities
	Model          string
	Version        string
	ExpiresIn      time.Duration // defaults to 24h
	ParentPassport *AgentPassport
}

IssueOptions configures IssueAgentPassport. Required fields are AgentName, AgentType, OwnerOrg, OwnerEmail, and Capabilities.

type LogActionRequest

type LogActionRequest struct {
	Action  string         `json:"action"`
	Details map[string]any `json:"details,omitempty"`
	Outcome string         `json:"outcome"`
}

LogActionRequest is the payload for LogAgentAction.

type Option

type Option func(*Client)

Option customises NewClient.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the X-API-Key header sent on every request.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL overrides the API base URL (e.g. for staging or tests).

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

WithHTTPClient injects a custom *http.Client (useful for instrumentation, retries, or a shared transport).

func WithUserAgent

func WithUserAgent(ua string) Option

WithUserAgent sets the User-Agent header sent on every request.

type PassportOffice

type PassportOffice struct {
	OrgName   string
	APIKey    string
	CreatedAt time.Time
	// contains filtered or unexported fields
}

PassportOffice is an org-wide registry of agent and device passports. It is safe for concurrent use.

func NewPassportOffice

func NewPassportOffice(orgName, apiKey string) *PassportOffice

NewPassportOffice constructs an empty office.

func (*PassportOffice) ActiveAgents

func (o *PassportOffice) ActiveAgents() []*AgentPassport

ActiveAgents returns all currently trusted agents.

func (*PassportOffice) ActiveDevices

func (o *PassportOffice) ActiveDevices() []*DevicePassport

ActiveDevices returns all currently active devices.

func (*PassportOffice) AuditReport

func (o *PassportOffice) AuditReport() AuditReport

AuditReport builds a compliance snapshot across all registered passports.

func (*PassportOffice) IsTrusted

func (o *PassportOffice) IsTrusted(agentID string) bool

IsTrusted reports whether a registered agent is currently trusted.

func (*PassportOffice) RegisterAgent

func (o *PassportOffice) RegisterAgent(p *AgentPassport)

RegisterAgent adds an agent passport to the office.

func (*PassportOffice) RegisterDevice

func (o *PassportOffice) RegisterDevice(p *DevicePassport)

RegisterDevice adds a device passport to the office.

func (*PassportOffice) RevokeAgent

func (o *PassportOffice) RevokeAgent(agentID, reason string) bool

RevokeAgent revokes a registered agent and returns true if found.

func (*PassportOffice) String

func (o *PassportOffice) String() string

type RegisterDeviceRequest

type RegisterDeviceRequest struct {
	Name       string `json:"name"`
	DeviceType string `json:"type"`
	IPAddress  string `json:"ip_address"`
}

RegisterDeviceRequest is the payload sent to /api/devices/register.

type ServerActionLog

type ServerActionLog struct {
	ActionID  string         `json:"action_id"`
	Action    string         `json:"action"`
	Details   map[string]any `json:"details,omitempty"`
	Outcome   string         `json:"outcome"`
	Timestamp time.Time      `json:"timestamp"`
}

ServerActionLog mirrors a row from /v1/agents/{id}/actions.

type ServerAgentPassport

type ServerAgentPassport struct {
	PassportID         string    `json:"passport_id"`
	Name               string    `json:"name"`
	Description        string    `json:"description,omitempty"`
	Organization       string    `json:"organization"`
	Status             string    `json:"status"`
	PublicKey          string    `json:"public_key,omitempty"`
	Signature          string    `json:"signature,omitempty"`
	SignatureAlgorithm string    `json:"signature_algorithm,omitempty"`
	Capabilities       []string  `json:"capabilities"`
	IssuedAt           time.Time `json:"issued_at"`
}

ServerAgentPassport is the response payload for /v1/agents/register and list endpoints. It is distinct from the local-model AgentPassport.

type Summary

type Summary struct {
	AgentID       string      `json:"agent_id"`
	AgentName     string      `json:"agent_name"`
	OwnerOrg      string      `json:"owner_org"`
	Model         string      `json:"model"`
	Status        AgentStatus `json:"status"`
	TrustLevel    TrustLevel  `json:"trust_level"`
	IssuedAt      time.Time   `json:"issued_at"`
	ExpiresAt     time.Time   `json:"expires_at"`
	ActionsLogged int         `json:"actions_logged"`
	Fingerprint   string      `json:"fingerprint"`
}

Summary is a compact view suitable for dashboards and JSON exports.

type TrustLevel

type TrustLevel string

TrustLevel describes the broad authority an agent operates under.

const (
	TrustRestricted TrustLevel = "restricted"
	TrustStandard   TrustLevel = "standard"
	TrustElevated   TrustLevel = "elevated"
	TrustAutonomous TrustLevel = "autonomous"
)

type TrustRegistry

type TrustRegistry = PassportOffice

TrustRegistry is a backwards-compatible alias matching the Python SDK.

func NewTrustRegistry

func NewTrustRegistry(orgName, apiKey string) *TrustRegistry

NewTrustRegistry mirrors the Python TrustRegistry constructor.

type VerificationResult

type VerificationResult struct {
	PassportID     string     `json:"passport_id"`
	Status         string     `json:"status"`
	SignatureValid bool       `json:"signature_valid"`
	Capabilities   []string   `json:"capabilities"`
	IssuedAt       time.Time  `json:"issued_at,omitempty"`
	RevokedAt      *time.Time `json:"revoked_at,omitempty"`
}

VerificationResult is the response from /v1/agents/{id}/verify.

func (VerificationResult) IsTrusted

func (v VerificationResult) IsTrusted() bool

IsTrusted is the authoritative authorisation check: active and signature valid, matching INTEGRATION.md guidance.

Directories

Path Synopsis
cmd
computeid-server command
Command computeid-server runs the Postgres-backed ComputeID API.
Command computeid-server runs the Postgres-backed ComputeID API.
examples
basic command
Local-only AgentPassport example — mirrors the Python "Full Example" in the SDK README.
Local-only AgentPassport example — mirrors the Python "Full Example" in the SDK README.
devices command
Device registration example.
Device registration example.
serverbacked command
Server-backed agent passport example — talks to the ComputeID API.
Server-backed agent passport example — talks to the ComputeID API.
Package server is a Postgres-backed ComputeID API implementation.
Package server is a Postgres-backed ComputeID API implementation.

Jump to

Keyboard shortcuts

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