r/copilotstudio • • 1d ago

Multi Agent Orchestration-Processing files

Hello all,

I am a little behind on Copilot Studio so would appreciate any help.

Essentially I am building a main orchestration agent which calls various child agents. One of the tasks I need to build is processing an Excel or CSV file which contains about 1,000 rows across 35 columns. The process basically check if the Excel/CSV file contains certain completed tasks against some criteria in the instructions.

The challenge I have is getting the data from the parent to the child agent.

Initially I thought the parent would automatically pass the file, but apparently it doesn't do that. So then I built a topic to extract the information into JSON and passed that to the child as a string. If the number of rows is small ~40 it works, but with even 100 rows it fails. The failure doesn't imply it is to do with the payload size, but as it works with a smaller payload, I assume that is the issue.

Has anyone done anything similar? If so, how did you implement it?

Currently I'm thinking, upload the file. Chunk up the JSON. Process each chunk. Collect the output. Once all chunks processed, combine the output and return it to the parent to report to the user.

Are there any better techniques I can use? I have access to SharePoint for file storage, if needed.

Appreciate any help or guidance.

Thanks

EDIT: Thanks all for your responses. I have a few things to try now. Appreciate the help 😄

4 Upvotes

9 comments sorted by

5

u/dwilk123 1d ago

How deterministic is “completed” definition?

I could argue people try and use copilot studio as a data processing engine entirely too much. There are other apps in the Microsoft world much better suited for simple analysis if the criteria are well known and agreed upon; power automate in this case.

If this as simple
Completed= IF (column c,I, w) eq “yes”
And you just need a count and specific meta data from these records then it’s much easier and less costly to do this in power automate

1

u/eatingchocolatealone 1d ago

Thank for your reply. Appreciated. Unfortunately it's not as simple as a yes/no column. There is some criteria. You are right there may be better way, but I also thought it was a good way to upy skills.

2

u/TheRagingAmish 1d ago

The Microsoft connectors and excel have to be the most picky connectors of the bunch.

Everything, including agent to agent communication always takes some extra effort compared to any other to work around error messages.

My answer in similar situations has been to export the JSON or table into its own file that I store on my one drive or a sharepoint.

Then I pass the file name to the other agent and it accesses the excel source itself.

It feels like extra steps, but in practice it’s the most stable process I have found.

2

u/eatingchocolatealone 1d ago

Thank you. I tried something similar but the child agent complained about the file format being wrong. If you have managed to do it, then it must be possible.

Thank you. I will try this first before bobby_bobberson2501's suggestion.

That's my weekend sorted 😁

2

u/ninihen 1d ago

The "file format wrong" part is probably the Excel connector. It only reads .xlsx files, and only data formatted as a table, so a CSV or an xlsx with rows just sitting on a sheet will fail. Open it in Excel, Ctrl+T, save it as .xlsx in SharePoint.

I'd also take the rows out of the agent-to-agent hop altogether. Make an agent flow that the child agent calls as a tool, with the file name as the input. In the flow use List rows present in a table (turn pagination on, it stops at 256 rows by default), then loop over chunk(body('List_rows_present_in_a_table')?['value'], 50) with Apply to each and send each chunk to a Run a prompt action that has your criteria in the prompt. Append each result to an array variable and return the combined result to the agent.

That way the agent only passes a file name in and gets a summary back, and the 1,000 rows never go through the conversation.

1

u/eatingchocolatealone 2h ago

Thanks u/ninihen , will take a look if the above don't work.

1

u/Bobby_Bobberson2501 1d ago

So this is possible. You have to use the GitHub harness co-pilot agent, as well as make a workflow. Basically, you can have it save it to a OneDrive folder and connect it to that OneDrive, and you can have it pass through to the child agent. If you have co-work, you can do this automatically for you(it will make the workflow for you and save it to the agent) if you only have co-pilot. Ask how to set up workflow to pass the file using the OneDrive and the child agent as a recipient.

Edit-in case I wasn’t super clear, I meant you could drop the file into the orchestrator agent. It will automatically put it into OneDrive for you, and then it will then give the link for that file inside of OneDrive to the child agent and child agent will then retrieve it. Generally, I have to use like base 64 to do this or a couple of other ways, using binary instead, which I found to be faster, but if you’re not dealing with like large PDFs or anything, and just you know, 1000 row CSVs or Excel, you should be fine doing it. However, it sets it up

2

u/eatingchocolatealone 1d ago

Thank you. This sounds like something worth trying. If nothing else, I will learn a lot.

Thanks again

2

u/Majestic___Delivery 13h ago

This is the answer btw OP - create the workflow, and have your orchestration agent call the workflow (your workflow can have agent steps if you need more subagents).

An MS rep told me that the orchestration agent has context to the subagents per workflow run instance.