@@ -721,6 +721,14 @@ func (a *InitAction) downloadAgentYaml(
721721 return nil , "" , fmt .Errorf ("failed to process manifest parameters: %w" , err )
722722 }
723723
724+ _ , isPromptAgent := agentManifest .Template .(agent_yaml.PromptAgent )
725+ if isPromptAgent {
726+ agentManifest , err = agent_yaml .ProcessPromptAgentToolsConnections (ctx , agentManifest , a .azdClient )
727+ if err != nil {
728+ return nil , "" , fmt .Errorf ("failed to process prompt agent tools connections: %w" , err )
729+ }
730+ }
731+
724732 content , err = yaml .Marshal (agentManifest )
725733 if err != nil {
726734 return nil , "" , fmt .Errorf ("marshaling agent manifest to YAML after parameter processing: %w" , err )
@@ -800,6 +808,7 @@ func (a *InitAction) addToProject(ctx context.Context, targetDir string, agentMa
800808 var agentConfig = project.ServiceTargetAgentConfig {}
801809
802810 deploymentDetails := []project.Deployment {}
811+ resourceDetails := []project.Resource {}
803812 switch agentDef .Kind {
804813 case agent_yaml .AgentKindPrompt :
805814 agentDef := agentManifest .Template .(agent_yaml.PromptAgent )
@@ -836,9 +845,39 @@ func (a *InitAction) addToProject(ctx context.Context, targetDir string, agentMa
836845 deploymentDetails = append (deploymentDetails , * modelDeployment )
837846 }
838847 }
848+
849+ // Handle tool resources that require connection names
850+ if agentManifest .Resources != nil {
851+ for _ , resource := range agentManifest .Resources {
852+ // Try to cast to ToolResource
853+ if toolResource , ok := resource .(agent_yaml.ToolResource ); ok {
854+ // Check if this is a resource that requires a connection name
855+ if toolResource .Id == "bing_grounding" || toolResource .Id == "azure_ai_search" {
856+ // Prompt the user for a connection name
857+ resp , err := a .azdClient .Prompt ().Prompt (ctx , & azdext.PromptRequest {
858+ Options : & azdext.PromptOptions {
859+ Message : fmt .Sprintf ("Enter connection name for %s resource:" , toolResource .Id ),
860+ IgnoreHintKeys : true ,
861+ },
862+ })
863+ if err != nil {
864+ return fmt .Errorf ("prompting for connection name for %s: %w" , toolResource .Id , err )
865+ }
866+
867+ // Add to resource details
868+ resourceDetails = append (resourceDetails , project.Resource {
869+ Resource : toolResource .Id ,
870+ ConnectionName : resp .Value ,
871+ })
872+ }
873+ }
874+ // Skip the resource if the cast fails
875+ }
876+ }
839877 }
840878
841879 agentConfig .Deployments = deploymentDetails
880+ agentConfig .Resources = resourceDetails
842881
843882 var agentConfigStruct * structpb.Struct
844883 if agentConfigStruct , err = project .MarshalStruct (& agentConfig ); err != nil {
0 commit comments