SLS DataAgent supports data query and analysis in natural language. It relies on three connected objects: Source Model, Context Model, and DataAgent. Each object answers a different question — what the data is, how your business interprets that data, and how to query the data.
Overall structure
The following diagram shows how the three SLS DataAgent objects are connected:
project A ─ Source Model A ┐
├─ Context Model ─ DataAgent ─ session
project B ─ Source Model B ┘A Source Model cannot be bound directly to a DataAgent. Create the objects in the following order:
Generate the Source Model.
Create a Context Model to aggregate the data.
Bind the Context Model to the DataAgent.
SLS project and LogStore
A project is the resource management unit of Simple Log Service (SLS). A LogStore collects, stores, and queries logs.
Semantic elements
The following table describes the semantic elements that Source Models and Context Models carry:
Element | Description | Common content |
Data table | A description of a logical dataset and its fields | Field name, data type, dimension or measure, meaning of enumeration values, time field |
Metric | A reusable business calculation definition | Metric name, calculation expression, description |
Term | A mapping between business language and data meaning | Term, alias, explanation, associated data table |
Query example | Helps the DataAgent build common queries | Question description, SQL, data source binding, default time range |
Physical storage | The coordinates of the SLS data source | Region, project, LogStore |
Storage association | The mapping from the logical model to the physical data | The relationship between a data table or metric and a LogStore |
Source Model
A Source Model is a project-level data semantic model that maps one-to-one to a project. It is generated within the boundary of that project and extracts data structures and semantics from one or more LogStores in the project. Generation starts after you select a project. You do not need to name the model separately.
The generation task references the following content:
The indexed fields and data samples of the LogStore
The query statements and analytic statements in dashboards
Alert rules
Scheduled SQL jobs
A Source Model mainly contains data tables, metrics, and terms. It describes the current structure of the data, the meaning of each field, the existing calculation methods, and the common business expressions.
Adoption status
The generated content of a Source Model has one of the following adoption statuses:
Status | Description | Used by DataAgent |
Automatically adopted | Sufficient evidence exists, and the system confirms the content directly | Yes |
Not adopted | Evidence is insufficient or ambiguous, and the content is pending manual handling | No |
Manually adopted | You confirm or edit the content, and it is then adopted | Yes |
A DataAgent uses only adopted semantics. After generation completes, handle the content that is not adopted before you create Context Models and DataAgents for formal business use.
Context Model
A Context Model is an account-level, centralized business semantic layer. It can be associated with one or more Source Models and use the LogStores that you select. A Context Model consolidates data semantics that are scattered across projects into one business scenario.
For example, an order analysis Context Model can be associated with gateway access logs, order service logs, and inventory service logs at the same time. It can also maintain unified definitions of order status, payment success rate, and transaction amount.
A Context Model contains content that is synchronized from Source Models. You can also add the metrics, terms, and query examples that are specific to the scenario.
Synchronized and manually added elements
Elements that are synchronized from a Source Model to a Context Model are managed by the Source Model. To modify them, go back to the Source Model. The updates are then synchronized to the Context Model.
Metrics, terms, and query examples that you add manually to a Context Model are not overwritten by automatic synchronization from a Source Model. Use them to store the business definitions specific to your team and the query patterns that you have validated.
During the current public preview, synchronization from a Source Model to a Context Model follows these rules:
New or confirmed content in a Source Model is automatically synchronized to the associated Context Models, with a maximum delay of 60 seconds.
After you remove a data source, the previously synchronized elements are cleaned up in subsequent synchronization cycles.
If you delete a synchronized element directly, it may be restored at the next synchronization.
DataAgent
A DataAgent, also known as a digital employee, is a conversation-oriented instance for data query and analysis. When you create one, bind at least one Context Model and configure a Resource Access Management (RAM) role, a name, a description, and an optional System Prompt.
The bound Context Models determine which business definitions and data sources the DataAgent can understand. The RAM role determines which SLS resources the DataAgent can access at runtime. Both conditions must be met before the DataAgent can complete a query.
RAM roles
A RAM role is the identity that a DataAgent uses to access data. The system default role is suitable for getting started quickly. A custom role is suitable for narrowing permissions by business line, project, or LogStore.
Distinguish between the following two authorization objects:
Authorization object | Scope of control |
RAM user | Whether you can create, view, and update models, DataAgents, and sessions, and whether you can pass a specified role |
DataAgent RAM role | The data and resources that the DataAgent can access at runtime |
Creating a DataAgent does not automatically grant it access to all data. Conversely, a DataAgent RAM role that can read a project does not mean that every RAM user can manage that DataAgent.