# Examples

## Maintained v1 examples

These examples are aligned with the current public API and should be treated as the supported starting points.

- `openaiExample.js`
  - requires `OPENAI_API_KEY`
  - provider-backed tool example
- `geminiExample.js`
  - requires `GEMINI_API_KEY`
  - provider-backed tool example
- `localToolExample.js`
  - no API key required
  - local tool loop demo
- `localRagExample.js`
  - no API key required
  - local retrieval demo
- `localRagToolExample.js`
  - no API key required
  - combined retrieval + tool demo
- `openaiRuntimeDemo.js`
  - requires `OPENAI_API_KEY`
  - advanced runtime demo for `v2`
- `openaiV3RuntimeDemo.js`
  - requires `OPENAI_API_KEY`
  - advanced runtime-OS demo for `v3`
- `openaiV4RuntimeDemo.js`
  - requires `OPENAI_API_KEY`
  - advanced runtime-control demo for `v4`

## Maintained v4 reference integrations

These examples are intended as reference deployment patterns rather than feature walkthroughs.

- `referenceExpressRuntimeServer.js`
  - requires `OPENAI_API_KEY`
  - shows how to expose runtime-backed runs over HTTP with approvals and inspection
- `referenceQueueWorker.js`
  - no API key required
  - shows queue-based distributed continuation where one process creates a run and a worker process consumes a handoff envelope from a shared queue
- `referenceIncidentDebug.js`
  - no API key required
  - shows how to inspect stored runs and export a portable trace bundle
- `referenceOperatorWorkflow.js`
  - no API key required
  - shows common operator tasks: run tree inspection, incident reporting, trace diffing, partial trace export, operator-centered summaries, intervention planning, cross-runtime triage, governance record capture, audit stitching, and governance timelines
- `referenceOperatorDashboard.js`
  - no API key required
  - shows a maintained operator dashboard snapshot, governance timeline panel, and a compact operator control loop
- `referenceEvalBenchmarks.js`
  - no API key required
  - shows maintained eval categories: prompt regression, tool selection accuracy, and RAG grounding
- `referenceReplayBenchmarks.js`
  - no API key required
  - shows replay-based runtime regression checks over stored runs
- `referenceAdaptiveBenchmarks.js`
  - no API key required
  - shows adaptive routing, policy suggestion, and governance-review benchmark checks
- `referenceV7Audit.js`
  - no API key required
  - prints a single end-to-end `v7` audit across learning, branch analysis, verifier composition, confidence policy, adaptive retry, routing, governance review, and adaptive benchmarks
- `referenceCoordinationReview.js`
  - no API key required
  - shows a first coordination-layer slice where structured critics review a runtime summary, task/risk/artifact-aware critique schemas apply defaults, trust scores weight the critics, a disagreement resolver chooses the next action, and a coordination loop executes that action
- `referenceDecompositionAdvisor.js`
  - no API key required
  - shows how the coordination layer can recommend direct execution, delegation, or split-and-delegate plans based on task complexity, risk, capabilities, and delegate trust
- `referenceCoordinationBenchmarks.js`
  - no API key required
  - shows maintained coordination benchmark scenarios for critique, resolution, loop execution, and decomposition planning using `EvalHarness`
- `referenceCoordinationPolicyGate.js`
  - no API key required
  - shows policy gating of coordination outcomes so runtime policy can require escalation or deny automatic retry paths
- `referenceRoleAwareCoordination.js`
  - no API key required
  - shows public planner/executor/verifier/critic/aggregator role contracts, trust-weighted role assignment, route-aware execution/verification targets, and an inspectable coordination trace
- `referenceAdvancedDisagreement.js`
  - no API key required
  - shows task-family and role-aware trust records plus disagreement resolution with the `trust_consensus` strategy
- `referenceCoordinationVerification.js`
  - no API key required
  - shows strategy-selected single-pass vs multi-pass coordination verification, including adversarial verifier/critic/aggregator review plus capability-routed verification targets for high-risk work
- `referenceCoordinationQuality.js`
  - no API key required
  - shows verifier-quality and executor-quality tracking as separate coordination-quality surfaces
- `referenceCoordinationDiagnostics.js`
  - no API key required
  - shows operator-facing coordination diagnostics for disagreement, missing roles, escalation, and quality warnings
- `referenceGovernedImprovement.js`
  - no API key required
  - shows explicit learned-improvement artifacts, concrete action plans, bounded adaptation envelopes, governed review requests, artifact comparison, effect summaries, learning benchmarks, and regression-guard decisions built from runs and evals
- `referenceFleetRollout.js`
  - no API key required
  - shows staged rollout artifacts, fleet health summaries, canary halt/rollback decisions, fleet safety throttling/halt controls, before/after rollout impact comparison, and rollback advice for broader regressions
- `referenceCapabilityRouter.js`
  - no API key required
  - shows capability-aware route ranking across model, simulator, and human candidates with trust-zone, cost/risk, certification, reputation, and historical-outcome signals
- `referenceAssuranceSuite.js`
  - no API key required
  - shows explicit invariants, branch/replay/recovery/coordination assurance scenarios, operator-facing assurance verdicts, rollout guardrails, and rollback/quarantine planning
- `referenceProductionPolicyPack.js`
  - no API key required
  - shows a maintained production-oriented policy/governance pack contributing policy rules and governance hooks through `ExtensionHost`
- `referencePolicySimulation.js`
  - no API key required
  - shows portable policy artifacts, simulation, evaluation artifacts, and eval-harness policy scenarios
- `referencePolicyInheritance.js`
  - no API key required
  - shows scoped policy inheritance across runtime, workflow, agent, and distributed handoff layers
- `referencePolicyLifecycle.js`
  - no API key required
  - shows draft promotion and rollback between active policy versions
- `referenceApprovalEscalationPolicySuite.js`
  - no API key required
  - shows maintained pre-rollout approval and escalation policy scenarios in one eval-style report
- `referenceRecoveryPolicyGate.js`
  - no API key required
  - shows policy-aware constraints over branch and replay recovery actions
- `referenceCompensationPolicyPlanner.js`
  - no API key required
  - shows policy-aware compensation recommendations for side-effecting steps
- `referenceStateBundle.js`
  - no API key required
  - shows portable state-bundle export, restore, and high-level drift diffing
- `referenceStateRestorePlanner.js`
  - no API key required
  - shows cross-environment restore planning from a portable state bundle plus durable restore scenarios for process, queue, and service boundaries
- `referenceStateIncidentReconstructor.js`
  - no API key required
  - shows offline incident reconstruction directly from a portable state bundle
- `referenceFileBackedStack.js`
  - no API key required
  - shows a local-first persisted deployment stack using file-backed run/job/memory stores plus approval and governance handling
- `referenceWorkerCoordinationBenchmarks.js`
  - no API key required
  - shows maintained worker-coordination evals for delegated workflow lineage, child-run aggregation, and contract enforcement
- `referenceRuntimeExtension.js`
  - no API key required
  - shows a community-facing extension example contributing an event sink, policy rule, and eval scenario through `ExtensionHost`
- `referenceInteropManifest.js`
  - no API key required
  - shows a public extension manifest plus conformance validation for extension and store integrations
- `referenceInteropArtifacts.js`
  - no API key required
  - shows shared compatibility validation for trace, policy, state, eval, and manifest artifacts
- `referenceExternalConformanceFlow.js`
  - no API key required
  - shows a third-party-style file-based validation flow using only the published interop validator surface
- `referenceCertificationKit.js`
  - no API key required
  - shows public certification results for a provider adapter and backend store plus a compatibility rollup summary
- `referenceInteropRegistry.js`
  - no API key required
  - shows one public import/export registry across tool, trace, policy, eval, and manifest artifacts
- `referenceOpenApiImport.js`
  - no API key required
  - shows importing a small OpenAPI spec into runtime tools
- `referenceCurlImport.js`
  - no API key required
  - shows importing a `curl` command into an API spec and executable runtime tools
- `referenceUtilityToolkit.js`
  - no API key required
  - shows Postman import, secret resolution, tool recording/mocking, sandboxing, prompt artifacts, run recipes, incident bundling, and route simulation
- `referenceEverythingSmoke.js`
  - no API key required
  - runs one smoke check across OpenAPI import, curl import, Postman import, secret resolution, tool recording/mocking, sandboxing, recipes, and route simulation
- `referenceMemoryGovernance.js`
  - no API key required
  - shows memory provenance, retention-based forgetting, trust-zone read blocking, and trust-weighted conflict resolution
- `referenceMemoryGovernanceReview.js`
  - no API key required
  - shows memory audit summaries, provenance/contract benchmark checks, diagnostics, and an operator review checklist
- `referenceDurableBackends.js`
  - no API key required
  - shows custom durable run/job/layer store implementations and registry usage
- `referenceDistributedHandoff.js`
  - no API key required
  - shows a run created in one process and continued in another through a shared run store and distributed handoff envelope
- `referenceDistributedIncident.js`
  - no API key required
  - shows distributed incident reconstruction with correlation metadata, incident reports, and portable trace export
- `referenceRemoteControlPlane.js`
  - no API key required
  - shows governance callbacks and runtime events being forwarded to a remote control-plane service
- `referencePublicControlPlane.js`
  - no API key required
  - shows a thin public control-plane view built from durable runs, run trees, incident reports, trace diffs, and portable trace bundles
- `referenceDeploymentSplit.js`
  - no API key required
  - shows an API service, worker, and control plane sharing runtime stores and callback transports
- `referenceDistributedRecovery.js`
  - no API key required
  - shows turning a distributed incident into a structured recovery plan and then executing the recommended recovery action

## Legacy / advanced examples

The remaining files in this folder are historical or advanced experiments. They are not part of the maintained `v1` surface and may depend on integrations, models, or internal modules that are not yet stabilized.
