Skip to content

You are currently viewing documentation for0.1.0-alpha.4

Saved documentation for 0.1.0-alpha.4 (npm) / 0.1.0a3 (PyPI). Interactive tools use the current release. View latest documentation.

Execute a tool call — POST /v1/guard

Execute a configured tool

Send an explicit JSON execution envelope to your own guard host. Use http://SIDECAR_HOST:8789, replacing SIDECAR_HOST with your configured local sidecar hostname; a Unix socket is also supported. A configured connection selects the upstream tool and its credentials; callers cannot supply arbitrary upstream URLs or authorization headers. This is a separate execution host from the read-only MCP interface. Managed guard execution is not available.

Request fields

Use Content-Type: application/json. Unknown top-level fields are rejected. Required fields have no implicit mode or operation default on HTTP.

FieldType / presenceMeaning / constraint
toolstring; requiredConfigured tool name; 1–256 UTF-8 bytes, no control characters or slash.
connectionstring; requiredAuthorized connection handle; same identifier bounds as tool. Not a credential.
operationread | write | unknown; requiredMust match the configured route. Treat unknown as a write for idempotency.
argsJSON value; requiredUpstream request arguments; at most 8 MiB of encoded JSON.
modeobserve | repair | strict; requiredPolicy for both inspection phases; observe does not mutate or block.
idempotency_keystring; required for write/unknown1–256 UTF-8 bytes, no controls; forwarded as Idempotency-Key. The upstream must enforce deduplication.
metadataobject; optionalDefaults to {}. Does not grant authority or configure the detector.
durabilityreserved; omitA non-null value is rejected. No durability service is selected through this request.

Try a configured local read

Requires a running sidecar with conn_example/vendor.read already bound to a read operation. Replace both handles with your configured values. The response body comes from that upstream; there is no universal AGINDOW success JSON wrapper.

bash
curl -i http://SIDECAR_HOST:8789/v1/guard \
  -H 'Content-Type: application/json' \
  --data '{"tool":"vendor.read","connection":"conn_example","operation":"read","args":{},"mode":"observe"}'

Successful or passed-through response

The upstream HTTP status, content type and original body are returned when no policy halt applies. A vendor 4xx or 5xx can therefore be a completed upstream outcome. Inspect X-Agindow-Status separately from HTTP status. This illustrative 200 body belongs to a fictional upstream, not a fixed AGINDOW response schema.

json
{"id":"example-record","amount":2000}

Diagnostic headers

Headers describe this call, not a protection guarantee. They may be absent when the host rejects a request before execution. Do not require numeric latency when the clock is unavailable.

HeaderMeaning
X-Agindow-Statusok, repaired, degraded, bypassed or blocked. Current execution hosts do not apply selective repair.
X-Agindow-ModeResolved observe, repair or strict policy when supplied.
X-Agindow-AuditArtifact ID, not a URL or promise of durable retention.
X-Agindow-Drift-Classshape, semantic or unknown; present when drift evidence is available.
X-Agindow-Drift-Siderequest, response or both; identifies which inspection phase found drift.
X-Agindow-Latency-MsActive guard overhead excluding upstream waits; numeric locally or unavailable.
X-Agindow-Latency-ClockClock source used by the remote execution host; may be unavailable.
X-Agindow-OutcomeRelative retained-outcome URL on a completed response halt. Read it; do not blindly replay a write.
X-Agindow-Upstream-StatusOriginal upstream status on a local sidecar response halt.
X-RateLimit-Limit / Remaining / ResetWhen emitted by an authenticated remote host: allowance, remaining count and reset Unix seconds.
X-Agindow-Quota-Scopeisolate when emitted; limits are local to an execution instance, not a global quota guarantee.

Policy refusal: HTTP 409

An AGINDOW policy refusal has X-Agindow-Status: blocked and exactly six string fields below. repair uses drift_blocked; strict uses drift_halted. Observe never produces a policy block. A request halt means no dispatch. A response halt means the upstream already completed; inspect the retained outcome. An upstream 409 alone does not establish an AGINDOW policy refusal.

json
{
  "error": "drift_blocked",
  "tool": "vendor.write",
  "drift_class": "semantic",
  "drift_id": "aud_example",
  "hint": "Upstream completed. Inspect the retained outcome; do not blindly replay a write.",
  "audit": "/v1/audit/aud_example"
}

Request validation, capacity and transport errors

When the guard rejects a request before execution, it generally uses {"error":"code"}; framework limits or origin refusals may have a plain or empty body. Upstream bodies use the vendor format. Do not assume every non-2xx response is JSON or safe to retry.

HTTP / codeMeaningNext action
400 invalid_requestMalformed JSON, unknown field, invalid/mismatched route operation, missing idempotency key or unsupported durability.Fix the envelope before retrying.
401 unauthorizedConnection/tool not admitted locally, or remote credential missing/invalid.Check the handles and credential; do not switch tenants to retry.
403Local Host/Origin refused, or remote authorization/plan restriction.Use the intended local origin or resolve access with the host owner.
404 not_foundUnknown route or missing retained evidence.Check the path; a missing receipt does not prove non-execution.
409 drift_blocked / drift_haltedKnown policy refusal; distinguish request and completed response.Inspect feedback and retained outcome; do not blindly replay.
413 invalid_request or framework body limitEnvelope exceeds 8 MiB + 64 KiB, or arguments exceed the inspection bound.Reduce the request; do not silently split a logical write.
429 rate_limitedThis remote execution instance has reached its request limit.Wait for the indicated reset if present; preserve the same logical idempotency key.
502 internalSidecar could not obtain/read an upstream response.Outcome may be uncertain. Reconcile writes before retrying.
503 internal / identity_unavailableGuard or authentication unavailable.Use an explicit SDK fallback if configured, with the same upstream-enforced key for writes.

Limits and retry safety

The statistical guest is default; configure windows to detect. Configure detection separately; selecting a mode is insufficient. Response inspection requires a complete body within the configured size limit; streams, encoded or incomplete evidence can bypass inspection. A malformed whole body is not repaired. The local vendor timeout is 30 seconds. Client timeouts do not cancel an already completed vendor write. SDK remote helpers default to five seconds and require a caller-supplied fallback. Audit and outcome records have fixed retention limits and do not provide durable replay.