agentpaas

package module
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 5 Imported by: 0

README

AgentPaaS

Run AI agents so that even a compromised one can't leak your data.

Building an agent is easy now. In Hermes you write a prompt, attach a skill, and wire up an MCP server. Minutes later you have a full agent on your machine that can call tools and hit the network. The hard part is trust. That stack might be buggy, prompt-injected, or straight-up hostile. One bad outbound call and your API keys, files, or PII are gone.

AgentPaaS is the runtime that sits under those agents. You keep writing and running them the way you already do (usually through Hermes). Under the hood each agent is packed into a locked-down container on a default-deny network. Outbound traffic only leaves through a sidecar gateway that enforces your policy: approved hosts only. Secrets stay in the macOS Keychain and are injected by that gateway at request time, so the agent process never holds them. Every allow and deny is written to a tamper-evident audit log.

When an agent tries an unknown host, the call is blocked, you see the denial in the log, and your secrets are never leaked. When you hand an agent to a coworker or a friend, you ship a signed bundle with your publisher fingerprint. They inspect policy and provenance before install, map credentials to their own Keychain, and keep their own audit trail. If someone forks that agent, changes the code or policy, and re-shares it, the bundle records each hop: who published the original, who forked it, and what egress or credentials they added. Receivers can verify the provenance chain before accepting and running the agent.

Coming soon (v0.4):

  • Governed MCP services inside AgentPaaS containers
  • Linear agent pipelines with durable stage handoffs
  • Bounded parent/child fan-out and result collation

How it works

┌────────────────────────────────────────────────────┐
│                   YOUR MACHINE                     │
│                                                    │
│  ┌──────────────────────────────────────┐          │      ┌──────────────────┐
│  │   INTERNAL-ONLY DOCKER NETWORK       │          │      │  APPROVED APIs   │
│  │   (no direct internet route)         │          │      │ (api.x.ai, etc.) │
│  │                                      │          │      │   (internet)     │
│  │  ┌────────────┐    ┌──────────────┐  │  only    │      │                  │
│  │  │   AGENT    │    │   GATEWAY    │  │  allowed │      │                  │
│  │  │  CONTAINER │◄──►│   SIDECAR    │◄─┼──────────┼─────►│                  │
│  │  │            │    │              │  │  egress/ │      │                  │
│  │  │ · Python   │    │ · Policy     │  │  ingress │      └──────────────────┘
│  │  │ · No shell │    │ · Credential │  │          │
│  │  │ · Non-root │    │   broker     │  │          │
│  │  │ · Read-only│    │ · DNS stub   │  │          │
│  │  │ · No caps  │    │              │  │          │
│  │  └────────────┘    └──────────────┘  │          │
│  └──────────────────────────────────────┘          │
│                                                    │
│  ┌──────────────────────────────────────┐          │
│  │           DAEMON (agentpaasd)        │          │
│  │  · Tamper-evident audit trail        │          │
│  │  · Signed checkpoints                │          │
│  │  · Hash-chained JSONL + SQLite index │          │
│  └──────────────────────────────────────┘          │
└────────────────────────────────────────────────────┘

The agent container has no direct path to the internet. Every packet goes through the gateway sidecar, which applies your policy. That is the only way out.

The PRIMARY egress control is network topology isolation: the agent lives on a Docker internal-only network with no default route off the box. An iptables egress firewall inside the container is defense-in-depth — it drops unexpected outbound traffic on the container's own stack.

Security features

Five that matter first. Full list: docs/security-features.md.

Feature What it stops
Default-deny egress Any host you did not put on the allow list
Credential brokering Secrets never enter agent code; the gateway injects them per request
Container isolation Non-root (UID 64000), read-only rootfs, no shell, stripped capabilities, seccomp
Tamper-evident audit Hash-chained log + signed checkpoints; edits and inserts fail verify
Signed bundles Shareable .agentpaas packages with publisher identity and provenance

Red-team smoke (six attack fixtures on the real pack → run → gateway path) is in the security features doc.

Prerequisites

  • Hermes Agent — install first; AgentPaaS runs through Hermes

  • Docker Desktop or Colima

    brew install colima docker
    colima start
    
  • An LLM API key (OpenRouter, OpenAI, xAI, Anthropic, …). Store it with agentpaas secret add. It never goes into the Hermes conversation.

  • macOS (Apple Silicon or Intel)

Install

Install with Homebrew. Do not build from source for normal use. Even with the repo cloned, make build-all produces dev binaries (0.3.0-dev, unknown commit, no version stamp). The brew cask ships versioned binaries and the Linux harness. A new user should not need Go, make, or the source tree.

1. Install Hermes
brew install nousresearch/tap/hermes-agent
2. Install Docker if needed
brew install colima docker
colima start
3. Install AgentPaaS
brew tap AgentPaaS-ai/homebrew-tap
brew install agentpaas
xattr -cr /opt/homebrew/bin/agentpaas /opt/homebrew/bin/agentpaasd /opt/homebrew/bin/agentpaas-harness-linux
agentpaas daemon start
agentpaas doctor
agentpaas version

The brew cask is not notarized. Run xattr -cr before any agentpaas command or macOS will kill the binaries (exit 137). Once after install is enough.

agentpaas doctor checks Docker, the daemon, keychain, and the harness. If something fails, it says what to fix.

Quickstart: build and run a governed agent

Do this inside Hermes:

hermes
Step 1: Install the AgentPaaS plugin

Tell Hermes:

Install the AgentPaaS plugin from github https://github.com/AgentPaaS-ai/agentpaas

Use hermes plugins install from GitHub. Do not use make install-plugin from a local clone. That skips after-install work (skill pointer, toolset registration), and a normal user does not have the source repo.

When Hermes asks you to restart:

/quit
hermes
Step 2: Store your API key

Keys never go through the Hermes chat. They go into macOS Keychain. In a separate terminal:

agentpaas secret add openrouter-key
# paste your API key when prompted

Then tell Hermes you are done. It checks that the label exists, never the value.

Step 3: Build an agent

Tell Hermes:

Build a weather agent that takes a city name as input, fetches real weather data from wttr.in, uses an LLM to summarize the conditions, and returns a short forecast.

Hermes asks a few short questions (provider, model, hostnames), writes the agent, builds an egress policy for wttr.in and your LLM host, packs a signed image, and runs it under governance. Pack fails if any external hostname or credential is missing from the policy, so a broken or open runtime never ships.

Step 4: Invoke the agent

Tell Hermes:

What's the weather in Folsom?

Hermes calls the agent through the trigger API. The agent hits wttr.in through the gateway, calls the LLM with a brokered credential, and returns the forecast.

Step 5: Read and verify the audit chain

Every allow and deny is written as it happens: time, agent identity, destination, credential used (by id, not value), and the policy decision.

# Recent events
agentpaas audit query

# One run
agentpaas audit query --run-id <run-id>

How the chain works:

  1. Each record is a line of JSON (JSONL) with a sequence number.
  2. Record N stores prev_hash = hash of record N-1.
  3. Record N also stores its own record_hash over canonical JSON.
  4. After each write, the daemon signs a checkpoint over the latest hash.
  5. agentpaas audit verify walks the chain, recomputes every hash, and checks the checkpoints. Exit 0 means intact. Non-zero means something changed, moved, or was inserted.
agentpaas audit verify
# Audit chain valid: N records, N checkpoints

Hand a signed export to someone else (or yourself on another box):

agentpaas audit export --output ~/audit-export.json

Full field list and second-machine verify flow: docs/audit-export.md.

Sharing agents

Signed bundles for handing an agent to someone else.

Sender: export and share
# First time only: publisher identity
agentpaas identity init
# Publisher name: GitHub-style slug, 1-39 chars

agentpaas identity show
#   Name:        your-name
#   Fingerprint: abcd 1234 ... (64 hex chars)

agentpaas export ~/weather-agent --output ~/weather-agent/weather-agent.agentpaas --yes

agentpaas bundle inspect weather-agent.agentpaas
# 9 integrity checks, policy summary, provenance, SBOM

agentpaas provenance show weather-agent
# Every pack/fork event with publisher signature

# Share two things:
# 1. The .agentpaas file (any file share)
# 2. Your full 64-char fingerprint on a separate channel (phone, Signal, etc.)
Receiver: inspect, verify, install
agentpaas bundle inspect weather-agent.agentpaas

Inspect runs nine offline integrity checks on the bundle: does the manifest parse and verify under the publisher key, do lock/provenance signatures hold, and do the digests for policy, SBOM, source, and image match what the lock claims. All of them should PASS before you install. The full checklist is in docs/bundle-format.md.

Inspect also prints a policy summary (egress domains and declared credentials). Read that before you trust the agent.

# Compare the fingerprint from `bundle inspect` with what the sender
# told you on a separate channel. Skip this and you may install a forge.

agentpaas install weather-agent.agentpaas
# Prompts:
#   - type last 8 chars of the fingerprint
#   - approve the policy
#   - confirm any missing locked deps

# Non-interactive:
agentpaas install weather-agent.agentpaas \
  --yes \
  --confirm-fingerprint "<full-64-char-hex-fingerprint>" \
  --accept-policy "<policy-digest>" \
  --allow-unlocked-deps
# policy digest: agentpaas bundle inspect --json | jq .policy_digest
# --confirm-fingerprint wants the full 64 hex chars, not the last 8

agentpaas installed list
# weather-agent@<pub8>

agentpaas installed map-credential weather-agent@<pub8> \
  --credential-id openrouter-key \
  --secret-name openrouter-key
# Maps the bundle credential id to a secret in YOUR Keychain.
# Original secrets do not travel with the bundle.

agentpaas run weather-agent@<pub8>

agentpaas trigger invoke weather-agent@<pub8> --payload '{"city":"Folsom"}' --wait

agentpaas audit verify
# Your machine, your credentials, your independent audit chain
Fork and redistribute
agentpaas fork weather-agent@<pub8> ~/my-weather-agent

cd ~/my-weather-agent && agentpaas pack . && agentpaas export . --output ~/my-weather-agent/my-weather-agent.agentpaas --yes
# Provenance chain example:
#   1. created  weather-agent 0.1.0  by original-publisher
#   2. forked   weather-agent 0.1.0  by your-name  (policy delta: +egress)

Full guide: docs/sharing.md.

Documentation

Tech stack

Most of AgentPaaS is Go: the CLI, the daemon, and the Linux harness.

APIs are protobuf over gRPC. Policy and agent config are plain YAML. Agents themselves are usually Python, wired in through python/agentpaas_sdk, with deps pinned by uv lockfiles at pack time.

Runtime is Docker (Desktop or Colima on a Mac). The agent lands on an internal-only network. The only way out is a dual-homed agentgateway sidecar we vendor and configure for that run.

Secrets live in the macOS Keychain. The gateway injects them at request time; the agent process never sees them. Images and shareable bundles can be cosign-signed, and every pack ships an SBOM.

Audit is a hash-chained JSONL log, indexed in SQLite, with signed checkpoints on each write.

Day to day you drive it from Hermes: pack, run, trigger, audit. Everything above runs on your machine. No phone-home control plane on this path.

Repository layout

agentpaas/
├── cmd/                  # agent CLI, agentpaasd daemon, harness
├── internal/             # runtime, policy, secrets, audit, pack, llm, ...
├── api/                  # control + trigger protobuf APIs
├── web/dashboard/        # operator dashboard (not yet enabled)
├── python/agentpaas_sdk/ # Python SDK for agent code
├── integrations/hermes-plugin/
├── test/e2e/             # end-to-end tests
├── test/redteam/         # P1 adversarial smoke fixtures
├── third_party/agentgateway/
├── docs/
└── landing-page/

Changelog

See CHANGELOG.md.

License

MIT — see LICENSE.

Documentation

Overview

Package agentpaas embeds the Python SDK (python/agentpaas_sdk/) directly into the agentpaasd binary so that it is available at pack time regardless of how the binary was installed (brew, manual copy, release tarball).

Without this, a brew-only install has no SDK on disk and every packed image fails at runtime with:

ModuleNotFoundError: No module named 'agentpaas_sdk'

The go:embed directive must be in a .go file whose directory is a parent of the files to embed. We place this file at the repo root so it can embed python/agentpaas_sdk/**.

Index

Constants

View Source
const EmbeddedSDKPrefix = "python/agentpaas_sdk"

EmbeddedSDKDir returns the path that should be used as SDKDir when extracting the embedded SDK. Files are under "python/agentpaas_sdk".

Variables

This section is empty.

Functions

func ExtractEmbeddedSDK

func ExtractEmbeddedSDK(dir string) (string, error)

ExtractEmbeddedSDK writes the embedded SDK files into dir, preserving the python/agentpaas_sdk/ directory structure. Returns the path to use as SDKDir (dir + "/python"). The caller MUST remove the temp dir when done.

func ExtractEmbeddedSDKToTemp

func ExtractEmbeddedSDKToTemp() (sdkDir string, cleanup func(), err error)

ExtractEmbeddedSDKToTemp creates a temporary directory, extracts the embedded SDK into it, and returns the SDKDir path. The caller MUST call the cleanup function when done with the SDK.

func HasEmbeddedSDK

func HasEmbeddedSDK() bool

HasEmbeddedSDK reports whether the binary contains the embedded SDK.

Types

This section is empty.

Directories

Path Synopsis
api
control/v1
Package controlv1 is a reverse proxy.
Package controlv1 is a reverse proxy.
trigger/v1
Package triggerv1 is a reverse proxy.
Package triggerv1 is a reverse proxy.
cmd
agent command
Package main provides the AgentPaaS CLI entry point.
Package main provides the AgentPaaS CLI entry point.
agentpaas command
Package main provides the AgentPaaS CLI entry point.
Package main provides the AgentPaaS CLI entry point.
agentpaasd command
Package main is the AgentPaaS daemon (agentpaasd) entry point.
Package main is the AgentPaaS daemon (agentpaasd) entry point.
harness command
Package main is the AgentPaaS harness (agentpaas-harness) entry point.
Package main is the AgentPaaS harness (agentpaas-harness) entry point.
internal
adapter/docker
Package docker bridges AgentPaaS Docker-backed implementations to portable ports.
Package docker bridges AgentPaaS Docker-backed implementations to portable ports.
adapter/k8s
Package k8s bridges AgentPaaS Kubernetes-backed implementations to portable ports.
Package k8s bridges AgentPaaS Kubernetes-backed implementations to portable ports.
audit
Package audit provides hash-chain log, export, and verification for the AgentPaaS daemon.
Package audit provides hash-chain log, export, and verification for the AgentPaaS daemon.
binresolve
Package binresolve resolves the agentpaas-harness binary and Python SDK directory shared by the daemon pack path and the CLI install path.
Package binresolve resolves the agentpaas-harness binary and Python SDK directory shared by the daemon pack path and the CLI install path.
bundle
Package bundle implements the deterministic .agentpaas archive format: hardened tar.gz reader, deterministic writer, offline verification, inspect rendering, and consent-card helpers.
Package bundle implements the deterministic .agentpaas archive format: hardened tar.gz reader, deterministic writer, offline verification, inspect rendering, and consent-card helpers.
cli
Package cli implements the AgentPaaS CLI command surface using cobra.
Package cli implements the AgentPaaS CLI command surface using cobra.
daemon
Package daemon provides the AgentPaaS control daemon — a Unix-socket-bound gRPC server that implements the ControlService API.
Package daemon provides the AgentPaaS control daemon — a Unix-socket-bound gRPC server that implements the ControlService API.
dashboard
Package dashboard provides the embedded web dashboard for AgentPaaS. The dashboard is a Preact/TypeScript SPA compiled to static assets and embedded via go:embed.
Package dashboard provides the embedded web dashboard for AgentPaaS. The dashboard is a Preact/TypeScript SPA compiled to static assets and embedded via go:embed.
delegation
Package delegation defines the canonical durable contracts for Secure Task Delegation (B32): logical task delegation, messages/parts, terminal results, transferable artifact references (schema only), ordered task events, idempotency, content digests, and a pluggable Store interface.
Package delegation defines the canonical durable contracts for Secure Task Delegation (B32): logical task delegation, messages/parts, terminal results, transferable artifact references (schema only), ordered task events, idempotency, content digests, and a pluggable Store interface.
dockerclient
Package dockerclient provides a Docker client factory that mirrors the Docker CLI's endpoint discovery order.
Package dockerclient provides a Docker client factory that mirrors the Docker CLI's endpoint discovery order.
doctor
Package doctor provides system diagnostic checks for agentpaas.
Package doctor provides system diagnostic checks for agentpaas.
events
Package events provides the event bus and webhook delivery mechanism.
Package events provides the event bus and webhook delivery mechanism.
fsutil
Package fsutil provides shared filesystem path safety helpers.
Package fsutil provides shared filesystem path safety helpers.
harness
Package harness runs agent workloads inside the container as PID 1 style supervision: a local HTTP lifecycle API, a Python worker, resource budgets, process reaping, egress firewall hooks, guardrails, streaming adapters, and authenticated progress journal integration.
Package harness runs agent workloads inside the container as PID 1 style supervision: a local HTTP lifecycle API, a Python worker, resource budgets, process reaping, egress firewall hooks, guardrails, streaming adapters, and authenticated progress journal integration.
hashutil
Package hashutil provides small shared hashing helpers.
Package hashutil provides small shared hashing helpers.
home
Package home provides the agentpaas home directory layout, discovery, and secure permission management.
Package home provides the agentpaas home directory layout, discovery, and secure permission management.
httpjson
Package httpjson provides shared JSON HTTP response helpers.
Package httpjson provides shared JSON HTTP response helpers.
identity
Package identity provides local trust-domain identity: key stores, local CA, SPIFFE-style workload SVID issuance, package identity keys, daemon audit signing keys, and publisher identity helpers.
Package identity provides local trust-domain identity: key stores, local CA, SPIFFE-style workload SVID issuance, package identity keys, daemon audit signing keys, and publisher identity helpers.
install
Package install implements trust resolution and TOFU (Trust On First Use) consent for the AgentPaaS verified install flow (Block 23).
Package install implements trust resolution and TOFU (Trust On First Use) consent for the AgentPaaS verified install flow (Block 23).
llm
logging
Package logging provides structured logging with built-in redaction for sensitive data.
Package logging provides structured logging with built-in redaction for sensitive data.
mcpmanager
Package mcpmanager manages MCP server resources declared in agent policy.
Package mcpmanager manages MCP server resources declared in agent policy.
money
Package money provides an exact decimal type for USD amounts with nano-USD precision (9 decimal places).
Package money provides an exact decimal type for USD amounts with nano-USD precision (9 decimal places).
naming
Package naming provides primitives for parsing and formatting agent references in the form "name@pub8", where pub8 is the first 8 hex characters of the publisher's public-key fingerprint.
Package naming provides primitives for parsing and formatting agent references in the form "name@pub8", where pub8 is the first 8 hex characters of the publisher's public-key fingerprint.
operator
Package operator provides the stable machine-readable diagnosis and repair-hint layer consumed by the AgentPaaS CLI, dashboard, and Block 13 MCP/Hermes integrations.
Package operator provides the stable machine-readable diagnosis and repair-hint layer consumed by the AgentPaaS CLI, dashboard, and Block 13 MCP/Hermes integrations.
otel
Package otel provides the in-process OpenTelemetry collector and SQLite WAL store for AgentPaaS observability data.
Package otel provides the in-process OpenTelemetry collector and SQLite WAL store for AgentPaaS observability data.
pack
Package pack implements the agent project pack pipeline: runtime detection, project scaffolding, deterministic OCI image builds, dependency locking, SBOM generation, secret scanning, advisory scanning, lockfile signing, and provenance/lineage helpers.
Package pack implements the agent project pack pipeline: runtime detection, project scaffolding, deterministic OCI image builds, dependency locking, SBOM generation, secret scanning, advisory scanning, lockfile signing, and provenance/lineage helpers.
policy
Package policy parses, validates, canonicalizes, and compiles agent policy.yaml documents into agentgateway configuration and related artifacts.
Package policy parses, validates, canonicalizes, and compiles agent policy.yaml documents into agentgateway configuration and related artifacts.
port
Package port defines substrate-neutral semantic contracts for AgentPaaS.
Package port defines substrate-neutral semantic contracts for AgentPaaS.
port/fakes
Package fakes provides thread-safe configurable implementations of port contracts.
Package fakes provides thread-safe configurable implementations of port contracts.
registry
Package registry provides a read API over the local package registry.
Package registry provides a read API over the local package registry.
routedrun
Package routedrun defines the durable domain model for the AgentPaaS Durable Routed Run: deployments, aliases, invocations, runs, attempts, workflows, time envelopes, artifacts, progress, and store interfaces.
Package routedrun defines the durable domain model for the AgentPaaS Durable Routed Run: deployments, aliases, invocations, runs, attempts, workflows, time envelopes, artifacts, progress, and store interfaces.
runtime
Package runtime implements activation policy validation and zero-authority idle-state enforcement (B29-T06).
Package runtime implements activation policy validation and zero-authority idle-state enforcement (B29-T06).
secrets
Package secrets provides SecretStore implementations for local profile secrets.
Package secrets provides SecretStore implementations for local profile secrets.
service
Package service generates launchd and systemd service unit files for the AgentPaaS daemon (agentpaasd).
Package service generates launchd and systemd service unit files for the AgentPaaS daemon (agentpaasd).
strutil
Package strutil provides small shared string helpers.
Package strutil provides small shared string helpers.
supervisor
Package supervisor implements the durable, request-context-independent lifecycle supervisor for long-running invoke jobs.
Package supervisor implements the durable, request-context-independent lifecycle supervisor for long-running invoke jobs.
trigger
Package trigger serves the AgentPaaS Trigger API over gRPC (default port 7718) and REST through grpc-gateway (default port 7717).
Package trigger serves the AgentPaaS Trigger API over gRPC (default port 7718) and REST through grpc-gateway (default port 7717).
trust
Package trust manages the publisher trust store — a local, file-backed registry of trusted publisher public keys with TOFU and manual pre-pinning support.
Package trust manages the publisher trust store — a local, file-backed registry of trusted publisher public keys with TOFU and manual pre-pinning support.
urlutil
Package urlutil provides small shared URL helpers.
Package urlutil provides small shared URL helpers.
workflow/pipeline
Package pipeline provides B34 pipeline and handoff conformance validation.
Package pipeline provides B34 pipeline and handoff conformance validation.
test
compat/v0.2.3
Package v023 provides immutable v0.2.3 baseline fixtures for backward compatibility tests.
Package v023 provides immutable v0.2.3 baseline fixtures for backward compatibility tests.
golden
Package golden — Docker-tier and slow-tier graders.
Package golden — Docker-tier and slow-tier graders.
redteam
Package redteam implements the AgentPaaS P1 red-team smoke gate.
Package redteam implements the AgentPaaS P1 red-team smoke gate.

Jump to

Keyboard shortcuts

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