Blog

Trigger an AI Agent When a File Is Uploaded

Tutorial

ยท

Quick answer: To trigger an AI agent when a file is uploaded, add the REST API File Upload trigger to a BuildShip workflow, set a path and method (POST or PUT), and click Connect. The trigger accepts multipart/form-data, reads the file into a buffer with its metadata, and also passes any extra form fields. In this guide a site engineer uploads a completion photo and a job id. The agent reads serial numbers from the image, checks them against the asset register, stores the photo and writes a completion record. A general chat agent can describe a photo you paste in, but it cannot accept the upload, query your register or write the job record.

Trigger an AI agent when a file is uploaded: an install photo hits the file upload trigger, then a BuildShip AI agent checks serial numbers against the asset register

โ€œAI agent file uploadโ€ is already a common search, often next to automation tools. The thing people actually want is simpler than a new chat feature: a URL that takes a file, runs an agent, and writes the result somewhere the business already looks.

Why a file-upload agent is not โ€œdrop this image into a chatโ€

If an engineer posts a photo into ChatGPT and asks โ€œwhat serial numbers are on this unit?โ€, they may get a usable read. Then they still have to type those numbers into the job system, attach the photo themselves, and hope they did not mis-copy a digit. Nothing in that path is logged as a job completion.

The REST API File Upload trigger is built for the request that actually happens in the field: a mobile or web app sends multipart/form-data with a file and a few form fields. The workflow starts with the file already in a buffer. From there you can store it, run vision on it, query your own database and write a record.

A general chat agent cannot:

  • Expose an upload URL your app can POST to.

  • Store the original photo in your bucket.

  • Look up serial numbers in your asset register.

  • Write a completion record with the photo URL.

  • Leave a log of the file, the numbers it read and the row it wrote.

That is the whole point of putting an agent behind this trigger.

If the uploader must already be signed in with Firebase, use the authenticated file upload trigger instead. It is the same upload, with a Firebase ID token checked before the file is processed. This post uses the open file upload trigger and, if you need it, your own job-id or API-key check in the first nodes.

What the File Upload trigger actually does

The trigger listens on a path and method you set, and it expects:

  • Content-Type: multipart/form-data

  • Method: POST or PUT

  • A body that contains the file and any extra form fields

It parses the request with the same approach you would use in a Node.js app (the docs describe this as multer under the hood). The workflow then gets:

  • file, an object with fieldname, originalname, mimetype, a buffer of the file bytes, size and encoding.

  • body, any additional form fields, such as a job id or a site code.

  • headers, the request headers.

That buffer is what you pass to storage and to a vision or document step. You do not have to invent a second upload to get a URL. A common first node is to save the file to BuildShip Cloud Storage (or your own bucket) and keep the public or signed URL. BuildShip has a starter template that does the storage step, which you can clone and then extend with the agent.

You can test the trigger from Postman: set POST, paste the endpoint, choose form-data, add a file field, add any extra fields, and send. If the workflow is already storing the file, the response should include a URL.

An engineer uploads a completion photo and a job id to the File Upload trigger. An AI agent reads serial numbers, checks the asset register and writes a completion record

The file and the job id arrive together. The agent does the reading. The register check and the job record are ordinary database work.

A concrete case: check an install photo against the asset register

Take a field-service team that fits equipment on site. When a job is done, the engineer takes a photo of the installed unit, with the serial plate visible, and submits it from a simple app with the job id. Operations want three things from that photo:

  • The original image, stored, so there is proof of the install.

  • The serial numbers on the plate, read automatically.

  • A check against the asset register: were these the units that were meant to be fitted on this job, and are they already marked installed elsewhere?

Here is the path I would build:

  1. The app POSTs multipart/form-data to the File Upload endpoint, with the photo and a jobId field.

  2. The trigger starts the workflow with the file buffer and the job id.

  3. The workflow stores the photo and keeps the URL.

  4. It loads the job from your database: site, expected asset ids, and status. If the job id is missing or unknown, it returns an error and does not call a model.

  5. An AI vision step reads serial numbers and any model marks from the photo.

  6. The workflow looks those serials up in the asset register. It compares them with the expected assets for the job, and checks they are not already closed on another job.

  7. It writes a completion record: job id, photo URL, serials read, match or mismatch, and a status such as completed or needs_review.

  8. The response tells the app what happened. A mismatch can also notify operations in Slack, without blocking the engineer from leaving the site.

The model is there to read the plate. The register check is a database lookup, not a guess, and the agent must not invent a serial that is not in the image.

Store the photo first, then read serial numbers, then compare them with the asset register. Write a completion record and flag mismatches for review

Never let the model invent a serial number. If it cannot read the plate, mark the job for review and keep the photo.

Set up the trigger

  1. Open a BuildShip workflow and go to the Connect tab. Add REST API File Upload.

  2. Set a path, such as /installs/photos, and a method of POST.

  3. Click Connect and copy the endpoint URL.

  4. Send a test request from Postman or Hoppscotch as form-data, with a photo and a jobId field.

  5. Map file and body.jobId (or the field name you used) to workflow inputs. Get Data can help once a request has been sent.

If you want a head start on storage, clone the file-upload template from the docs and add the job lookup and vision steps on top.

Do not use the ordinary REST API Call trigger for this. That trigger is for JSON and other non-file bodies. Multipart file uploads belong here.

Build the install-photo agent

Store the original first. Save the buffer to BuildShip Cloud Storage or your own bucket before any model call. If the vision step fails, you still have the photo and can complete the job by hand.

Validate the job. Load the job by id. If it does not exist, or it is already completed, return a clear error. Log it. This is also a good place to check a shared secret or API key from the headers, if the app is not using the Firebase-authenticated upload trigger.

Read the plate, tightly. Add an AI node that can accept an image (keyless nodes run on your BuildShip credits, or you can bring your own provider key):

> You read equipment serial plates from a site photo. Extract every serial number and any model identifier you can clearly see. If a character is unreadable, mark that serial as uncertain rather than guessing. Return a list of serials and a confidence note. Do not invent numbers that are not visible.

Pass the stored file URL or the image buffer, whichever your node accepts.

Check the register in code. Query your asset table for each serial. Compare with the expected assets on the job. This step should be deterministic. The model is not the source of truth for whether a unit belongs on this site.

Write the completion. Update the job with the photo URL, the serials, the match result and a timestamp. If anything is uncertain or mismatched, set needs_review and notify operations. If everything matches, set completed.

Respond to the app. Return JSON the mobile client can show: stored, matched, or sent for review. The engineer should not be left on a spinner with no next step.

If you would rather not wire the canvas by hand, click Build with AI to open Compass and describe the flow in plain language. It builds on your actual canvas, so you can still test and edit every step. For trickier photos that need a second look, the workflow can hand off to an AI agent built with Agent Max, or simply queue the job for a person.

A chat agent can describe a photo you paste in. A BuildShip file-upload agent accepts the multipart request, stores the image, checks the asset register and writes the job record, with a log of the run

The photo has to become a stored file and a job record. That is backend work, not a chat.

Test it, ship it and run one real install

  1. POST a sample photo and job id from Postman.

  2. Confirm the file is stored, the serials look right, and the completion record matches the register.

  3. Try a photo with a hard-to-read plate, and a job id that does not exist. Both should fail in a boring, clear way.

  4. Click Ship, then point the field app at the endpoint and do one supervised install.

Open the logging panel at the bottom of the workspace to see what happened. You can switch from the Workflow view to the Node view to read the logs for a single step, and test runs show live logs as they happen. Production logs usually show up within about 45 seconds, and the refresh icon loads them straight away. To add your own messages, use the Log Message to Console node, or call logging.log inside any nodeโ€™s code.

See the logging docs and the node failure docs for retries. Use version history before you change a live vision prompt, because this agent writes to the job system.

A few guardrails are worth adding early:

  • Limit file types and size in the first nodes, and reject clearly wrong uploads (a PDF when you expected a photo, for example).

  • Never overwrite a completed job without a review path.

  • Do not let the agent create new assets in the register on its own. A mismatch is a review, not a silent insert.

Built for teams that run this in production

Field uploads become evidence, so a few things matter beyond the first test:

  • Full code access. Open any node to read or change its JavaScript or TypeScript.

  • Team access control. Role-based access lets you decide who can view a workflow, who can edit it and who can ship it.

  • Your own Google Cloud. Workflows run on Google Cloud, and you can run them in your own Google Cloud project as an enterprise option.

  • A log per upload. When a job is disputed, you can open the run and see the photo, the serials that were read and the register check.

If the event is โ€œa document changed in Firestoreโ€ rather than โ€œa file arrived at this URL,โ€ use the Firestore trigger guide instead. If the client is sending JSON with no file, use the REST API Call trigger. For the broader idea of waking an agent from a real event, see Why AI Agents Need Listeners, Not Cron Jobs.

FAQ

Can I trigger an AI agent when a file is uploaded?

Yes. Add the REST API File Upload trigger, set a path and method, and click Connect. The trigger accepts multipart/form-data and gives your workflow the file buffer plus any form fields. An AI node can then read the file and write a record.

What does the trigger pass to the workflow?

A file object (original name, mime type, size, encoding, field name and a buffer of the bytes), a body object of other form fields, and the request headers.

How do I test it?

Use Postman or Hoppscotch. Set the method to POST or PUT, use form-data, attach a file, add any extra fields, and send the request to the endpoint URL from the trigger. A successful first test often returns a stored-file URL if you are using the storage template.

Should I use the authenticated file upload trigger instead?

Use the authenticated version when the uploader is a signed-in Firebase user and you want the ID token checked before the file is processed. Use this trigger when the client is a trusted app, a partner system or a form that will pass your own key.

Can I send extra fields with the file, such as a job id?

Yes. Additional form fields arrive on body and can be mapped to workflow inputs. That is how the install-photo agent knows which job the photo belongs to.

How much does it cost to try?

BuildShip plans start with a 7-day trial, and a card is required to start it. See the pricing page for plans and credits.

Start building

Start your 7-day trial (a card is required), add the File Upload trigger, and POST a sample photo with a job id. If you are building field agents for a larger team, talk to us about enterprise.

You might also like

All it takes is an idea.

Imagine. Build. Ship.

Subscribe to our newsletter

Stay in the loop with product updates and news.

ยฉ 2026 BuildShip, Rowy Inc.

All it takes is an idea.

Imagine. Build. Ship.

Subscribe to our newsletter

Stay in the loop with product updates and news.

ยฉ 2026 BuildShip, Rowy Inc.

All it takes is an idea.

Imagine. Build. Ship.

Subscribe to our newsletter

Stay in the loop with product updates and news.

ยฉ 2026 BuildShip, Rowy Inc.