Project: SharpClaw.Code.Agents
Package: Microsoft.Agents.AI
Registration: AgentsServiceCollectionExtensions.AddSharpClawAgents
Each agent is ISharpClawAgent and AddSingleton, also exposed as ISharpClawAgent via GetRequiredService:
PrimaryCodingAgent— used byDefaultTurnRunnerReviewerAgent,AdvisorAgent,SecurityReviewAgent,SubAgentWorker,RecoveryAgent
All concrete agents inherit SharpClawAgentBase, which implements RunAsync(AgentRunContext, CancellationToken) by building AgentFrameworkRequest and calling IAgentFrameworkBridge.RunAsync.
AgentFrameworkBridge:
- Constructs
SharpClawFrameworkAgent(Microsoft Agent Framework) with a delegate that runsProviderBackedAgentKernel.ExecuteAsync. - Creates a framework session and calls
RunAsyncwith the user prompt. - On
ProviderExecutionException, logs and rethrows. - Builds
AgentRunResultwith output, usage, provider data, andRuntimeEvententries (AgentSpawnedEvent,AgentCompletedEvent).
ProviderBackedAgentKernel (internal):
- Runs
IProviderRequestPreflight,IAuthFlowService,IModelProviderResolver,IModelProvider.StartStreamAsync - Aggregates stream text into output; may return placeholder text when unauthenticated or empty stream (see kernel implementation for exact conditions)
- Throws
ProviderExecutionExceptionfor missing provider, auth probe failure, or stream errors classified asProviderFailureKind
AgentFrameworkBridge builds the permission-aware tool execution context and supplies registry definitions to ProviderBackedAgentKernel. The kernel owns the multi-iteration provider tool loop and uses ToolCallDispatcher to execute tools through IToolExecutor. The bridge returns the collected tool results in AgentRunResult.ToolResults.
At complete tool boundaries, the kernel accepts queued steering and invokes the optional IAgentContextManager registered by Runtime for durable automatic compaction. Neither path bypasses tool permissions. See interactive runtime.
ProviderBackedAgentKernel reads optional Metadata keys such as provider for provider name; DefaultTurnRunner puts resolved model info into AgentRunContext / assembler metadata (e.g. model).
For mock/parity scenarios, DeterministicMockModelProvider reads ParityMetadataKeys.Scenario in request metadata.