# Generate dynamic JSON output formats for AI agents: n8n workflow

> Started by an event in a connected app. It calls services over plain HTTP rather than through connectors. It hands the judgement calls to Mistral.

Source: https://millionrounds.com/workflow/generate-dynamic-json-output-formats-for-ai-agents (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [AI assistants](https://millionrounds.com/workflows?category=AI+assistants#library)

# Generate dynamic JSON output formats for AI agents

Started by an event in a connected app. It calls services over plain HTTP rather than through connectors. It hands the judgement calls to Mistral. 19 steps, 2 branches, 1 loop or waits: a working afternoon to understand properly.

Medium Calls a model: Mistral

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fgenerate-dynamic-json-output-formats-for-ai-agents)

**19 steps** Medium: a working afternoon

**2** Branches: places the flow splits

**1** Loop or waits

**0** Services by connector: it calls them over plain HTTP

## The flow

Starts it 1 Model 7 Logic 10 Service 1

The steps in the order they run, from what starts it.

- 1 **Mistral Cloud Chat Model** Lm Chat Mistral Cloud *Model*
- 2 **JSON Output Parser** Output Parser Structured *Model*
- 3 **JSON Output Parser 2** Output Parser Structured *Model*
- 4 **When clicking ‘Execute workflow’** Manual trigger *Starts it*
- 5 **Mistral Cloud Chat Model 2** Lm Chat Mistral Cloud *Model*
- 6 **Advanced JSON Output Parser** Advanced Output Parser *Service*
- 7 **JSON Generator** Agent *Model*
- 8 **JSON Validator** Agent *Model*
- 9 **Prepare Input** Set *Logic*
- 10 **JSON Reviewer** Agent *Model*
- 11 **If Valid JSON** If *Logic*
- 12 **Guarantee Input** Set *Logic*
- 13 **JSON Format Works!** No Op *Logic*
- 14 **Update Input 2** Set *Logic*
- 15 **Update Input** Set *Logic*
- 16 **If No More Rounds** If *Logic*
- 17 **Prepare Output** Set *Logic*
- 18 **Round Limit Reached** Stop And Error *Logic*
- 19 **Loop Until it Works** Split In Batches *Logic*

## How it's built

- **Starts on:** An event in a connected app
- **Steps:** 19, with 2 branches, 1 loop or waits
- **Size:** Medium: a working afternoon
- **Connects to:** Nothing by connector; it calls services over plain HTTP
- **Model:** Mistral

## Questions

What does it need to run?

An n8n account, and a key for Mistral. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an event in a connected app.

Does it use AI?

Yes. It calls Mistral. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 19 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 19 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fgenerate-dynamic-json-output-formats-for-ai-agents)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Workflows like it

Also ai assistants, with the same services where possible, closest in size first.

- [**AI slide generation with OpenAI and Google Slides** 19 steps · calls a model · Google Slides](https://millionrounds.com/workflow/ai-slide-generation-with-openai-and-google-slides)
- [**Automatic and dynamic out of office in Exchange online** 19 steps · calls a model · Outlook](https://millionrounds.com/workflow/automatic-and-dynamic-out-of-office-in-exchange-online)
- [**Complete Airtable database management with Redis** 19 steps · calls a model](https://millionrounds.com/workflow/complete-airtable-database-management-with-redis)
- [**Create an intelligent Facebook Messenger chatbot with OpenAI** 19 steps · calls a model](https://millionrounds.com/workflow/create-an-intelligent-facebook-messenger-chatbot-with-openai)
- [**End-to-end healthcare RCM automation suite** 19 steps · calls a model](https://millionrounds.com/workflow/end-to-end-healthcare-rcm-automation-suite)
- [**Find and log GDPR request evidence with Groq and Data Tables** 19 steps · calls a model · n8n data table](https://millionrounds.com/workflow/find-and-log-gdpr-request-evidence-with-groq-and-data-tables)
