Creating a Copilot Studio Agent worked like charm. All topics and AI features worked like promised in the documentation. I was amazed how easy it was to build the Agent functionality – even I had never before done this kind of job and half the things was done with the help of Copilot Chat or Google. Then I changed one topic question into choice list from JSON table. It was about which open job position the applicant is applying to.

I had twisted and turned too much

Now I started to get errors and facing problems. I could not create anymore global variables nor edit the agent instructions and generative responses started to go continuously into errors. I had twisted and turned too much and got the Agent into state, where everything was a bit broken.

Problems with variables

Editing variable name or setting it to global remain stuck
Editing variable name or setting it to global remain stuck

I noticed that I cannot anymore change variable names or change them to global. When trying to do that, I just stuck in “Usage” and progress circle.

This started to happen after I introduced global variable type of table. I don’t know if it affects, but first I take the choices as JSON and then parse them into table. I had first problem with missing DisplayName and tried everything with that. Created many temporary variables and parsed variables into another trying to change the type of the variable.

I figured out, that changing record schema and variable type many times, using the variable in multiple other actions might get your whole Agent stuck.

Correct way for me with these JSON tables or record types was to use this From sample data type and then paste the JSON there. This way the variable got the correct type with correct schema so that the other actions could read it properly.

I was twisting the variables one day long and looking at the topic variables test tab containing the variable values. Half of them were empty. Eventually this first Agent will go to trash and I remake the Agent from scratch now when I know how to correctly use variables and cast them.

Getting open position job titles as JSON from Agent Flow
Getting open position job titles as JSON from Agent Flow

Table variable content as JSON with DisplayName property
Table variable content as JSON with DisplayName property

I also learned the point when to leave the variable inside a topic and when make them global. All temporary variables should be inside a topic and the final values should be global. Final values are selected job position name, applicant full name and CV content as text. I did not try to set topic variables values from other topics – I will leave that fun for future.

Generative answers errors

I was doing R&D and did not follow the normal development procedures. Change one thing, test the module and every once in a while do the integration or process testing. The same time with variable problems the Create generative answers action started to give below error all the time. I’m not sure did this happen because I had twisted the variables or had I changed something during the great variable wars.

AuthoringCanvas:AuthoringCanvasResources.TestChat.failureScenarioOptions.noSearchResultsText

In my perspective the same prompt one day earlier with string typed variable but once I get the DisplayName from record variable and use it in prompt I get that error. I had slight feeling that I had added this “suggest also application text for the applicant based on the CV” and that caused the error. Sometimes I took that off, I got replies from the generative answers.

Mainly above error means that either the knowledge source does not give enough data to format the answer or the AI has removed the answer because there was something inappropriate. I could not understand why my CV or fictional job position could contain something forbidden. I figured out this and explain in the end of this blog post.

Cannot edit instructions

I updated instructions in the earlier post. It worked very well. I cannot anymore update the instructions for the bot. It allows me to edit it for a while, then it updates and restores the old instructions. Cannot even empty it. I red that it might be a browser cache issue, but still was happening in InPrivate window.

Agent instructions returning to original after auto save
Agent instructions returning to original after auto save

The reboot changed everything

In Finland we have this saying Bootti kaiken muutti, which means that usually rebooting the machine will fix the problems. I decided to go with that. I created a new Agent from scratch using the existing Agent Flows. Actually just copy pasting the whole Agent took me maybe about half an hour. I had no problems with variable naming nor setting into global. I think because I did them correctly the first time with proper schemas for the records and tables.

Creating new Job Application Agent
Creating new Job Application Agent

How could the AI create application letter, if it does not have access what does a letter look like

I did for that part where I could get the generative answers. I got the answer out as I liked. It also contain the suggestion for the job application text. Then I noticed that I had left in the action Data source settings that it can use the Classic data meaning using the Ai to use its own general knowledge. How stupid I felt. How could the AI create application letter, if it does not have access what does a letter look like. I split the generative answers into two different actions. First one doing the comparison only with access to knowledge and CV content, and the second creating the suggestion with access to Classic data.

Moderation level change does not save

With the newly created Agent everything seems to work except the AI moderation level could not be saved. I had this problem with the original Agent as well. I go to the settings. Change the moderation level to low and then save. I get information that settings are saved. When trying to close settings, I get below error message. If I leave and come back, the moderation level is still what it was before trying to change this.

Moderation level change is not saved even it says it was saved
Moderation level change is not saved even it says it was saved

There is some delay, after couple hours it shows the value I saved. I was changing this originally because I was thinking the generative answers don’t because there is something forbidden.

Error that remain for both Agents

Mysterious but I managed to fix everything else than editing the instructions of the new Agent. After getting it working, I noticed that I cannot edit the instructions. I sent email to other MVPs and Microsoft Product Group – maybe create a ticket to support if I don’t get answer why this is happening.

UPDATE – the next day instructions section was not in the auto update canvas, it was inside the the Details and with Edit button I could update it normally.

Job Application Assistant Agent Overview section Details in edit mode
Job Application Assistant Agent Overview section Details in edit mode

The final step is to impalement the rating functionality into the Agent.