docs

Configuration

Every flag and environment variable of the service, with defaults.

Every command-line flag and environment variable AgentShield reads. Flags use pflag; discovery options are registered by their owning plugin and always carry that plugin’s name as a prefix.

Flags accept -flag or --flag. When a flag’s default comes from an environment variable, an explicit flag wins.

Every binary prints its version and commit and exits with --version (for agentshield-detector-rules, as the only argument). Release builds carry the tag and commit; a go build from a checkout reports the module version or dev and the VCS revision when Go recorded one.

agentshield

The main service: discovery, telemetry, API, UI, and (optionally) detection with agentic investigation and Deployment rule authoring.

Server and storage

FlagDefaultDescription
--version(flag)Print the version and commit, then exit.
--listen127.0.0.1:8088HTTP listen address. The API has no authentication: a non-loopback address exposes it to anyone who can reach the port, and disables live remediation. See the security model.
--database-url$AGENTSHIELD_DATABASE_URLPostgreSQL URL. Prefer the environment variable; a flag value is visible in the process list. Required.
--database-max-conns$AGENTSHIELD_DATABASE_MAX_CONNS or 20Maximum pool connections.
--database-min-conns$AGENTSHIELD_DATABASE_MIN_CONNS or 2Minimum pool connections.

Telemetry sink

FlagDefaultDescription
--telemetry-jsonl.agentshield/telemetry.jsonlRaw telemetry file, used when --clickhouse-url is empty.
--clickhouse-urlemptyClickHouse HTTP endpoint, for example http://clickhouse:8123. Enables the ClickHouse sink.
--clickhouse-databaseagentshieldClickHouse database.
--clickhouse-tabletelemetry_eventsClickHouse raw table.
--clickhouse-usernamedefaultClickHouse user. The password comes from AGENTSHIELD_CLICKHOUSE_PASSWORD.

Discovery

FlagDefaultDescription
--disable-discoveryfalseRun no plugins. Serve what is already in PostgreSQL. Also disables live remediation.
--kubernetes-disablefalseDo not start the Kubernetes source. Kubernetes-backed consumer plugins then have no shared collection source.
--kubernetes-kubeconfigemptyKubeconfig path. Empty means in-cluster config when KUBERNETES_SERVICE_HOST is set, otherwise the standard loading rules (KUBECONFIG, ~/.kube/config).
--kubernetes-cluster-idlocalStable Kubernetes source authority; never change it for an existing cluster.
--kubernetes-network-idKubernetes cluster IDNetwork realm for network-destination and peer-class identities.
--kubernetes-source-idkubernetes/localStable source ID for the Kubernetes inventory plugin.
--istio-cluster-idlocalStable cluster authority used by Istio. Match this with the Kubernetes source when referring to the same objects.
--istio-network-idIstio cluster IDNetwork realm used by Istio.
--istio-source-idkubernetes/localStable source ID for Istio contributions and telemetry.
--istio-root-namespaceistio-systemIstio mesh root namespace.
--agentgateway-cluster-idlocalStable cluster authority used by agentgateway. Match the Kubernetes source when referring to the same objects.
--agentgateway-source-idkubernetes/localStable source ID for agentgateway contributions.
--cilium-cluster-idlocalStable cluster authority used by Cilium. Match the Kubernetes source when referring to the same objects.
--cilium-source-idkubernetes/localStable source ID for Cilium contributions.
--falco-cluster-idlocalStable cluster authority used by Falco alert telemetry. Match the Kubernetes source so Pod identities converge.
--falco-source-idkubernetes/localStable source ID for Falco telemetry.
--aws-regionemptyEnables the AWS plugin in this region.
--aws-events-queue-urlemptySQS queue that receives CloudTrail events from EventBridge. Optional.
--aws-firehose-stream-arnemptyEnables the plugin-owned Firehose VPC Flow Log receiver. Requires --aws-region and AGENTSHIELD_AWS_FIREHOSE_ACCESS_KEY.
--aws-firehose-access-key$AGENTSHIELD_AWS_FIREHOSE_ACCESS_KEYFirehose shared key. Prefer the environment variable.

Discovery needs at least one source: startup fails if --kubernetes-disable is set without --aws-region (unless --disable-discovery is set).

Detection and model-calling features

Nothing calls a model unless one of the two feature flags below is set. Detection runs when either is enabled and makes no model calls itself; there is no detection-only mode. See Detection and investigation.

FlagDefaultDescription
--agentic-investigation$AGENTSHIELD_AGENTIC_INVESTIGATION or falseInvestigate built-in novelty signals with a model agent that may promote findings. Runs in its own sampled queue. Requires an OpenAI Responses-compatible --model-endpoint; rejected with --model-provider=anthropic.
--deployment-rule-authoring$AGENTSHIELD_DEPLOYMENT_RULE_AUTHORING or falseDraft a detection rule for each Kubernetes Deployment Pod template revision with a model agent, from the Deployment’s observed behavior. Drafts run in shadow mode until approved. Requires --model-endpoint or --model-provider=anthropic.
--model-endpoint$AGENTSHIELD_MODEL_ENDPOINT or selected provider defaultModel API base URL. The provider client selects its supported request endpoint. Setting it alone enables nothing.
--model-api-keysee belowModel API key. Prefer the environment.
--model-provideropenaiProvider for the model-calling features: openai or anthropic. anthropic uses the Messages API, defaults the endpoint to https://api.anthropic.com, and supports only Deployment rule authoring; it cannot be combined with --agentic-investigation, which requires the Responses API.
--model$AGENTSHIELD_MODEL or gpt-6-astraModel name. With Anthropic and no override, the author uses its provider default.
--model-reasoning-effort$AGENTSHIELD_MODEL_REASONING_EFFORTReasoning effort for compatible providers (for example low), for both features. Empty sends none.

Detection

FlagDefaultDescription
--detection-interval1sChange-feed polling interval.
--detection-consumerreasoning/defaultDurable consumer ID for the change-feed cursor. The default keeps cursors from earlier releases.
--detection-signal-retention168hHow long recorded detection signals and finished investigation jobs are kept. Minimum 1h.
--detector-reload-interval10sPolling interval for the active CEL ruleset and Deployment rules. Must be positive.

Agentic investigation

FlagDefaultDescription
--agentic-investigation-retrieval$AGENTSHIELD_AGENTIC_INVESTIGATION_RETRIEVAL or model_selectedmodel_selected or deterministic. See investigation tools.
--agentic-investigation-batch-window30sHow long a queued investigation waits so later windows that share a resource join it. 0 to 10m.
--agentic-investigation-sample-rate1Fraction of medium-risk investigations run, 0 to 1. High and critical always run.
--agentic-investigation-dedup-window1hSkip an investigation whose signal pattern was already investigated within this window. 0 disables.
--agentic-investigation-max-per-hour0 (unlimited)Investigations started in any trailing hour. Over budget, medium-risk jobs are skipped and high-risk jobs wait.
--agentic-investigation-max-attempts5Failed attempts before a job fails permanently.
--agentic-investigation-poll-interval1sInvestigation queue polling interval.

Deployment rule authoring

FlagDefaultDescription
--deployment-rule-authoring-poll-interval1sRule-authoring queue polling interval. Must be positive.
--deployment-rule-authoring-timeout5mMaximum duration of one rule-authoring model call. Minimum 30s.
--rule-review-api$AGENTSHIELD_RULE_REVIEW_API or falseServe the unauthenticated rule review and regenerate routes on a non-loopback listener. They are always served on a loopback listener. Set only behind an authenticating proxy or in a disposable environment. See Reviewing over HTTP.
--deployment-rule-baseline-window6hHow long a new Deployment or Pod template revision is observed before its rule is drafted. 0 to 24h, the telemetry retention. See Detection rules.

API key lookup order: --model-api-key, then AGENTSHIELD_MODEL_API_KEY, then the conventional key for the selected provider (OPENAI_API_KEY or ANTHROPIC_API_KEY).

Renamed in this release: --reasoning-effort is --model-reasoning-effort, --reasoning-retrieval is --agentic-investigation-retrieval, --reasoning-consumer is --detection-consumer, --reasoning-interval is --detection-interval, and --deployment-author-poll-interval and --deployment-author-timeout are --deployment-rule-authoring-poll-interval and --deployment-rule-authoring-timeout. Setting --model-endpoint no longer enables any feature by itself.

agentshield rules

Manages CEL rulesets, reviews Deployment rules, and inspects detection signals and queues through agentshield rules <validate|save|activate|show|jobs|job|review|workload-rules|signals|investigations> [flags]. The agentshield-detector-rules executable remains as a compatibility entry point using the same implementation. See Detection rules.

FlagDefaultUsed byDescription
--fileemptyvalidate, saveRuleset JSON file. Required for those actions.
--idemptyactivate, showRuleset ID. Required for activate; optional for show.
--actoremptysave, activate, reviewAudit name. Required for those actions. Not authentication.
--expected-revision0activateCurrent activation revision; 0 means none is active.
--job-id0job, reviewDeployment rule-authoring job ID.
--decisionemptyreviewapproved runs the job’s rule in active mode; rejected stops loading it. Requires --actor.
--rule-idemptysignalsOnly signals from this rule.
--investigationemptysignalsOnly signals in this state: rule_finding, shadow, queued, below_threshold, disabled, or investigated.
--limit100signals, investigationsMaximum rows, newest first.
--database-url$AGENTSHIELD_DATABASE_URLall except validatePostgreSQL URL.

The command has a 30-second overall timeout. validate does not open a database; other actions require AGENTSHIELD_DATABASE_URL.

agentshield-deployment-author

Runs the Deployment rule author once against a local JSON context. No database. See Detection rules.

FlagDefaultDescription
--versionfalsePrint the version and commit, then exit.
--inputemptyAuthoring context JSON file. Required.
--model-endpoint$AGENTSHIELD_MODEL_ENDPOINTModel API base URL. Required for OpenAI unless --dry-run.
--model-api-keysee aboveAPI key, same lookup order as agentshield.
--modelprovider defaultModel override.
--model-provideropenaiProvider: openai or anthropic; endpoint defaults to the selected provider’s API.
--timeout5mMaximum model request duration.
--dry-runfalsePrint the exact first request body that would be sent and exit without making a provider request. Needs no endpoint or key.
--verbosefalseLog each add_rule call and a run summary (calls and accepted rules) to stderr at debug level. The proposal on stdout is unchanged.

agentshield-reasoning-mcp

Serves MCP tools over streamable HTTP at /mcp. The default listener is 127.0.0.1:8090; use --listen to change it only behind authenticated infrastructure. The server reads the packet and optional pinned telemetry context files and does not contact a database or model.

FlagDefaultDescription
--version(standalone option)Print the version and commit, then exit.
--packetemptyPath to an immutable reasoning packet. Required.
--telemetry-contextemptyOptional pinned telemetry and candidate-path context.
--listen127.0.0.1:8090HTTP listen address. Non-loopback exposure requires an authenticating proxy or equivalent.

Environment variables

VariableRead byPurpose
AGENTSHIELD_DATABASE_URLagentshield, agentshield rules, agentshield-detector-rules, evals/cmd, make run, make graph-uiPostgreSQL URL.
AGENTSHIELD_DATABASE_MAX_CONNS, AGENTSHIELD_DATABASE_MIN_CONNSagentshieldPool size defaults. Invalid integers fall back to the defaults.
AGENTSHIELD_CLICKHOUSE_PASSWORDagentshieldClickHouse password.
AGENTSHIELD_AWS_FIREHOSE_ACCESS_KEYagentshieldFirehose delivery stream access key. Required with --aws-firehose-stream-arn.
AGENTSHIELD_MODEL_ENDPOINTagentshield, agentshield-deployment-author, evals/cmdModel API base URL.
AGENTSHIELD_MODEL_API_KEYagentshield, agentshield-deployment-authorModel API key for either provider.
OPENAI_API_KEYagentshield, agentshield-deployment-author, eval scriptsOpenAI key fallback. The eval scripts require it unless AGENTSHIELD_EVAL_DETECTOR_ONLY=1.
ANTHROPIC_API_KEYagentshield, agentshield-deployment-authorAnthropic key fallback when --model-provider=anthropic.
AGENTSHIELD_MODELagentshield, evals/cmdModel name.
AGENTSHIELD_AGENTIC_INVESTIGATION, AGENTSHIELD_DEPLOYMENT_RULE_AUTHORINGagentshieldBoolean defaults for the two feature flags.
AGENTSHIELD_MODEL_REASONING_EFFORTagentshield, evals/cmdReasoning effort for compatible providers.
AGENTSHIELD_AGENTIC_INVESTIGATION_RETRIEVALagentshield, evals/cmdmodel_selected or deterministic.
AGENTSHIELD_EVAL_DETECTOR_ONLYeval scripts, evals/cmd1 runs evals without agentgateway, an API key, or model calls.
KUBERNETES_SERVICE_HOSTagentshieldWhen set and --kubernetes-kubeconfig is empty, use in-cluster Kubernetes config.
KUBECONFIGclient-go loading rules, evals/cmdKubeconfig path(s).
AWS_PROFILE, AWS_ACCESS_KEY_ID, …AWS SDKStandard AWS SDK credential chain.
AGENTSHIELD_EVAL_VARIANT, AGENTSHIELD_EVAL_OBSERVATION_ADAPTERevals/cmdEvaluation labels and observation adapter. See evals/README.md.
AGENTSHIELD_TEST_DATABASE_URLpkg/state and pkg/api testsDisposable test database. Tests truncate it.

Makefile and Docker Compose

VariableDefaultPurpose
LISTEN127.0.0.1:8088--listen for make run and make graph-ui; proxy target for make ui-dev.
DEMO_PORT5173Browser-only playground port for make demo.
DATABASE_URL$AGENTSHIELD_DATABASE_URLDatabase URL for make run and make graph-ui.
UI1UI=0 skips the Node/pnpm UI build for make build, make run, and make graph-ui.
GO, PNPMgo, pnpmTool overrides.
POSTGRES_PASSWORDnone (required)Password for make postgres-up (deploy/postgres/compose.yaml).
POSTGRES_USER, POSTGRES_DBagentshieldCompose database user and name.
POSTGRES_BIND, POSTGRES_PORT127.0.0.1, 5432Compose port binding.

The eval scripts in evals/scripts/ read more variables (cluster name, tool versions, output directory); see evals/scripts/lib.sh.

Status logs

Each long-running loop in agentshield logs what it is doing at Info level, without a line per iteration. Rare events get their own line: a plugin starting, a Deployment rule job being claimed and drafted, an investigation job starting and finishing, detection rules matching, and the detector loading a changed ruleset or workload rule set. Each loop also logs one status line with its counters since the previous line: at most every 15 seconds while it does work, and at most once a minute while it is idle.

LoopStatus lineCounters and fields
Discovery plugindiscovery pluginplugin, source, observations, contributions
Telemetry pipelinetelemetry pipelineaccepted, written, batches, queued, queue_capacity
Detection servicedetection servicewindows, changes, novelty_signals, rule_signals, shadow_signals, cursor, ruleset
Deployment rule authoringDeployment rule authoring workercompleted, failed, ready, running, retrying, waiting_for_baseline, baseline_window, next_baseline_ends_in
Agentic investigationinvestigation workerprocessed, failed

A Deployment rule draft that stays queued is usually inside its baseline window; waiting_for_baseline and next_baseline_ends_in show it. Author now in the UI, or POST /api/v1/workloads/{id}/rule-drafts, skips the wait.