@surasak-tm24/governance-runtime
v1.0.1
Published
OpenClaw Governance Runtime - IGF-compliant AI agent governance with execution engine, federated learning, and policy enforcement
Downloads
19
Maintainers
Readme
@openclaw/governance-runtime
IGF-compliant AI agent governance runtime with execution engine, federated learning, and policy enforcement.
Features
- ✅ Governance Runtime - IGF v9.3 compliant governance
- ✅ Execution Engine - 14-state execution lifecycle
- ✅ Federated Learning - Privacy-preserving distributed learning
- ✅ Conflict Resolution - Auto-resolve model conflicts
- ✅ Human Approval - Multi-level review workflow
- ✅ Policy Enforcement - Runtime policy checks
- ✅ Risk Scoring - Real-time risk assessment
Installation
npm install @openclaw/governance-runtimeQuick Start
import { createServer } from '@openclaw/governance-runtime';
// Start the governance API server
const { runtime, executionEngine } = createServer({
port: 4010,
mode: 'normal'
});
// Check health
console.log(runtime.getHealthStatus());Usage
Governance Runtime
import { GovernanceRuntime } from '@openclaw/governance-runtime';
const runtime = new GovernanceRuntime({
mode: 'normal',
riskThreshold: 0.7
});
await runtime.initialize();
// Check status
const status = runtime.getHealthStatus();
console.log(status);Execution Engine
import { ExecutionEngine } from '@openclaw/governance-runtime';
const engine = new ExecutionEngine();
// Create execution
const execution = await engine.createExecution({
type: 'skill',
skill: 'ai-agent',
payload: { action: 'process' },
priority: 5
});
// Start execution
await engine.startExecution(execution.id);
// Complete execution
await engine.completeExecution(execution.id, { result: 'success' });Federated Learning
import { FederatedLearningEngine } from '@openclaw/governance-runtime';
const fl = new FederatedLearningEngine({
minClients: 3,
rounds: 10
});
// Register clients
fl.registerClient('client-1', [1, 2, 3]);
fl.registerClient('client-2', [4, 5, 6]);
fl.registerClient('client-3', [7, 8, 9]);
// Train
await fl.train();
// Get global model
const model = fl.getGlobalModel();Human Approval
import { HumanApprovalSystem } from '@openclaw/governance-runtime';
const approval = new HumanApprovalSystem({
requiredApprovals: 2
});
// Create request
const request = approval.createRequest({
type: 'model_deployment',
title: 'Deploy new model',
description: 'Deploy federated model to production',
requester: 'system'
});
// Approve
approval.approve(request.id, 'admin-1', 'LGTM');
approval.approve(request.id, 'admin-2', 'Approved');API Reference
GovernanceRuntime
| Method | Description |
|--------|-------------|
| initialize() | Initialize runtime |
| getHealthStatus() | Get health status |
| validateExecution() | Validate execution |
| registerSkill() | Register a skill |
ExecutionEngine
| Method | Description |
|--------|-------------|
| createExecution() | Create execution |
| startExecution() | Start execution |
| completeExecution() | Complete execution |
| failExecution() | Fail execution |
| getExecution() | Get execution |
| getAllExecutions() | Get all executions |
FederatedLearningEngine
| Method | Description |
|--------|-------------|
| registerClient() | Register client |
| trainLocalModel() | Train local model |
| aggregateModels() | Aggregate models |
| runRound() | Run one round |
| train() | Full training |
License
MIT
