Build with Ametriq
Check AI requests and agent actions with the AIGuard API, and scan your code with the Spectra CLI from your terminal or CI. Both write every decision and finding to your console, where your team reviews them.
- AIGuard: call one endpoint before each model or tool step. Start here.
- Spectra: run
npx @ametriq/spectra scan .in any repository. Start here. - CyberShield: installed per device and managed from its dashboard. Setup guides are shared during your pilot. See where it runs.
- Free MCP Security Scanner: no account needed. Paste a public Git URL for an MCP server and get a report mapped to the OWASP MCP Top 10. Scan a server.
Consoles and sign-in
Each product has its own console. Accounts are set up for your organisation when your pilot or plan starts.
- AIGuard: aiguard.ametriq.ai.
- Spectra: spectra.ametriq.ai. Create CLI tokens under Settings → API tokens.
AIGuard: evaluate a request
Send each prompt, and each tool call an agent wants to make, to POST /api/ai/evaluate before it runs. AIGuard checks it against your policy and returns a decision. Authenticate with a bearer token; your endpoint URL and credentials are issued when your workspace is set up.
curl -X POST "$AIGUARD_URL/api/ai/evaluate" \
-H "Authorization: Bearer $AIGUARD_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"tenantId": "acme",
"userId": "u-4821",
"prompt": "Refund order 7731 in full",
"chatContext": { "appId": "support-agent" },
"requestedTools": [{
"type": "mcp",
"server": "payments",
"toolName": "refund",
"arguments": { "orderId": "7731", "amount": 18400 }
}]
}'{
"requestId": "5c0e9a2f-…",
"decision": "EscalateForApproval",
"riskSummary": { "totalScore": 0.82, "riskLevel": "High" },
"triggeredPolicies": ["payments.refund.above-agent-limit"],
"reasons": ["Refund is above the amount this agent may approve"],
"recommendedUserMessage": "This refund needs a person to approve it."
}Request fields
All fields are JSON, in camelCase. Send the ones that apply to the step you are checking.
| Field | Type | What it is |
|---|---|---|
tenantId | string | Your workspace. Policies, evidence and approvals are kept separate per tenant. |
userId | string | The person or service the request is for. |
sessionId | string | Groups requests from one session. |
prompt | string | The prompt or instruction to check. |
chatContext | object | conversationId and appId, so decisions are tied to the right app. |
requestedTools | array | Tool calls the agent wants to make: type (for example mcp), server, toolName and arguments. |
browserSignals | object | Optional. Set by CyberShield when it is deployed alongside AIGuard. |
Response fields
| Field | Type | What it is |
|---|---|---|
requestId | string | Use it to find the decision and its evidence in the console. |
decision | string | One of the five decisions below. |
blocked | boolean | True when the request must not go ahead. |
riskSummary | object | An overall risk score and level for the request. |
triggeredPolicies | string[] | The policies that matched. |
reasons | string[] | Plain-language reasons for the decision. |
recommendedUserMessage | string | A message you can show the user. |
modelOutput | string | null | When AIGuard is your model gateway: the answer, after output checks. Null when blocked or escalated. |
redactedOutput | string | null | The answer with sensitive data masked, when the decision is Redact. |
processedAt | timestamp | When the decision was made. |
Decisions
Act on the decision before running the model or the tool.
| Decision | What your app should do |
|---|---|
Allow | In policy. Go ahead. |
AllowWithWarning | Go ahead, and show the user the recommended message. |
Redact | Go ahead with redactedOutput instead of the raw answer. |
Block | Stop. Show the user the recommended message. |
EscalateForApproval | Hold the action until a person approves it in the console. |
Streaming
POST /api/ai/evaluate/stream takes the same request. When AIGuard is your model gateway, it streams the answer as it is generated and checks the output on the way. Each event has a type and a sequence number; text events carry text, and the final event carries the full decision in result.
Spectra CLI: install and scan
The Spectra CLI (@ametriq/spectra on npm, Apache 2.0, no runtime dependencies) packages the source code in a folder, uploads it to Spectra, starts a scan and can wait for the result. You need Node.js 20 or newer and a Spectra account with the Member, Admin or Owner role.
- In the Spectra console, open Settings → API tokens and create a token. It starts with
spk_and is shown once. - Preview the upload. A dry run needs no token and uploads nothing.
- Put the token in
SPECTRA_TOKENand run the scan. The CLI reads the token only from the environment, so it never lands in your shell history.
npx @ametriq/spectra scan . --dry-run
export SPECTRA_TOKEN=spk_...
npx @ametriq/spectra scan . --waitPackaging 412 files (3.1 MB) from /home/alex/code/my-service
upload complete; the server is unpacking it
Scan started: run 96fd0fd8-953c-4c18-81cf-3894e644ff49
scanning
completed
Scan completed: run 96fd0fd8-953c-4c18-81cf-3894e644ff49
25 findings. Review them in the Spectra console.Inside a git repository, only tracked and untracked-but-not-ignored source files are uploaded. Vendored, generated and minified code, binaries and symbolic links are left out. Add --list to a dry run to see every file and why.
Options
Usage: spectra scan [folder] [options]. The folder defaults to the current folder.
| Option | What it does |
|---|---|
--dry-run | Show what would be uploaded, then exit. No token, no upload. |
--list | With --dry-run, list every file and why it was included or excluded. |
--wait | Wait for the scan to finish and report the result. |
--timeout <time> | How long --wait waits, such as 90s, 30m or 1h. Default 30m. |
--llm <mode> | LLM verification of findings: off (default), cloud, council or local. |
--name <name> | The project name shown in the console. Default: the folder's name. |
--help, --version | Show help, or the CLI's version. |
Run in CI
Store the token as a CI secret named SPECTRA_TOKEN, never in the repository. A scan with findings does not fail the job; the CLI exits 0 whenever the scan completes. Review findings in the console.
# .github/workflows/spectra.yml
name: Spectra scan
on:
push:
branches: [main]
workflow_dispatch:
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npx @ametriq/spectra@0.1.3 scan . --wait --timeout 45m
env:
SPECTRA_TOKEN: ${{ secrets.SPECTRA_TOKEN }}# .gitlab-ci.yml
spectra-scan:
image: node:20
script:
- npx @ametriq/spectra@0.1.3 scan . --wait --timeout 45mExit codes
| Code | Meaning |
|---|---|
0 | The scan started (without --wait), completed (with --wait), or the dry run finished. |
2 | The scan failed or was cancelled. The reason is printed. |
3 | --wait ran out of time. The scan is still running in Spectra. |
4 | The scan couldn't start or be followed: a usage mistake, a missing or rejected token, or a network problem. |
130 | You interrupted the CLI. A scan that had already started keeps running. |
Support and security
Questions, or something not working? Write to contactus@ametriq.ai and include the request ID or scan run ID. To report a security issue in Ametriq, write to the same address; see the trust center for how we handle your data.