---
title: "Pass Large CSV Attachments From Custom Agent to Orchestrate"
description: "How to pass 2,000–8,000 row CSV attachments from a Workday Custom Agent workflow into Orchestrate without routing the raw CSV text through the LLM context…"
url: https://kiweely.com/guides/workday-custom-agent-csv-file-attachment-orchestrate
---

# Passing Large CSV File Attachments From a Workday Custom Agent Flow to Orchestrate Without Hitting Context Limits

Passing a multi-thousand-row CSV directly through a Custom Agent Action JSON input forces the LLM to serialize the entire file inside its context window. Store the uploaded CSV in an Extend Attachment Business Object via a PMD fileUploader widget and pass only the Attachment WID to Orchestrate.

-   **Checked** against Workday on November 6
-   Applies to **Workday Orchestrate**
-   3 min read
-   Published November 6
-   By Kiweely

## Why routing large CSV attachments through Custom Agent chat fails

In Workday Chat, you can enable the **Sources** upload button on a Custom Agent by adding the `agent_file_download` tool (`wid: 94fadfecb1bb100031d911f8ed0a0000`) to the `.agentskill` file’s `tool-wids` section:

yaml

```
tool-wids:
  - name: agent_file_download
    wid: 94fadfecb1bb100031d911f8ed0a0000
```

While `agent_file_download` lets the agent download small documents into the conversation so the language model or a bundled skill script can inspect them, **Custom Agent Action** orchestrations accept only structured JSON request properties (`String`, `Number`, `Boolean`) generated by the model at tool-call time. If a user attaches a 2,000-to-8,000 row CSV file (roughly 450 KB or more) in the chat panel and asks the agent to send it to a Custom Agent Action orchestration, the LLM has to read the entire CSV into its context window and re-emit all 8,000 rows as a JSON string argument. That hits output token ceilings, risks row truncation or hallucinated values, and stalls the 5-minute Custom Agent Action synchronous execution window.

## Pass an Extend Attachment Business Object WID instead of raw CSV text

To hand off a multi-thousand-row CSV file to Workday Orchestrate without passing its contents through the LLM context window, separate the binary upload from the conversational trigger:

1.  **Store the CSV in an Extend Attachment Business Object:** Have the user upload the CSV through an Extend presentation page (or an agent-launched A2UI page) containing a `fileUploader` widget bound to a Model Attachment Business Object (for example, `equipmentImportFile`).
2.  **Pass only the 32-character Attachment WID to the agent:** Either return the created record’s `id` (`wid`) on the page so the user can reference it in chat, or give the Custom Agent a read tool (`GET` on the Extend Business Object or a WQL query) that looks up the user’s most recent unprocessed upload record.
3.  **Stream and parse the CSV directly inside Orchestrate:** The Custom Agent passes only the string `attachmentWid` (32 characters) into the Custom Agent Action orchestration. Inside Orchestrate, a **Send Workday API Request** step fetches the attachment binary directly from the Extend Attachment Business Object REST endpoint and parses it with `.asCSV()`.

## Building the Attachment Business Object and PMD upload page

In your Extend app, create a Model Attachment Business Object named `equipmentImportAttachment` and a parent tracking Business Object named `equipmentImportBatch` (with fields `batchStatus` and `csvFile` referencing `equipmentImportAttachment`). On your PMD upload page, bind a `fileUploader` widget to the attachment endpoint:

json

```
{
  "type": "fileUploader",
  "id": "csvUploader",
  "label": "Upload Equipment Requests CSV (up to 8,000 rows)",
  "Singular": true,
  "fileTypes": ".csv,text/csv",
  "UploadEndpoint": {
    "name": "uploadEquipmentCsv",
    "baseUrlType": "app",
    "url": "equipmentImportAttachments",
    "authType": "sso"
  }
}
```

When the page submits and creates the `equipmentImportBatch` instance, display the created batch `id` on the confirmation banner (or let the agent query `SELECT workdayID, fileName FROM <app>_equipmentImportBatches WHERE createdBy = ... AND batchStatus = 'Pending' ORDER BY createdDate DESC LIMIT 1`).

## Fetching and iterating the CSV in the Custom Agent Action orchestration

Configure your **Custom Agent Action** orchestration’s **Start** step (`Configure Request` > **Custom Agent Actions** tab) to accept a single required string property:

-   **Property Name:** `attachmentWid`
-   **Description:** `The 32-character Workday ID (WID) of the uploaded equipmentImportAttachment CSV record to process.`

Inside the orchestration:

1.  Add a **Send Workday API Request** step named `GetCsvAttachment` configured as a `GET` request to your app’s attachment REST endpoint:
    
    text
    
    ```
    /apps/equipmentRequest_abcdef/v1/equipmentImportAttachments/{{lp.getSimpleData('attachmentWid')}}
    ```
    
2.  Convert the binary response body into a streaming CSV iterator in your **Loop** or **Batch Loop** step using the `Data` member function `.asCSV()`:
    
    javascript
    
    ```
    data.GetCsvAttachment.response.asCSV().csvRowIterator
    ```
    
3.  Inside the loop, read each column by header name (`item.getByColumnName('serialNumber')`, `item.getByColumnName('assignedWorkerId')`) and batch your downstream updates using the Workday REST Batch API or an asynchronous child orchestration if processing 8,000 rows exceeds the 5-minute Custom Agent Action timeout.
4.  Remember to register both the Custom Agent Action’s `Action ID` and the `GET` attachment REST operation WID in your `.agentskill` file’s `tool-wids` list so the Agent System User token is authorized to read the attachment.

## Verifying the attachment flow in your tenant

Upload a 5,000-row test CSV through the PMD page and ask your Custom Agent in Workday Chat to process the uploaded batch. Open **Agent Traces** in App Builder and inspect the `AviatoTurboChatCIS` node: confirm that the tool call payload sent to your Custom Agent Action contains only `{"attachmentWid": "<32-char-wid>"}` rather than raw CSV lines. Then open **Orchestration Activity**, select the run, and verify that `GetCsvAttachment` returns HTTP `200` and the CSV iterator processes all 5,000 rows without truncation.

## Sources checked

-   [Enable File Uploads](https://developer.workday.com/documentation/GUID-1ff1810b-823c-4451-ae48-a2945bda8b0d-enHYPHENus)
-   [Configure Custom Agent Action Orchestrations](https://developer.workday.com/documentation/GUID-fce1f988-5cf6-4d0c-ad1a-953bcfe212c6)
-   [Concept: Attachment Objects](https://developer.workday.com/documentation/rxi1560967931825)
-   [fileUploader](https://developer.workday.com/documentation/icc1518036830536)
-   [Reference: Data Member Functions](https://developer.workday.com/documentation/hbp1597828812002)

## Related guides

[All guides](https://kiweely.com/guides)

-   [### Avoiding the 25-Second Synchronous Timeout When an Extend Page Calls External LLM APIs Through Orchestrate Although Synchronous Orchestrations support up to 5 minutes of execution when called externally, Presentation Components enforce a strict 25-second timeout when a PMD page triggers a Synchronous Orchestration. Refactor multi-step OCR and LLM pipelines to an Asynchronous Orchestration with a BO.](https://kiweely.com/guides/workday-extend-async-orchestration-llm-timeout)
-   [### AI Gateway Document Intelligence (/ml/docint/v1/ids): Converting Workday Drive Base64 to Binary, Resume Layout Pitfalls, and Fixing Opt-In Errors Workday’s Document Intelligence REST APIs (/ml/docint/v1/ids, /doc, and /resume) require raw binary payloads (up to 20 MB) rather than Base64 strings. Learn how to decode Workday Drive Base64 payloads with an explicit MIME type in Orchestrate, handle multi-column resumes, and fix opt-in errors.](https://kiweely.com/guides/workday-document-intelligence-base64-binary-opt-in-errors)
-   [### Why a Workday Custom Agent Has No Credentials Tab in Agent Management Hub, and How to Expose It Through A2A Workday displays the Credentials tab in Agent Management Hub only for registered External Agents. To expose a Custom Agent built on Workday’s AI platform to an external assistant, register a third-party Agent Definition in the Agent System of Record that wraps the Custom Agent WID as an A2A tool.](https://kiweely.com/guides/workday-custom-agent-missing-credentials-tab-a2a)
-   [### Why Custom Agent Actions Fail With S22 Permission Denied or Task Not Authorized in Agent Chat Orchestration Builder runs Custom Agent Actions directly as your user, whereas Agent Chat enforces dual ASOR authorization and restricts the Agent System User token to the resources listed in your .agentskill file. Register every REST, SOAP, and WQL resource WID via the Finder API to fix it.](https://kiweely.com/guides/workday-custom-agent-actions-permission-denied-tool-wids)

### More guides on Custom agents and Workday AI

[All 91 guides](https://kiweely.com/guides#custom-agents)

-   [Preventing Duplicate Initiate\_Change\_Job Business Process Events When a Workday Custom Agent Calls a Write Tool](https://kiweely.com/guides/workday-custom-agent-duplicate-initiate-change-job)
-   [Fixing invalid\_request OAuth Token Exchange Errors When Connecting Microsoft Copilot Studio to Workday A2A](https://kiweely.com/guides/workday-a2a-copilot-studio-oauth-invalid-request)
-   [Why Custom Agent Skills Deployed From the Developer Site Don’t Appear in Agent Management Hub, and ASOR Tenant Prerequisites](https://kiweely.com/guides/workday-agent-management-hub-skills-not-showing)
-   [Fixing Workday Developer Agent VS Code Sign-In With a Personal Developer Account and Subagent Interrupt Errors](https://kiweely.com/guides/workday-developer-agent-vscode-personal-account-login)
-   [Finding Workday tool IDs with the Agent Resource Search (finder) API](https://kiweely.com/guides/workday-finder-api-tool-discovery)
-   [Connecting an Extend app to the Workday Self-Service Agent and Microsoft Teams](https://kiweely.com/guides/workday-extend-self-service-agent-teams)
-   [How to build a chatbot in Workday Extend](https://kiweely.com/guides/workday-extend-chatbot)
-   [How to call AI Gateway Document Intelligence from a Workday Extend app](https://kiweely.com/guides/workday-extend-ai-gateway-document-intelligence)

### From the blog on Custom agents and Workday AI

[All posts](https://kiweely.com/blog)

-   [Using Workday Developer Agent in Claude Code, Cursor or VS Code](https://kiweely.com/blog/workday-developer-agent-claude-code-cursor)
-   [Keeping Workday Custom Agents From Burning Flex Credits](https://kiweely.com/blog/reduce-workday-flex-credit-consumption)
-   [Workday Developer Agent for Multi-Client Consultants](https://kiweely.com/blog/workday-developer-agent-multi-client-consultants)

## Let Workday check the work.

Kiweely writes WQL and builds orchestrations in your own tenant, and Workday, not Kiweely, says whether they passed.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.
