Skip to content

IAgentExecutionContext

NexusLabs.Needlr.AgentFramework

NexusLabs.Needlr.AgentFramework.Context

IAgentExecutionContext Interface

Per-orchestration execution context established by trusted non-LLM code (API auth middleware, workflow engine, scenario harness) before invoking an agent. Tools read this via IAgentExecutionContextAccessor to obtain the user identity and orchestration correlation ID.

public interface IAgentExecutionContext

Derived
AgentExecutionContext

Remarks

Implementations should be immutable. Use with expressions (if a record) to create a derived context for sub-agents or nested scopes.

This interface intentionally does not include workspace, provider, or other concerns. Consumers that need a workspace can create their own implementation that carries one, or store it in Properties.

Properties

IAgentExecutionContext.OrchestrationId Property

Gets the correlation ID for the current orchestration run.

string OrchestrationId { get; }

Property Value

System.String

IAgentExecutionContext.Properties Property

Gets an extensible property bag for consumer-specific data (workspace, tenant, etc.).

System.Collections.Generic.IReadOnlyDictionary<string,object> Properties { get; }

Property Value

System.Collections.Generic.IReadOnlyDictionary<System.String,System.Object>

Remarks

Framework code never reads from this bag. It exists so consumers can attach domain-specific data to the context without creating a custom IAgentExecutionContext implementation.

Implementations should return a read-only dictionary. Mutability (if needed) should be handled by creating a new context with updated properties.

IAgentExecutionContext.UserId Property

Gets the user identity for the current orchestration.

string UserId { get; }

Property Value

System.String

Remarks

Set by trusted callers only — never by the LLM or by tool parameters.