Loading...
Loading...
OmegaEngine · Human-in-the-Loop
High-risk authorizations stop for genuine human review. A signed-in organization reviewer approves in the ops queue; the agent then claims a one-use exact-action capability and sends it to the consuming executor.
Your agent calls POST /api/authorize. OmegaEngine evaluates risk level, policy compliance, and safety checks.
Give human_action_url to a signed-in organization reviewer. approval_status_url requires that human session, not an agent API key. The agent must not vote or borrow the reviewer's cookie. Configured approval webhooks may notify your application.
Once approved, the agent claims a one-time execution_capability token at POST /api/authorize/approval/claim. Second claims are rejected (409), and everything is logged.
Configure the organization's GitHub connector first, with Developer+ access and a live org-bound key. These server-side examples use exactly connector/github/create_issue, not an alias or an unconsuming callback. Test keys, shadow responses and financial tools cannot execute. See the full quickstart for prerequisites and release-parity limits. A timeout is uncertain; reconcile before fresh authority.
import { OmegaClient } from "@omegaengine/sdk";
const omega = new OmegaClient({
baseUrl: "https://omegaengine.ai",
apiKey: process.env.OMEGA_API_KEY!,
});
const intent = {
"agent_id": "repo-agent",
"action": "create_issue",
"tool_name": "connector/github/create_issue",
"tool_args": {
"owner": "your-org",
"repo": "sandbox",
"title": "Governed follow-up",
"body": "Exact issue content reviewed before dispatch"
},
"amount": 0,
"vendor": "GitHub",
"risk_level": "high"
} as const;
// This function is also used after a genuine human approval is claimed.
async function executeApprovedIssue(executionCapability: string) {
const response = await fetch("https://omegaengine.ai/api/connectors/execute", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.OMEGA_API_KEY!,
},
body: JSON.stringify({
connector: "github",
action: "create_issue",
payload: intent.tool_args, // Do not change after authorization.
capabilityToken: executionCapability,
}),
});
const execution = await response.json();
if (!response.ok || execution.ok !== true || execution.result?.success !== true) {
throw new Error("Execution blocked, failed, or uncertain; inspect org evidence before retrying");
}
return execution.result; // Keep IDs and the validated outcome; never log tokens.
}
const authz = await omega.authorize(intent, {
idempotencyKey: "repo-run-42-issue-1", // Stable for retries of this intent only.
});
// If escalated, stop here. Give authz.human_action_url to a signed-in
// organization reviewer, then use the separate claim step after genuine review.
if (authz.decision !== "approved" || authz.mode !== "live" ||
!authz.execution_capability) {
throw new Error("Blocked: denied, escalated, test/shadow, or missing capability");
}
await executeApprovedIssue(authz.execution_capability);If escalated, stop. After genuine review, resume the same intent with this claim step. Claim responses have no mode field; the endpoint checks live execution scope.
// Resume the SAME intent and executeApprovedIssue function from above.
// Only after the linked human has approved in their own organization session:
const claimed = await omega.claimAuthorization({
authorization_id: authz.authorization_id!,
agent_id: intent.agent_id,
});
// The claim response has no mode field. Its endpoint requires a live,
// execution-scoped key and returns authority only after fresh server checks.
if (claimed.ok !== true || claimed.decision !== "approved" || !claimed.execution_capability) {
throw new Error("Blocked: no claimed exact-action capability");
}
await executeApprovedIssue(claimed.execution_capability);
// Pending/rejected/expired or changed policy stays blocked. Do not cast a vote
// with the agent key, borrow a human cookie, or edit/reissue an old capability.// Fired to your configured approval webhook (APPROVAL_WEBHOOK_URL)
// on escalated | approved | rejected — HMAC-signed when a secret is set.
{
"event": "approved",
"timestamp": "2026-02-05T15:30:00Z",
"approval": {
"id": "apr_abc123",
"title": "create_issue",
"kind": "authorize_action",
"riskScore": 0.82,
"agentId": "repo-agent",
"status": "approved",
"escalationLevel": 0,
"reviewedBy": "user_reviewer"
},
"sla": {
"timeoutHours": 24,
"deadline": "2026-02-06T15:30:00Z",
"currentRole": "operator"
}
}Escalated decisions carry a machine-readable reason_code so agents can react programmatically:
The evaluated risk score crossed the escalation threshold — a human must approve before execution.
The action's category (e.g. financial, destructive) is configured to always require human approval.
Layered safety checks flagged the request for human review instead of outright denial.
Policy marks this exact action as approval-gated regardless of score.
A successful claim returns a single-use execution_capability token with an expiry. A second claim returns 409 CAPABILITY_ALREADY_CLAIMED.
Claims require an Idempotency-Key header — retries replay the original result instead of double-claiming.
HMAC-signed webhooks fire on escalated, approved, and rejected — point them at Slack, PagerDuty, or your own service.
Approvals carry an SLA deadline and escalation level, surfaced in the webhook payload and the ops queue.
View, approve, or reject pending decisions in the review dashboard. Available to authorized reviewers in your organization.
HITL is not a separate add-on — it is included in the Developer plan ($299/mo) and above. See the pricing page for the full plan comparison.