First Agent Loop
Aionis becomes useful when your Agent loop reports what happened, asks for governed context, and sends outcome attribution back.
observe -> guide -> agent action -> feedback -> measure -> snapshotMinimal Shape
import {
agentPromptFromGuide,
feedbackFromGuide,
} from "@aionis/sdk";
const guide = await aionis.guide({
query_text: "Continue from the latest accepted route.",
context_mode: "compact_agent",
});
const result = await agent.run(agentPromptFromGuide(guide));
const usedMemoryIds = result.usedMemoryIds ?? [];
if (usedMemoryIds.length > 0) {
await aionis.feedback(feedbackFromGuide({
guide,
run_id: result.runId,
outcome: result.ok ? "positive" : "negative",
reason: result.summary,
used_memory_ids: usedMemoryIds,
used_surface: "use_now",
}));
}What This Proves
| Step | Why it matters |
|---|---|
observe | Records evidence instead of only storing a text note. |
guide | Compiles current, inspect, suppressed, and rehydrate surfaces. |
| Agent action | Lets your own Agent host decide and execute. |
feedback | Attributes outcome only to memory exposed by that guide. |
measure | Reports whether memory helped or created risk. |
snapshot | Produces replayable operator context. |
Run It
npm run -s runtime:quickstart:sdkThen choose your host path in Choose an Integration.