Curious what techniques people are using to get data out of their agent fields. It’s easy to send data to Agents from fields, but as far as I understand it, Agents can’t currently return this data back out to other fields. So, let’s say I have an Agent extract the ‘date’ from a document, that data stays in the field output, and cannot be sent (using the UX) to a date field. I’m not seeing any documentation about this.
My first thought would be to have the Agent output a JSON object, then use a formula in another field to get (e.g. REGEX_EXTRACT()) the data from the object.
Anyone else exploring this solution?
Page 1 / 1
You have 2 different ways of handling this.
Turning on AI for a specific field: If you create a long text field (and a few other types of fields too), you can enable AI for that field and tell it what you want it to automatically put into that field.
Using AI in automations: You can create an automation with the action “Generate Text With AI”, and you can tell it to return the text to you in JSON format.
Then, you can add a “Run Script” action where you can write a JavaScript to extract individual pieces of data from the JSON — which you can then use in another action to put the individual pieces of data into individual fields.
I do not know JavaScript, but check out the 2 screenshots below. Somebody gave me this one-line script which should work to extract the individual pieces of data from the JSON.
Don’t forget to set the input.config variable in the left margin, as you will see in the screenshot below. If you forget to set the input.config variable, it will not work.
For your next action, you can see that the data is all individually separated, so you can use the individual pieces of data in your automation:
Exactly as mentioned @ScottWorld you can go with either of such solutions. If the latter, I’d suggest you include an example of the json you’d like to obtain on the prompt itself. In that way, the AI knows exactly what you are expecting.
Okay, so I guess I could create multiple fields and make each one of them extract a different piece of data from the same attachment. I might give that a try, but I assume it uses a LOT of tokens.
Okay - great. This makes sense. I’ll have to try playing around with the different ways to do this, but it’s nice to know the script output is accessible in a structured way. One thought that occurs to me is that the steps involved here are not far off from just doing this with Zapier + OpenAI. I wonder what the cost comparison would be.
Hey @Matt_Kennedy1 you can probably easily calculate that. I’m on my phone now, but if I were to guess I’d say that working with OpenAI (or other) diectly via any automation tool would be cheaper.
I’d suggest you self host your own instance of n8n (automation tool) if you are concerned about pricing.
@Matt_Kennedy1
Yeah, I actually think that’s a much better idea to just use an external automation tool that communicates directly with OpenAI, which gives you complete flexibility. It will even automatically parse your JSON for you.
However, you mentioned Zapier in your message above.
Unless you are already heavily invested in Zapier and it would be nearly impossible for you to move away from Zapier, I would STRONGLY recommend against using Zapier and use Make’s automations & integrations instead.
Make is INFINITELY more powerful & customizable than Zapier, yet it is SIGNIFICANTLY CHEAPER than Zapier.
You should also just be able to get your AI field to output the data into a specific format and then use formula fields to extract the data. No need to get crazy.
For example, if the AI field outputs:
due: 07/15/2025 name: John Doe amount: $3.50
To extract the "due" date: REGEX_EXTRACT({YourFieldName}, 'due: (.+)')
To extract the "name": REGEX_EXTRACT({YourFieldName}, 'name: (.+)')
To extract the "amount": REGEX_EXTRACT({YourFieldName}, 'amount: (.+')
You can also wrap the date formula in “datetime_parse()” as long as the prompt is designed to format it in a matching configuration.
I love reading the reply’s from @ScottWorld and @Mike_AutomaticN, it’s literally how I have learned half of the things I now know in Airtable! Thanks guys for always replying in thoughtful ways!
Thanks so much, @MilhoanDesign! That’s so nice of you to say!! :)
Oh wow, @MilhoanDesign I really appreciate that a lot. We actually spend a lot of time here, and (whenever possible) try to include as much detail as we can on our answers. Reading this truly makes it all worth it.