AgentGuard

v0.3.1
io.github.MerchantGuard/agentguard Checked 1 day ago Published 2 months ago

Local spend caps, kill-switch blocking and Ed25519-signed receipts for AI agent tool calls.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

spend_decide

Gate a model call BEFORE it runs. Pass metadata only (model, token counts, endpoint URL), never prompt content. Returns allow/block plus an Ed25519-signed, content-free receipt with model and hosting provenance (weights origin, jurisdiction, retention). Unknown self-hosted models need set_model_cost first (fail-closed). Optional agent_id, task_id and workflow_id accept identifiers only; spend_decide binds them into the signed actor. Read-only and cost-configuration tools accept these fields without recording a spend decision.

ParameterTypeDescription
input_tokens *integerProjected input tokens
model *stringModel name, e.g. llama-3.1-8b-instruct or gpt-5-mini
output_tokens *integerProjected output tokens
agent_idstringOptional agent identifier; signed as actor.agentId on spend_decide
endpoint_urlstringEndpoint URL. Unrecognized endpoints route as self-hosted (zero retention, your jurisdiction).
task_idOptional task identifier; signed as actor.taskId on spend_decide
workflow_idOptional workflow identifier; signed as actor.workflowId on spend_decide

verify_receipt

Independently verify an AgentGuard signed receipt. Returns valid true/false. Tampering with any signed field makes verification fail. Optional agent_id, task_id and workflow_id accept identifiers only; spend_decide binds them into the signed actor. Read-only and cost-configuration tools accept these fields without recording a spend decision.

ParameterTypeDescription
receipt_json *stringThe signed receipt entry as a JSON string
agent_idstringOptional agent identifier; signed as actor.agentId on spend_decide
public_key_hexstringSigner public key (64 hex characters). Defaults to this server signer.
task_idOptional task identifier; signed as actor.taskId on spend_decide
workflow_idOptional workflow identifier; signed as actor.workflowId on spend_decide

export_receipts

Export the tenant decision ledger, including earlier process runs, as a hash-chained array of signed receipts with a chain verification result. Memory mode exports this process only. Optional agent_id, task_id and workflow_id accept identifiers only; spend_decide binds them into the signed actor. Read-only and cost-configuration tools accept these fields without recording a spend decision.

ParameterTypeDescription
agent_idstringOptional agent identifier; signed as actor.agentId on spend_decide
task_idOptional task identifier; signed as actor.taskId on spend_decide
workflow_idOptional workflow identifier; signed as actor.workflowId on spend_decide

set_model_cost

Register a cost for a model with no built-in pricing (required for self-hosted models: AgentGuard fails closed on unknown costs). Cents per 1,000 tokens. Optional agent_id, task_id and workflow_id accept identifiers only; spend_decide binds them into the signed actor. Read-only and cost-configuration tools accept these fields without recording a spend decision.

ParameterTypeDescription
input_cents_per_ktok *number
model *string
output_cents_per_ktok *number
agent_idstringOptional agent identifier; signed as actor.agentId on spend_decide
task_idOptional task identifier; signed as actor.taskId on spend_decide
workflow_idOptional workflow identifier; signed as actor.workflowId on spend_decide

provenance_preview

Preview the provenance AgentGuard would attest for a model and endpoint WITHOUT spending: model identity, weights origin country (China-origin families flagged), hosting jurisdiction, retention posture. Optional agent_id, task_id and workflow_id accept identifiers only; spend_decide binds them into the signed actor. Read-only and cost-configuration tools accept these fields without recording a spend decision.

ParameterTypeDescription
model *string
agent_idstringOptional agent identifier; signed as actor.agentId on spend_decide
endpoint_urlstring
task_idOptional task identifier; signed as actor.taskId on spend_decide
workflow_idOptional workflow identifier; signed as actor.workflowId on spend_decide

spend_status

Show the active policy: caps, tenant, enforcement mode, decisions so far this session, and the signer identity. Optional agent_id, task_id and workflow_id accept identifiers only; spend_decide binds them into the signed actor. Read-only and cost-configuration tools accept these fields without recording a spend decision.

ParameterTypeDescription
agent_idstringOptional agent identifier; signed as actor.agentId on spend_decide
task_idOptional task identifier; signed as actor.taskId on spend_decide
workflow_idOptional workflow identifier; signed as actor.workflowId on spend_decide