Back to articles

Sarion: the workflow challenge

Specialized AIs

Published on 9/18/2025

In recent months, I’ve been working intensively on Sarion, my personal assistant project based on Next.js, Mastra AI and Gemini 2.5. At first, it was an experimental idea—a sort of sandbox to test the power of new intelligent agent technologies. But over time, the system’s complexity grew to the point where a single main agent with a central prompt was no longer enough.

For this reason, I decided to develop a series of dedicated workflows and secondary agents, each with limited objectives and tools, to relieve the main agent of overly diverse tasks and ensure order, scalability, and control.

Why protect database access

A key principle I adopted was not to give the main agent direct access to the database. The AI cannot write its own SQL queries or query it freely. Instead, all interactions must go through limited, strictly controlled functions.

This turned out to be a smart choice for at least two reasons:

- Security: prevents an agent reasoning error from producing destructive queries, such as a `DELETE` without conditions.

- Reliability: keeps data structure consistent and avoids “creative” queries that could be difficult to monitor or reproduce.

A concrete example: if the user asks “show me the latest notes,” the agent does not build the query itself but uses a predefined function with clear parameters. This reduces the risk of injections, bugs, and inconsistencies.

The main Sarion workflows

Sarion workflows and tools

To manage complexity, I divided Sarion into four main types of workflow:

- CRUD workflows

These are the simplest. When the main agent recognizes a create, read, update, or delete operation (such as adding, editing, or deleting a note), it does not handle the logic directly, but delegates to the CRUD workflow. This ensures that basic operations remain isolated, fast, and safe.

- Organizational workflows

When it comes to structuring more complex information, the main agent delegates to the organizational workflow. This first retrieves the necessary data and passes it to a specialized agent that works with limited tools and a dedicated prompt. It’s a two-step process that reduces errors and keeps each component’s responsibility clear.

- Planning workflows

This is the most complex and also one of the two cyclic workflows. Here, the agent gathers information, creates a plan, revises it with iterative suggestions, and cycles up to three times before confirming the final result. This structure delivers more thorough planning without falling into infinite loops.

- Task creation workflow

This workflow analyzes a task requested by the user and asks: “Can it be broken down into subtasks?” If so, it keeps cycling until it generates atomic, well-defined activities. This is a fundamental approach that makes tasks clear and actionable, instead of vague general instructions.

Why so many workflows instead of a single super-powered agent

You might think it’s better to put everything in the hands of a single agent with a massive prompt and access to all the tools. In reality, while this may seem faster at first, it quickly becomes unmanageable in production.

That’s why I chose the opposite approach:

- Controllability: fewer tools available to an agent means fewer chances for errors and more predictable decisions.

- Scalability: we can improve each workflow without risking breaking the whole system.

- Best practice: dividing responsibilities is a golden rule in both software architecture and intelligent agent design. It’s the same principle as single responsibility applied to the AI world.

An agent with “too much power” risks becoming opaque, unmanageable, and hard to debug. Instead, by delegating and structuring processes, each part of the system remains clear, modular, and easier to test.

Conclusions

In conclusion, the Sarion journey shows that the real challenge in creating an AI assistant is not just making it work, but keeping it reliable, safe, and controlled over time. The path of dedicated workflows and the “less freedom, more focused responsibility” principle is proving to be the winning choice.

Tell me about your idea

Do you have an idea you’d like to turn into reality? Contact me to discuss how I can help you build your MVP.

Contact me