Site search

Find architecture, research, and terms

Start typing to search the editorial index.

Conceptual referenceIntermediate

Machine Intelligence Runtime Quickstart

A coherent conceptual C# quickstart for a reversible dependency-update run with lifecycle state, policy, checkpoint, tool execution, tests, and evidence.

Scenario

Objective
Prepare a dependency update in an isolated workspace.
Risk class
Reversible change.
Success criteria
Compatible version selected, tests pass, reviewable diff produced, no deployment without approval, and evidence package complete.

The code below is conceptual reference code. It does not import or imply a MiRuntime NuGet package.

Build steps

  1. Create a runtime contract.
  2. Persist a run in created.
  3. Transition to provisioning.
  4. Select allowed context.
  5. Call the model through IModelAdapter.
  6. Validate the proposal schema.
  7. Evaluate policy and create a checkpoint.
  8. Invoke a typed tool connector and run tests.
  9. Recover if needed and produce the evidence package.
  10. Transition to a terminal state.

C# reference contracts

using System.ComponentModel.DataAnnotations;

/// <summary>Requests creation of a governed runtime run.</summary>
public sealed record RunRequest
{
    /// <summary>Gets the externally authorized objective.</summary>
    [Display(Name = "Objective")]
    public required string Objective { get; init; }

    /// <summary>Gets the success conditions evaluated before completion.</summary>
    [Display(Name = "Success Criteria")]
    public required IReadOnlyList<string> SuccessCriteria { get; init; }

    /// <summary>Gets the latest instant at which the run may continue.</summary>
    [Display(Name = "Deadline At Utc")]
    public required DateTimeOffset DeadlineAtUtc { get; init; }
}

/// <summary>Defines the immutable controls applied to a run.</summary>
public sealed record RuntimeContract
{
    /// <summary>Gets the stable contract version.</summary>
    [Display(Name = "Contract Version")]
    public required string ContractVersion { get; init; }

    /// <summary>Gets the allowed tool keys.</summary>
    [Display(Name = "Allowed Tools")]
    public required IReadOnlySet<string> AllowedTools { get; init; }

    /// <summary>Gets the maximum orchestration steps.</summary>
    [Display(Name = "Maximum Steps")]
    public required int MaximumSteps { get; init; }
}

/// <summary>Creates and advances governed runs.</summary>
public interface IRuntimeOrchestrator
{
    /// <summary>Creates a durable run in the created state.</summary>
    /// <param name="request">The external objective and success criteria.</param>
    /// <param name="contract">The immutable runtime controls.</param>
    /// <param name="cancellationToken">Signals cancellation of the I/O operation.</param>
    /// <returns>The stable run identifier.</returns>
    Task<string> CreateRunAsync(
        RunRequest request,
        RuntimeContract contract,
        CancellationToken cancellationToken);

    /// <summary>Executes one validated lifecycle step.</summary>
    /// <param name="runId">The stable run identifier.</param>
    /// <param name="cancellationToken">Signals cancellation of the orchestration step.</param>
    /// <returns>The resulting lifecycle state.</returns>
    Task<string> ExecuteNextStepAsync(
        string runId,
        CancellationToken cancellationToken);
}

/// <summary>Represents an ordered reviewer-facing runtime event.</summary>
public sealed record EvidenceEvent
{
    /// <summary>Gets the event sequence within the run.</summary>
    [Display(Name = "Sequence")]
    public required long Sequence { get; init; }

    /// <summary>Gets the event type.</summary>
    [Display(Name = "Event Type")]
    public required string EventType { get; init; }

    /// <summary>Gets the UTC event instant.</summary>
    [Display(Name = "Occurred At Utc")]
    public required DateTimeOffset OccurredAtUtc { get; init; }
}

Expected event timeline

run.createdrun.provisioning_startedcontext.selectedpolicy.evaluatedmodel.requestedmodel.candidate_returnedtool.action_proposedtool.action_validatedcheckpoint.createdtool.executedtest.completedartifact.recordedrun.completed

Quickstart test checklist

  • Invalid transition and unknown tool are rejected.
  • Prohibited source is excluded from context.
  • Cancellation and timeout are honored and evidenced.
  • Failed test recovers from the checkpoint.
  • Evidence remains ordered and timestamps are UTC.

Use the downloadable run and evidence examples as static fixtures.

These files are conceptual MiRuntime editorial references, not a product SDK or certification profile.

These files are conceptual MiRuntime editorial references, not a product SDK or certification profile.

Source record

References

Suggest a correction
  1. Microsoft. Microsoft Learn. Published Current documentation; last reviewed 2026-06-23 UTC. Official architecture guidance.

  2. National Institute of Standards and Technology. NIST. Published 2023-01-26; last reviewed 2026-06-20 UTC. Government framework.