# I. Modularity Over Monoliths

The Seven-Factor App is inherently modular and follows the best practices of microservices architecture. This enables iterative changes, deployment and scalability at scale. Modularity can be achieved by either packaging coherent set of functionalities as microservices or model an emerging architecture specifically for generative AI applications called Multi-Agent RAG Systems (MARS).

MARS enables building AI Agents that are capable of both Reasoning and Action (ReACT agents) and built with collaborating at scale with other agents.&#x20;

A typical ReACT agent consists of three primary constructs:&#x20;

1. **Intelligence** - Access to one or more LLMs.
2. **Tools** - Access to receptors and effectors through webhooks and APIs.
3. **Knowledge** - Access to both structured and unstructured data specific to the agent's goals and objectives.&#x20;

An agent also maintains state or has both long-term and short-term "memory" that can be encapsulated within knowledge.

<figure><img src="/files/3QiKX4lP0hPNXeQIxo9H" alt=""><figcaption><p>A visual representation of a ReACT Agent</p></figcaption></figure>

### Collaboration

As of writing this document, there are two primary ways of collaboration between agents.&#x20;

1. **Supervisor and Worker collaboration** - In this method, the supervisor assigns tasks to other agents, collates and then either returns the information and/or completes and action. In this method, the results are non-deterministic and not always explainable which is why the second method is more appropriate for enterprise use cases.
2. **Sequential workflows -** In this method, a workflow or graph consists of nodes and edges. The nodes could be agents that are called upon based on sequential algorithm and executed based on the graph/workflow overall requirement. In this method, there is more control but requires more effort to build and continue to maintain and iterate based on changing requirements.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sevenfactor.app/i.-modularity-over-monoliths.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
