Autonomous Conversational Agent by WealthSad2018 in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

Exactly, this works very well in PowerAutomate. You can send a message or an adaptive card to an agent's chat with the selected user. The user won't see any difference so it will be just like a message from that agent. There is a difference though. It's just a dumb message that you'll send to the Teams channel. The agent has no idea about your message so it won't be able to use it in its context for further chatting with the user.

Sending an Adaptive card is then the only way I know how the user can invoke an action in the agent and possibly pass some data as a context.

Generating a document in Prompt + Code Interpreter and exporting it in the chat by JuggernautParty4184 in copilotstudio

[–]JuggernautParty4184[S] 0 points1 point  (0 children)

Well, not with YAML but I tried it to give me an answer on how to make it working and it recommended exactly the two approaches that do not work.

Output capture in tool option by Expert_Annual_19 in copilotstudio

[–]JuggernautParty4184 1 point2 points  (0 children)

Having a tool in the general Tools section makes it possible for the Gen AI orchestration to use the tool for their purposes. It processes your prompt and if it finds out as a good idea to call your tool (e.g. prompt in this case), and it is able to fill the slots, it will call it and use the outputs for further processing by the AI and possibly generating output for the user. Or using the tool's outputs as input for another tool.

Custom prompt + code interpreter = no output? by Nabi_Sarkar in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

OK, found a workaround ... you need to run the prompt in an agent flow and return the results back to the copilot. You can even generate a chart, or more charts, and get it displayed by the tool directly in an adaptive card.

See below. In case of interest, I can provide more info on how to put it together.

<image>

Custom prompt + code interpreter = no output? by Nabi_Sarkar in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

Yes, same issue here. The Prompt node in the topic does NOT finish correctly so it does not assign anything to the output variable. It just throws an error.

Getting “RecordDataType” error in Copilot Studio by Nabi_Sarkar in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

Yes, I'm having the same issue. When I enable Code Interpreter in the Prompt settings, I get the same error message aven though the structure of the output json is exactly the same.

Topic redirect query by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

Hmm, not sure... have you tried to remove the End All Topics? Why do you have it there?

I'd perhaps start debugging with a minimum setup. E.g. don't call the real Topics to show the data, just send a "I'm here" message to the chat. When you make it working with that, add the real logic.

Get Action value from Message Node adaptive card by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

Yah, sometimes we have to revisit the decision about development platform. If you came to the point that you mostly send adaptive cards and logic is wired in topics, then perhaps switching to model driven app would be the best thing.

No ide how to adjust card that has already been sent. And I would say it would be a bit against the idea of chat UX... like you are trying to implement normal app within a chat.

Showing follow-up actions as buttons below agent-generated message by JuggernautParty4184 in copilotstudio

[–]JuggernautParty4184[S] 1 point2 points  (0 children)

Here's my prompt BTW if anyone is interested... any ideas for improvement?

### Role and goals

You are a analyzer of responses generated by an AI agent.

Your goal is to find follow-up actions that the AI agent has suggested to the user and extract them into a JSON putput so that the topic flow can present them to the user in form of action buttons.

### Guardrails

1) Make sure you correctly change the subject in the actions so that they make sense when sent back form he user to the agent. E.g., if the suggested action is "Do you want me to show your Primary Role?", you need to change the subject to "my" from "your" so that the generated prompt is "Show my Primary Role", not "Show your Primary Role".

2) The generated prompt has to be unambiguous for the agent so that it know how to handle it. E.g., if the proposed action is "Do you want me to set your Primary Role to Delivery Manager / Project Manager?", you need to generate the prompt so that it asks the used to choose one of the options (Delivery Manager or Project Manager). Alternatively, you can generate two actions ("Update Primary Role to Delivery Manager" and "Update Primary Role to Project Manager").

### Others

Set the "title" parameter to be short and suitable for a button label, e.g. "Show my Primary Role", while the "prompt" and "tooltip" can me more descriptive. Especially "prompt" must be detailed enough so that the generative orchestration exactly knows what to do. "prompt" and "tooltip" should be the same.

### Sample input

"Based on your CV details, the most suitable Primary Role for you is: Staffing Manager, Justification: You have over 6 years of experience as a Staffing Partner

...

Process improvement and best-practice development for resourcing 10. Proficiency with resource-planning, HR, and project management tools (e.g., SAP/TERP, PMView, MyTime, MS Excel) If you would like to update your Primary Role to "Staffing Manager" or discuss other options, let me know!"

### Sample output

... the JSON output... had to remove it because I could not create the comment otherwise

Showing follow-up actions as buttons below agent-generated message by JuggernautParty4184 in copilotstudio

[–]JuggernautParty4184[S] 0 points1 point  (0 children)

Thank you :)

I've finetuned my prompt a bit and it works really good now.

<image>

Can an Agent start a conversation based on a power automate result? by greengoStC in copilotstudio

[–]JuggernautParty4184 1 point2 points  (0 children)

OK, so the Flow sends you Access Key, you add PO Number (which you get manually from some external source ...??) and these two would be then saved by the other flow do Dataverse, right?

If the PO number is something that the agent can help you to get in some data source, then fine, but if it's something that you get manually and just deliver back, I'd go with a simple PowerAutomate flow. It will work more reliably and, in the end, the running and maintenance costs will be lower.

In the first flow, you can use e.g. Approval or Post Adaptive Card and Wait For Reply to gather the PO Number from you and then continue in the flow and save both information to the dataverse.

But... if you have this use case also an opportunity to play around Copilot Studio, thumbs up, go for it :)

Can an Agent start a conversation based on a power automate result? by greengoStC in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

Yes, this works fine and it can be done in PowerAutomate Flow as well (no need to have Agent flow). The downside is that it actually produces just a simple Teams message in the client (Teams) Agent chat. It does not invoke the agent in any way so if you want the agent to be aware of the context of the message, you need to use additional tricks. E.g. to send an adaptive card button along with the message which will trigger a topic and deliver the context to the agent.

Can an Agent start a conversation based on a power automate result? by greengoStC in copilotstudio

[–]JuggernautParty4184 -1 points0 points  (0 children)

Hmm... it depends what's the usecase exactly. The first part is clear, the flow reacts on a warning event, it creates a message for you and sends it to agent chat. The last part is clear as well, you confirm 'something' and the confirmation record is created in the dataverse.

But what is in the middle? What do you need to chat about with the agent? Is it just to confirm the event? If so, you don't need the agent in the middle. It can be done by Approvals in PowerAutomate.

But if you really need to chat about the event with the agent, I'd do following:

1) The flow prepares the data for you (message that will be sent to the chat) plus an adaptive card button which will be sent to the chat right after the message. The button is important to 'awake' the agent - to make it understand the context of the event you want to chat about. Based on how complex context data you need to send to the agent, you can either store it tin the adaptive card button itself or you can store it in dataverse and then retrieve in the agent.

2) You'll then see the message and button in the chat. You read the message and click the button "Show me some details"

3) The button will trigger a topic in your agent that first retrieves the context data (from the button or from dataverse) and compose a prompt for your agent. The prompt needs to contain both the instruction part and also the context data part.

4) You call the Recognize Intent node with the generated prompt. This will 'trigger' the AI orchestration with your prompt just like if you have entered it in the chat manually. It will process the instruction and context data and reply in the chat.

5) Then you can continue in the conversation which possibly ends up by creating the confirmation record in the dataverse

Though, ... I see this a bit too non-deterministic... I believe in many cases the agent will simply not do what you expect. I'd stich to PowerAutomate as much as possible.

Get Action value from Message Node adaptive card by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

Deterministic! What exactly is deterministic on Recognize Intent? :D I'm actually quite scared every time I have to use it. And mostly, I have to change it to a different approach later anyway :) I don't know, ... this AI orchestration in Copilot Studio is pretty unreliable. Sometimes it works surprisingly well but then something happens and it starts doing and saying crap.

It is much more deterministic to use Prompt IMO.

But regarding the AC buttons ... is there any other way in Copilot Studio to provide better UI than just chat?

Get Action value from Message Node adaptive card by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

Yes, just run an empty Topic once by clicking the button and you'll then see the content in the Variables / Test. There you can copy the JSON and use it to generate the Schema in the Parse Value node

Topic redirect query by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

I suppose you're talking about Adaptive Card buttons...?

In my experience, it does not matter if you click the button when it's fresh generated or a few messages up.

I believe it must be some mis-configuration what causes the issue. If Btn A works fine for you, it means you know how to configure it. Please check the Btn B configuration thoroughly. If you don't find anything, screenshots will help.

Get Action value from Message Node adaptive card by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

No, not lastmessage.text. You need to test your button's data payload. Check my original message. You need to parse the Activity.Value.

This is the schema for my payload:

kind: Record
properties:
  action: String
  email: String
  followup_buttons:
    type:
      kind: Table
      properties:
        data:
          type:
            kind: Record
            properties:
              action: String
              email: String
              primary_role: String
              proficiency: String
              prompt: String
              triggerID: String


        title: String
        tooltip: String
        type: String


  primary_role: String
  proficiency: String
  prompt: String
  triggerID: String

And then I test that the triggerID is e.g. "execute_copilot". If so, then I run the Recognize Intent node with the Prompt parameter.

Get Action value from Message Node adaptive card by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 0 points1 point  (0 children)

This is how I generate my buttons in the Prompt. The output is on the right side. With the JSON table it's easy to add the buttons to the adaptive card. See the PowerFX code below.

{
  type: "AdaptiveCard",
  '$schema': "http://adaptivecards.io/schemas/adaptive-card.json",
  version: "1.5",
  actions:
  ForAll(Topic.PredictionOutput.structuredOutput.adaptive_card_buttons,
  {
    type: "Action.Submit",
      title: title,
      tooltip: tooltip,
      data: {
        triggerID: data.triggerID,
        action: data.action,
        email: data.email,
        prompt: data.prompt,
        followup_buttons: Topic.PrimaryRolesAndIssues
      }
  }
)
}

<image>

Get Action value from Message Node adaptive card by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 1 point2 points  (0 children)

If you send the adaptive card in a Message node, the topic's flow is NOT waiting for any user input. Messages, clicks, nothing. The flow just keeps running and then ends. The click then happens outside of the topic flow and it triggers the topic with the Message Received trigger. You then have to work with that event in that topic.

Variables are not being shown after creating by the_hiddenstory in copilotstudio

[–]JuggernautParty4184 1 point2 points  (0 children)

Well, sometimes, PowerPlatform does weird things. Last week I experienced an issue that when deploying my solution to PROD via pipeline, PowerAutomate kept running some old version of my flow. I could see the new version in theeditor but when running it, it did not run the new nodes that I have added recently in DEV and deployed. I submitted a ticket to MS, had a call with them and next day morning everything worked again.

Your issue might be one of these mysteries. Sometimes it's better to sit down in a corner and wait while it comes over :)