Before you start
Install the SDK, observe an API call, inspect the result, and learn how to enable verified repair. AGINDOW runs inside your application around a call you already own. It can detect configured drift signals and apply eligible repairs when explicitly configured. Allow about five minutes with Node 22.6+ (for the TypeScript run command) or Python 3.11+, a working project (and Python virtual environment), and an existing read-only endpoint that returns JSON. This first pass connects the SDK; it does not yet configure drift detection. You need no separate AGINDOW API key, account or hosted service.
1. Install the SDK
Choose one language. In your project directory, run npm install agindow@0.1.0-alpha.4 for Node, or pip install agindow==0.1.0a3 in your Python environment. Packages include the engine; no Rust build or extra HTTP library is required. The version notice above tells you whether this pair is published or still prepared for release.
npm install agindow@0.1.0-beta.1pip install agindow==0.1.0b12. Wrap one API call
Choose the TypeScript or Python tab below. Save it as quickstart.mts or quickstart.py. The sample makes one JSON GET to API_URL using the standard HTTP client. For an API that needs authentication, keep its headers and credentials in your existing client and replace only the readApi / read_api function. sdk.guard wraps the function; the call returns your API result. Start in observe: it reports configured findings without changing the payload or blocking the call. Use a read you can safely run once.
import { createAgindow } from 'agindow';
const sdk = createAgindow({ mode: 'observe' });
await sdk.ready;
sdk.on('drift', event => console.log('Drift:', event.verdict));
async function readApi(url: string): Promise<unknown> {
const response = await fetch(url, { signal: AbortSignal.timeout(10_000) });
if (!response.ok) throw new Error(`API returned ${response.status}`);
const result: unknown = await response.json();
return result;
}
const read = sdk.guard(readApi, { tool: 'vendor.read', operation: 'read' });
const url = process.env.API_URL;
if (!url) throw new Error('Set API_URL to your JSON GET endpoint.');
const result = await read(url);
console.log('API result:', result);
console.log('AGINDOW events:', sdk.recent().map(event => event.type));import json
import os
from urllib.request import urlopen
from agindow import Agindow
sdk = Agindow(mode="observe")
sdk.on("drift", lambda event: print("Drift:", event.verdict))
def read_api(url: str) -> object:
with urlopen(url, timeout=10) as response:
result: object = json.load(response)
return result
read = sdk.guard(read_api, tool="vendor.read", operation="read")
try:
result = read(os.environ["API_URL"])
print("API result:", result)
print("AGINDOW events:", [event.type for event in sdk.recent()])
finally:
sdk.close()3. Run and inspect
Set API_URL in your terminal to your working HTTPS JSON endpoint. Then run node --experimental-strip-types quickstart.mts or python quickstart.py. Your normal vendor credentials are still required if the endpoint needs them. Expect your API response followed by AGINDOW events: [] when the engine loads and no detector or repair rule is selected. sdk.recent() contains recent local events; the listener prints findings when detection is configured. An empty event list does not prove there was no drift.
# Replace this with your existing read-only JSON endpoint.
export API_URL="https://your-api.example/read-only-endpoint"
# Run ONE command for the language you saved:
node --experimental-strip-types quickstart.mts
# or: python quickstart.py| What you see | What it means |
|---|---|
| API result: … | The guarded function returned the API response. The SDK does not wrap it in a status object. |
| AGINDOW events: [] | No events were emitted. With this unconfigured instance, no drift finding is expected. |
| bypass in the event list | Inspection was unavailable or skipped; the original call still ran. Check SDK readiness and configuration. |
| An HTTP, network or JSON error | The original API call failed. Check the URL, vendor authorization and response before adding detection. |
4. Configure drift detection
The statistical guest is default; configure windows to detect. Wrapping a call does not automatically learn its baseline. Supply representative baseline and current-traffic JSON windows for the same operation, select the fields to compare, and create the SDK with that selection. A configured drift finding appears in the drift listener and sdk.recent(). Keep observe mode while you evaluate the evidence. The detection guide contains the complete runnable example and explains how to replace its demonstration data with your own windows.
5. Enable verified repair when ready
Selective repair is off by default. For a supported top-level field rename, configure reviewed migration rules and an independent synchronous verifier with selectiveRepair in Node or selective_repair in Python. Start with those rules in observe mode, then choose repair only after verifying them against your application. Changing the mode alone does not create a repair rule. A drift event reports a finding; a repair event means an accepted patch was applied. strict can halt unresolved drift; it is not a shortcut to setup. Automatic source fixes and hosted draft PR creation are not enabled by this integration.