Skip to Content
AgentShield
Contributing

Local Setup

Run every AgentShield process from source against the Compose data services, with hot reload where available.

Running from source is the fastest loop when you change a service. The data services still run in Compose.

Data services

docker compose up -d

PostgreSQL, Redis, NATS, MinIO, and Mailpit start on loopback ports. Migrations apply on first volume creation.

Shared environment

export DATABASE_URL="postgres://agentshield:agentshield@127.0.0.1:5432/agentshield?sslmode=disable"
export REDIS_URL="redis://127.0.0.1:6379/0"
export NATS_URL="nats://127.0.0.1:4222"
export MINIO_ENDPOINT="127.0.0.1:9000" MINIO_ROOT_USER="agentshield" MINIO_ROOT_PASSWORD="agentshield-dev-only"

Control plane and bootstrap

npm install
npm run build --workspace @agentshield/control-plane

# Once: create the first organization and owner. All five variables are required.
AGENTSHIELD_BOOTSTRAP_EMAIL=owner@example.com \
AGENTSHIELD_BOOTSTRAP_PASSWORD=change-me-local-only \
AGENTSHIELD_BOOTSTRAP_DISPLAY_NAME="Local Owner" \
AGENTSHIELD_BOOTSTRAP_ORG_NAME=Local \
AGENTSHIELD_BOOTSTRAP_ORG_SLUG=local \
  npm run bootstrap --workspace @agentshield/control-plane

npm start --workspace @agentshield/control-plane           # 127.0.0.1:8080

Add SMTP_URL=smtp://127.0.0.1:1025 to email invitations to Mailpit (http://127.0.0.1:8025).

Gateway

go run ./runtime/gateway/cmd/gateway    # 127.0.0.1:8081

Optionally enable analysis and the HTTP adapter:

INTELLIGENCE_URL=http://127.0.0.1:8082 \
GATEWAY_TOOLS_CONFIG=docs/examples/gateway-tools.json \
AGENTSHIELD_GITHUB_AUTHORIZATION="Bearer <token>" \
  go run ./runtime/gateway/cmd/gateway

Intelligence engine

PYTHONPATH=apps/intelligence-engine python -m agentshield_intelligence    # 127.0.0.1:8082

Event relay

go run ./runtime/gateway/cmd/event-relay    # health and metrics on 127.0.0.1:8083

Dashboard

npm run dev --workspace @agentshield/dashboard    # http://127.0.0.1:3000

Documentation site

cd apps/docs
npm install
npm run dev     # http://localhost:3002

Applying new migrations locally

An existing volume does not pick up new migration files. Apply them directly (each is safe to run twice):

psql "$DATABASE_URL" -f infrastructure/docker/postgres/migrations/0006_event_pipeline.sql

Or reset everything with docker compose down -v if you can lose local data.

Exercising row level security

Development connects as the schema owner, which bypasses RLS. To test as the app role, use the development credentials from .env.example:

export DATABASE_URL="postgres://agentshield_app:agentshield-app@127.0.0.1:5432/agentshield?sslmode=disable"

Was this page helpful?

On this page