Skip to content

IWorkflowRunner

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

Reads the workflow catalog and runs workflows.

public interface IWorkflowRunner

The abstraction lives in AgentPrism.Abstractions because the HTTP layer runs workflows but does not depend on the AgentPrism.Workflows package. This is the same pattern established with IMcpToolRefresher in MCP: the workflow engine stays an optional package, and a consumer who does not use it does not pull in a 130-type execution engine.

The contract carries no Microsoft Agent Framework type. Events flow through AgentPrism’s own RunEvent type; the conversion from MAF events happens inside AgentPrism.Workflows.

Fetches a single workflow’s summary.

ValueTask<WorkflowDescriptor?> GetAsync(string name, CancellationToken cancellationToken = default)

name string

The workflow name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WorkflowDescriptor?>

The summary; null if it does not exist.

Compiles a workflow and extracts its graph.

ValueTask<WorkflowGraph?> GetGraphAsync(string name, CancellationToken cancellationToken = default)

name string

The workflow name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<WorkflowGraph?>

The graph; null if the workflow is not in the catalog.

The graph is actually compiled: the helper nodes added by prebuilt patterns are visible only after compilation, and the executor identifiers in run events come from there too. Compilation makes no agent call, it only wires up the wrappers.

Lists the workflows in the catalog (defined in code + database).

ValueTask<IReadOnlyList<WorkflowDescriptor>> ListAsync(CancellationToken cancellationToken = default)

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<WorkflowDescriptor>>

The summaries.

ListPendingRequestsAsync(Guid, CancellationToken)

Section titled “ ListPendingRequestsAsync(Guid, CancellationToken)”

Lists a run’s pending human-input requests.

ValueTask<IReadOnlyList<WorkflowPendingRequest>> ListPendingRequestsAsync(Guid runId, CancellationToken cancellationToken = default)

runId Guid

The run identifier.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<WorkflowPendingRequest>>

The pending requests; an empty list if none.

AgentPrismException

The run does not exist or belongs to another tenant.

RespondStreamingAsync(WorkflowRespondRequest, CancellationToken)

Section titled “ RespondStreamingAsync(WorkflowRespondRequest, CancellationToken)”

Responds to a pending request and resumes the run from its checkpoint.

IAsyncEnumerable<RunEvent> RespondStreamingAsync(WorkflowRespondRequest request, CancellationToken cancellationToken = default)

request WorkflowRespondRequest

The response.

cancellationToken CancellationToken

The cancellation token.

IAsyncEnumerable<RunEvent>

The ordered event stream.

Resuming opens a new run record; the same rule as IWorkflowRunner.ResumeStreamingAsync. The response is matched to the request republished from the checkpoint by identifier.

ResumeStreamingAsync(WorkflowResumeRequest, CancellationToken)

Section titled “ ResumeStreamingAsync(WorkflowResumeRequest, CancellationToken)”

Resumes from a checkpoint and streams its events.

IAsyncEnumerable<RunEvent> ResumeStreamingAsync(WorkflowResumeRequest request, CancellationToken cancellationToken = default)

request WorkflowResumeRequest

The resume request.

cancellationToken CancellationToken

The cancellation token.

IAsyncEnumerable<RunEvent>

The ordered event stream.

Resuming opens a new run record. Reopening the same row would break the event stream’s append-only rule and would leave “when did this run end” unanswered.

RunStreamingAsync(WorkflowRunRequest, CancellationToken)

Section titled “ RunStreamingAsync(WorkflowRunRequest, CancellationToken)”

Runs a workflow and streams its events.

IAsyncEnumerable<RunEvent> RunStreamingAsync(WorkflowRunRequest request, CancellationToken cancellationToken = default)

request WorkflowRunRequest

The run request.

cancellationToken CancellationToken

The cancellation token.

IAsyncEnumerable<RunEvent>

The ordered event stream.

The first event is always RunEventType.RunStarted, and its RunEvent.RunId field carries the run identifier; the caller learns the identifier from the stream’s first frame.