> For the complete documentation index, see [llms.txt](https://myros.gitbook.io/bp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://myros.gitbook.io/bp/architecture.md).

# Architecture

<figure><img src="/files/eGAHOP1GDhs4Ydnw0CbM" alt=""><figcaption></figcaption></figure>

The current architecture is intentionally practical. It focuses on fast deployment, real usage, and clear extensibility.

At a high level, Myros consists of five core layers:

| Layer                     | Role                                                               |
| ------------------------- | ------------------------------------------------------------------ |
| Interface Layer           | Handles user and admin interaction through Telegram                |
| Agent Command Layer       | Routes commands, project creation, admin actions, and user queries |
| Knowledge Retrieval Layer | Crawls approved websites and extracts relevant content             |
| LLM Reasoning Layer       | Sends structured context and user queries to an AI model           |
| Persistence Layer         | Stores projects, settings, sources, and conversation history       |

***

#### System Flow

A simplified Myros interaction follows this flow:

1. A user asks a question inside Telegram.
2. Myros identifies the relevant project agent.
3. Myros retrieves the project’s approved knowledge sources.
4. The crawler fetches current content from those sources.
5. The LLM layer receives the user question, retrieved knowledge, conversation context, and personality instructions.
6. Myros generates a response.
7. The conversation history is persisted for continuity.

This creates a loop where user interaction, live knowledge retrieval, and conversational memory work together.

**Architecture Diagram**

```
                  ┌────────────────┐
   Telegram ──►   │     Myros      │
                  │  Agent Router  │
                  └───────┬────────┘
                          │
        ┌─────────────────┼─────────────────┐
        ▼                 ▼                 ▼
   Commands Layer     Crawler Layer      LLM Layer
   Admin + User       Website Fetching   AI Responses
   Controls           Content Parsing    Personality
        │                 │                 │
        └─────────────────┴────────┬────────┘
                                   ▼
                           Persistence Layer
                           PostgreSQL Storage
                           Projects, Sources,
                           Conversation History
```

***

#### Interface Layer

<figure><img src="/files/ikEeFwt5pdjYc3N5e3UA" alt=""><figcaption></figcaption></figure>

The current interface layer is Telegram-native.

Telegram is used because it provides:

| Advantage           | Why It Matters                                                      |
| ------------------- | ------------------------------------------------------------------- |
| Low friction        | Users already understand chat interfaces                            |
| Community alignment | Many Web3, gaming, and open-source communities already use Telegram |
| Bot infrastructure  | Telegram supports bot-based interactions naturally                  |
| Deep links          | Project-specific access can be created through unique links         |
| Admin interaction   | Project setup and source management can happen directly inside chat |

The interface layer currently supports both local development and production deployment.

In local development, Myros can run in polling mode.\
In production, Myros can run through webhook mode using a public HTTPS URL.

***

#### Knowledge Retrieval Layer

The knowledge retrieval layer allows Myros to connect to project-approved sources.

At the current stage, these sources are website URLs. Admins can add or remove sources from inside Telegram. When users ask questions, Myros crawls the approved websites, extracts relevant content, and uses it as context for the response.

This allows Myros to answer based on current project information rather than relying only on the base knowledge of an AI model.

Current retrieval capabilities include:

| Capability                    | Current Status |
| ----------------------------- | -------------- |
| Website crawling              | Supported      |
| Admin-managed source URLs     | Supported      |
| Per-project knowledge bases   | Supported      |
| Real-time retrieval per query | Supported      |
| PDF / CSV / DOCX ingestion    | Roadmap        |
| Vector search                 | Roadmap        |
| Crawler caching               | Roadmap        |

The long-term goal is to expand retrieval beyond websites into a full knowledge ingestion layer.

***

#### LLM Reasoning Layer

Myros uses an LLM layer to convert retrieved project knowledge into natural language answers.

This layer receives:

| Input                     | Purpose                                 |
| ------------------------- | --------------------------------------- |
| User question             | The current request                     |
| Retrieved source content  | Project-specific context                |
| Conversation history      | Continuity across messages              |
| Personality configuration | Tone, identity, and behavioral style    |
| Model settings            | Controls response length and creativity |

The current implementation supports configurable model parameters such as model name, token budget, and temperature.

This allows builders to tune Myros depending on their intended use case.

A technical support agent may use a more precise and deterministic style.\
A community companion may use a warmer and more expressive style.\
A gaming lore agent may use a more immersive personality.

***

#### Persistence Layer

Myros uses PostgreSQL as the persistence layer.

The persistence layer stores:

| Data                 | Purpose                                         |
| -------------------- | ----------------------------------------------- |
| Project records      | Keeps each agent’s configuration separate       |
| Admin credentials    | Controls access to project management functions |
| Knowledge sources    | Tracks websites connected to each project       |
| Conversation history | Enables context and continuity                  |
| User/project state   | Allows agents to survive restarts               |

Persistence is essential because an AI agent should not lose its identity or context every time the system restarts.

By using PostgreSQL, Myros has a practical and widely understood storage foundation that can be deployed locally, remotely, or through hosted database providers.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://myros.gitbook.io/bp/architecture.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.
