AgentPrismRunContext
AgentPrism.Core.dllCarries the identity, tree position, and budget of the running run to the helper components inside the run path.
public static class AgentPrismRunContextInheritance
Section titled “Inheritance”Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”It has two consumers. Skill script execution is triggered from inside MAF, below the recording wrapper; sub-agent invocation is triggered from MAF’s background task tool. Neither has a way to pass the run identity as a parameter: the call chain belongs to MAF.
The value is held in an Threading.AsyncLocal. This means the
assignment does not flow back to the caller: the
Set call must happen in the own body of the method that
starts the run. The same trap happened with
Activity.Current.
The value flows downward: because Microsoft Agent
Framework’s background agent task captures ExecutionContext, a
sub-agent running on a different thread also sees the same scope.
Properties
Section titled “Properties”Current
Section titled “ Current”Gets the scope of the running run. null outside a run.
public static AgentRunScope? Current { get; }Property Value
Section titled “Property Value”CurrentRunId
Section titled “ CurrentRunId”Gets the identity of the running run. null outside a run.
public static Guid? CurrentRunId { get; }Property Value
Section titled “Property Value”Guid?
Methods
Section titled “Methods”SetCurrent(AgentRunScope?)
Section titled “ SetCurrent(AgentRunScope?)”Sets the scope of the running run.
public static void SetCurrent(AgentRunScope? scope)Parameters
Section titled “Parameters”scope AgentRunScope?
The scope. If null, the scope is cleared.