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
AgentRunContext includes IToolExecutor, but AgentFrameworkBridge does not currently register SharpClaw tools with the Microsoft Agent Framework tool-calling pipeline; AgentRunResult.ToolResults is an empty array in that bridge.
Tools remain available to DefaultTurnRunner consumers if a different agent implementation uses IToolExecutor; tests and parity harness exercise IToolExecutor directly.
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.