Parent: #6871 | Epic: #6870
Description
Create new agent implementation backed by copilot.Session instead of langchaingo, and a factory to construct it. These implement the existing Agent interface so call sites can switch without API changes.
Tasks
New Files
internal/agent/copilot_agent.go
internal/agent/copilot_agent_factory.go
Notes
- Must implement same
Agent interface as existing ConversationalAzdAiAgent
- SDK permission hooks replace entire consent system (
PermissionHandler, PreToolUseHandler, AvailableTools/ExcludedTools)
- MCP servers loaded via
SessionConfig.MCPServers (both stdio and http)
- No custom tools registered — Copilot CLI provides file I/O, search, command execution built-in
- 11 azd-specific guidance tools served via
azd mcp start MCP server
Parent: #6871 | Epic: #6870
Description
Create new agent implementation backed by
copilot.Sessioninstead of langchaingo, and a factory to construct it. These implement the existingAgentinterface so call sites can switch without API changes.Tasks
internal/agent/copilot_agent.goimplementingAgentinterfaceSendMessage(ctx, message)→session.SendAndWait(ctx, MessageOptions{Prompt: message})SendMessageWithRetry(ctx, message)→ retry wrapper around SendMessagesession.On(SessionEventHandler)internal/agent/copilot_agent_factory.gocopilot.ClientviaCopilotClientManagerSessionConfigvia config bridgeSessionHooks:PreToolUse,PostToolUse,ErrorOccurredPermissionHandlerfor interactive tool approvalMCPServersfrom merged configNew Files
internal/agent/copilot_agent.gointernal/agent/copilot_agent_factory.goNotes
Agentinterface as existingConversationalAzdAiAgentPermissionHandler,PreToolUseHandler,AvailableTools/ExcludedTools)SessionConfig.MCPServers(bothstdioandhttp)azd mcp startMCP server