@mastra/loggers 1.0.1 → 1.0.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/docs/SKILL.md +16 -22
- package/dist/docs/{SOURCE_MAP.json → assets/SOURCE_MAP.json} +1 -1
- package/dist/docs/{observability/02-logging.md → references/docs-observability-logging.md} +6 -10
- package/dist/docs/{observability/01-overview.md → references/docs-observability-overview.md} +4 -7
- package/dist/docs/references/reference-core-mastra-class.md +66 -0
- package/dist/docs/{logging/01-reference.md → references/reference-logging-pino-logger.md} +16 -15
- package/package.json +5 -6
- package/dist/docs/README.md +0 -33
- package/dist/docs/core/01-reference.md +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @mastra/loggers
|
|
2
2
|
|
|
3
|
+
## 1.0.2-alpha.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dependencies updates: ([#13237](https://github.com/mastra-ai/mastra/pull/13237))
|
|
8
|
+
- Updated dependency [`pino-pretty@^13.1.3` ↗︎](https://www.npmjs.com/package/pino-pretty/v/13.1.3) (from `^13.0.0`, in `dependencies`)
|
|
9
|
+
- Updated dependencies:
|
|
10
|
+
- @mastra/core@1.5.0-alpha.1
|
|
11
|
+
|
|
3
12
|
## 1.0.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,34 +1,28 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: mastra-loggers
|
|
3
|
-
description: Documentation for @mastra/loggers.
|
|
2
|
+
name: mastra-loggers
|
|
3
|
+
description: Documentation for @mastra/loggers. Use when working with @mastra/loggers APIs, configuration, or implementation.
|
|
4
|
+
metadata:
|
|
5
|
+
package: "@mastra/loggers"
|
|
6
|
+
version: "1.0.2-alpha.0"
|
|
4
7
|
---
|
|
5
8
|
|
|
6
|
-
|
|
9
|
+
## When to use
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
> **Package**: @mastra/loggers
|
|
11
|
+
Use this skill whenever you are working with @mastra/loggers to obtain the domain-specific knowledge.
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## How to use
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Read the individual reference documents for detailed explanations and code examples.
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
cat docs/SOURCE_MAP.json
|
|
17
|
-
```
|
|
17
|
+
### Docs
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
- **implementation**: `.js` chunk file with readable source
|
|
22
|
-
- **docs**: Conceptual documentation in `docs/`
|
|
19
|
+
- [Logging](references/docs-observability-logging.md) - Learn how to use logging in Mastra to monitor execution, capture application behavior, and improve the accuracy of AI applications.
|
|
20
|
+
- [Observability Overview](references/docs-observability-overview.md) - Monitor and debug applications with Mastra's Observability features.
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
### Reference
|
|
25
23
|
|
|
24
|
+
- [Reference: Mastra Class](references/reference-core-mastra-class.md) - Documentation for the `Mastra` class in Mastra, the core entry point for managing agents, workflows, MCP servers, and server endpoints.
|
|
25
|
+
- [Reference: PinoLogger](references/reference-logging-pino-logger.md) - Documentation for PinoLogger, which provides methods to record events at various severity levels.
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Available Topics
|
|
31
|
-
|
|
32
|
-
- [Core](core/) - 1 file(s)
|
|
33
|
-
- [Logging](logging/) - 1 file(s)
|
|
34
|
-
- [Observability](observability/) - 2 file(s)
|
|
28
|
+
Read [assets/SOURCE_MAP.json](assets/SOURCE_MAP.json) for source code references.
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
> Learn how to use logging in Mastra to monitor execution, capture application behavior, and improve the accuracy of AI applications.
|
|
2
|
-
|
|
3
1
|
# Logging
|
|
4
2
|
|
|
5
3
|
Mastra's logging system captures function execution, input data, and output responses in a structured format.
|
|
@@ -10,7 +8,7 @@ When deploying to Mastra Cloud, logs are shown on the [Logs](https://mastra.ai/d
|
|
|
10
8
|
|
|
11
9
|
When [initializing a new Mastra project](https://mastra.ai/guides/getting-started/quickstart) using the CLI, `PinoLogger` is included by default.
|
|
12
10
|
|
|
13
|
-
```typescript
|
|
11
|
+
```typescript
|
|
14
12
|
import { Mastra } from "@mastra/core/mastra";
|
|
15
13
|
import { PinoLogger } from "@mastra/loggers";
|
|
16
14
|
|
|
@@ -22,9 +20,7 @@ export const mastra = new Mastra({
|
|
|
22
20
|
});
|
|
23
21
|
```
|
|
24
22
|
|
|
25
|
-
> **
|
|
26
|
-
|
|
27
|
-
Visit [PinoLogger](https://mastra.ai/reference/logging/pino-logger) for all available configuration options.
|
|
23
|
+
> **Info:** Visit [PinoLogger](https://mastra.ai/reference/logging/pino-logger) for all available configuration options.
|
|
28
24
|
|
|
29
25
|
## Customizing logs
|
|
30
26
|
|
|
@@ -34,7 +30,7 @@ Mastra provides access to a logger instance via the `mastra.getLogger()` method,
|
|
|
34
30
|
|
|
35
31
|
Within a workflow step, access the logger via the `mastra` parameter inside the `execute` function. This allows you to log messages relevant to the step’s execution.
|
|
36
32
|
|
|
37
|
-
```typescript
|
|
33
|
+
```typescript
|
|
38
34
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
39
35
|
import { z } from "zod";
|
|
40
36
|
|
|
@@ -58,7 +54,7 @@ export const testWorkflow = createWorkflow({...})
|
|
|
58
54
|
|
|
59
55
|
Similarly, tools have access to the logger instance via the `mastra` parameter. Use this to log tool specific activity during execution.
|
|
60
56
|
|
|
61
|
-
```typescript
|
|
57
|
+
```typescript
|
|
62
58
|
import { createTool } from "@mastra/core/tools";
|
|
63
59
|
import { z } from "zod";
|
|
64
60
|
|
|
@@ -80,7 +76,7 @@ Logger methods accept an optional second argument for additional data. This can
|
|
|
80
76
|
|
|
81
77
|
In this example, the log message includes an object with a key of `agent` and a value of the `testAgent` instance.
|
|
82
78
|
|
|
83
|
-
```typescript
|
|
79
|
+
```typescript
|
|
84
80
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
85
81
|
import { z } from "zod";
|
|
86
82
|
|
|
@@ -88,7 +84,7 @@ const step1 = createStep({
|
|
|
88
84
|
execute: async ({ mastra }) => {
|
|
89
85
|
const testAgent = mastra.getAgent("testAgent");
|
|
90
86
|
const logger = mastra.getLogger();
|
|
91
|
-
|
|
87
|
+
|
|
92
88
|
logger.info("workflow info log", { agent: testAgent });
|
|
93
89
|
|
|
94
90
|
return {
|
package/dist/docs/{observability/01-overview.md → references/docs-observability-overview.md}
RENAMED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
> Monitor and debug applications with Mastra
|
|
2
|
-
|
|
3
1
|
# Observability Overview
|
|
4
2
|
|
|
5
3
|
Mastra provides observability features for AI applications. Monitor LLM operations, trace agent decisions, and debug complex workflows with tools that understand AI-specific patterns.
|
|
@@ -17,15 +15,15 @@ Specialized tracing for AI operations that captures:
|
|
|
17
15
|
|
|
18
16
|
## Storage Requirements
|
|
19
17
|
|
|
20
|
-
The `DefaultExporter` persists traces to your configured storage backend. Not all storage providers support observability—for the full list, see [Storage Provider Support](https://mastra.ai/docs/observability/tracing/exporters/default
|
|
18
|
+
The `DefaultExporter` persists traces to your configured storage backend. Not all storage providers support observability—for the full list, see [Storage Provider Support](https://mastra.ai/docs/observability/tracing/exporters/default).
|
|
21
19
|
|
|
22
|
-
For production environments with high traffic, we recommend using **ClickHouse** for the observability domain via [composite storage](https://mastra.ai/reference/storage/composite). See [Production Recommendations](https://mastra.ai/docs/observability/tracing/exporters/default
|
|
20
|
+
For production environments with high traffic, we recommend using **ClickHouse** for the observability domain via [composite storage](https://mastra.ai/reference/storage/composite). See [Production Recommendations](https://mastra.ai/docs/observability/tracing/exporters/default) for details.
|
|
23
21
|
|
|
24
22
|
## Quick Start
|
|
25
23
|
|
|
26
24
|
Configure Observability in your Mastra instance:
|
|
27
25
|
|
|
28
|
-
```typescript
|
|
26
|
+
```typescript
|
|
29
27
|
import { Mastra } from "@mastra/core";
|
|
30
28
|
import { PinoLogger } from "@mastra/loggers";
|
|
31
29
|
import { LibSQLStore } from "@mastra/libsql";
|
|
@@ -59,8 +57,7 @@ export const mastra = new Mastra({
|
|
|
59
57
|
});
|
|
60
58
|
```
|
|
61
59
|
|
|
62
|
-
> **Serverless environments
|
|
63
|
-
The `file:./mastra.db` storage URL uses the local filesystem, which doesn't work in serverless environments like Vercel, AWS Lambda, or Cloudflare Workers. For serverless deployments, use external storage. See the [Vercel deployment guide](https://mastra.ai/guides/deployment/vercel-deployer#observability) for a complete example.
|
|
60
|
+
> **Serverless environments:** The `file:./mastra.db` storage URL uses the local filesystem, which doesn't work in serverless environments like Vercel, AWS Lambda, or Cloudflare Workers. For serverless deployments, use external storage. See the [Vercel deployment guide](https://mastra.ai/guides/deployment/vercel) for a complete example.
|
|
64
61
|
|
|
65
62
|
With this basic setup, you will see Traces and Logs in both Studio and in Mastra Cloud.
|
|
66
63
|
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Mastra Class
|
|
2
|
+
|
|
3
|
+
The `Mastra` class is the central orchestrator in any Mastra application, managing agents, workflows, storage, logging, observability, and more. Typically, you create a single instance of `Mastra` to coordinate your application.
|
|
4
|
+
|
|
5
|
+
Think of `Mastra` as a top-level registry where you register agents, workflows, tools, and other components that need to be accessible throughout your application.
|
|
6
|
+
|
|
7
|
+
## Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Mastra } from "@mastra/core";
|
|
11
|
+
import { PinoLogger } from "@mastra/loggers";
|
|
12
|
+
import { LibSQLStore } from "@mastra/libsql";
|
|
13
|
+
import { weatherWorkflow } from "./workflows/weather-workflow";
|
|
14
|
+
import { weatherAgent } from "./agents/weather-agent";
|
|
15
|
+
|
|
16
|
+
export const mastra = new Mastra({
|
|
17
|
+
workflows: { weatherWorkflow },
|
|
18
|
+
agents: { weatherAgent },
|
|
19
|
+
storage: new LibSQLStore({
|
|
20
|
+
id: 'mastra-storage',
|
|
21
|
+
url: ":memory:",
|
|
22
|
+
}),
|
|
23
|
+
logger: new PinoLogger({
|
|
24
|
+
name: "Mastra",
|
|
25
|
+
level: "info",
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Constructor parameters
|
|
31
|
+
|
|
32
|
+
Visit the [Configuration reference](https://mastra.ai/reference/configuration) for detailed documentation on all available configuration options.
|
|
33
|
+
|
|
34
|
+
**agents?:** (`Record<string, Agent>`): Agent instances to register, keyed by name (Default: `{}`)
|
|
35
|
+
|
|
36
|
+
**tools?:** (`Record<string, ToolApi>`): Custom tools to register. Structured as a key-value pair, with keys being the tool name and values being the tool function. (Default: `{}`)
|
|
37
|
+
|
|
38
|
+
**storage?:** (`MastraCompositeStore`): Storage engine instance for persisting data
|
|
39
|
+
|
|
40
|
+
**vectors?:** (`Record<string, MastraVector>`): Vector store instance, used for semantic search and vector-based tools (eg Pinecone, PgVector or Qdrant)
|
|
41
|
+
|
|
42
|
+
**logger?:** (`Logger`): Logger instance created with new PinoLogger() (Default: `Console logger with INFO level`)
|
|
43
|
+
|
|
44
|
+
**idGenerator?:** (`() => string`): Custom ID generator function. Used by agents, workflows, memory, and other components to generate unique identifiers.
|
|
45
|
+
|
|
46
|
+
**workflows?:** (`Record<string, Workflow>`): Workflows to register. Structured as a key-value pair, with keys being the workflow name and values being the workflow instance. (Default: `{}`)
|
|
47
|
+
|
|
48
|
+
**tts?:** (`Record<string, MastraVoice>`): Text-to-speech providers for voice synthesis
|
|
49
|
+
|
|
50
|
+
**observability?:** (`ObservabilityEntrypoint`): Observability configuration for tracing and monitoring
|
|
51
|
+
|
|
52
|
+
**deployer?:** (`MastraDeployer`): An instance of a MastraDeployer for managing deployments.
|
|
53
|
+
|
|
54
|
+
**server?:** (`ServerConfig`): Server configuration including port, host, timeout, API routes, middleware, CORS settings, and build options for Swagger UI, API request logging, and OpenAPI docs.
|
|
55
|
+
|
|
56
|
+
**mcpServers?:** (`Record<string, MCPServerBase>`): An object where keys are registry keys (used for getMCPServer()) and values are instances of MCPServer or classes extending MCPServerBase. Each MCPServer must have an id property. Servers can be retrieved by registry key using getMCPServer() or by their intrinsic id using getMCPServerById().
|
|
57
|
+
|
|
58
|
+
**bundler?:** (`BundlerConfig`): Configuration for the asset bundler with options for externals, sourcemap, and transpilePackages.
|
|
59
|
+
|
|
60
|
+
**scorers?:** (`Record<string, Scorer>`): Scorers for evaluating agent responses and workflow outputs (Default: `{}`)
|
|
61
|
+
|
|
62
|
+
**processors?:** (`Record<string, Processor>`): Input/output processors for transforming agent inputs and outputs (Default: `{}`)
|
|
63
|
+
|
|
64
|
+
**gateways?:** (`Record<string, MastraModelGateway>`): Custom model gateways to register for accessing AI models through alternative providers or private deployments. Structured as a key-value pair, with keys being the registry key (used for getGateway()) and values being gateway instances. (Default: `{}`)
|
|
65
|
+
|
|
66
|
+
**memory?:** (`Record<string, MastraMemory>`): Memory instances to register. These can be referenced by stored agents and resolved at runtime. Structured as a key-value pair, with keys being the registry key and values being memory instances. (Default: `{}`)
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
> API reference for logging - 1 entries
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Reference: PinoLogger
|
|
9
|
-
|
|
10
|
-
> Documentation for PinoLogger, which provides methods to record events at various severity levels.
|
|
1
|
+
# PinoLogger
|
|
11
2
|
|
|
12
3
|
A Logger instance is created using `new PinoLogger()` and provides methods to record events at various severity levels.
|
|
13
4
|
|
|
14
|
-
When deploying to Mastra Cloud, logs are displayed on the [Logs](https://mastra.ai/docs/mastra-cloud/observability
|
|
5
|
+
When deploying to Mastra Cloud, logs are displayed on the [Logs](https://mastra.ai/docs/mastra-cloud/observability) page. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
|
|
15
6
|
|
|
16
7
|
## Usage example
|
|
17
8
|
|
|
18
|
-
```typescript
|
|
9
|
+
```typescript
|
|
19
10
|
import { Mastra } from "@mastra/core";
|
|
20
11
|
import { PinoLogger } from "@mastra/loggers";
|
|
21
12
|
|
|
@@ -29,11 +20,21 @@ export const mastra = new Mastra({
|
|
|
29
20
|
|
|
30
21
|
## Parameters
|
|
31
22
|
|
|
23
|
+
**name:** (`string`): A label used to group and identify logs from this logger.
|
|
24
|
+
|
|
25
|
+
**level:** (`"debug" | "info" | "warn" | "error"`): Sets the minimum log level. Messages below this level are ignored.
|
|
26
|
+
|
|
27
|
+
**transports:** (`Record<string, LoggerTransport>`): A map of transport instances used to persist logs.
|
|
28
|
+
|
|
29
|
+
**overrideDefaultTransports?:** (`boolean`): If true, disables the default console transport.
|
|
30
|
+
|
|
31
|
+
**formatters?:** (`pino.LoggerOptions['formatters']`): Custom Pino formatters for log serialization.
|
|
32
|
+
|
|
32
33
|
## File transport (structured logs)
|
|
33
34
|
|
|
34
35
|
Writes structured logs to a file using the `FileTransport`. The logger accepts a plain message as the first argument and structured metadata as the second argument. These are internally converted to a `BaseLogMessage` and persisted to the configured file path.
|
|
35
36
|
|
|
36
|
-
```typescript
|
|
37
|
+
```typescript
|
|
37
38
|
import { FileTransport } from "@mastra/loggers/file";
|
|
38
39
|
import { PinoLogger } from "@mastra/loggers/pino";
|
|
39
40
|
|
|
@@ -57,7 +58,7 @@ fileLogger.warn("Low disk space", {
|
|
|
57
58
|
|
|
58
59
|
Streams structured logs to a remote Redis list using the `UpstashTransport`. The logger accepts a string message and a structured metadata object. This enables centralized logging for distributed environments, supporting filtering by `destinationPath`, `type`, and `runId`.
|
|
59
60
|
|
|
60
|
-
```typescript
|
|
61
|
+
```typescript
|
|
61
62
|
import { UpstashTransport } from "@mastra/loggers/upstash";
|
|
62
63
|
import { PinoLogger } from "@mastra/loggers/pino";
|
|
63
64
|
|
|
@@ -92,7 +93,7 @@ You can create custom transports using the `createCustomTransport` utility to in
|
|
|
92
93
|
|
|
93
94
|
Creates a custom transport using `createCustomTransport` and integrates it with a third-party logging stream such as `pino-sentry-transport`. This allows forwarding logs to an external system like Sentry for advanced monitoring and observability.
|
|
94
95
|
|
|
95
|
-
```typescript
|
|
96
|
+
```typescript
|
|
96
97
|
import { createCustomTransport } from "@mastra/core/loggers";
|
|
97
98
|
import { PinoLogger } from "@mastra/loggers/pino";
|
|
98
99
|
import pinoSentry from "pino-sentry-transport";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/loggers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"license": "Apache-2.0",
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"pino": "^10.1.0",
|
|
69
|
-
"pino-pretty": "^13.
|
|
69
|
+
"pino-pretty": "^13.1.3"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/node": "22.19.7",
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"tsup": "^8.5.1",
|
|
77
77
|
"typescript": "^5.9.3",
|
|
78
78
|
"vitest": "4.0.16",
|
|
79
|
-
"@internal/
|
|
80
|
-
"@mastra/core": "1.
|
|
81
|
-
"@internal/
|
|
79
|
+
"@internal/types-builder": "0.0.34",
|
|
80
|
+
"@mastra/core": "1.5.0-alpha.1",
|
|
81
|
+
"@internal/lint": "0.0.59"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"@mastra/core": ">=1.0.0-0 <2.0.0-0"
|
|
@@ -88,7 +88,6 @@
|
|
|
88
88
|
},
|
|
89
89
|
"scripts": {
|
|
90
90
|
"build:lib": "tsup --silent --config tsup.config.ts",
|
|
91
|
-
"build:docs": "pnpx tsx ../../scripts/generate-package-docs.ts packages/loggers",
|
|
92
91
|
"build:watch": "tsup --watch --silent --config tsup.config.ts",
|
|
93
92
|
"test": "vitest run",
|
|
94
93
|
"lint": "eslint ."
|
package/dist/docs/README.md
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# @mastra/loggers Documentation
|
|
2
|
-
|
|
3
|
-
> Embedded documentation for coding agents
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# Read the skill overview
|
|
9
|
-
cat docs/SKILL.md
|
|
10
|
-
|
|
11
|
-
# Get the source map
|
|
12
|
-
cat docs/SOURCE_MAP.json
|
|
13
|
-
|
|
14
|
-
# Read topic documentation
|
|
15
|
-
cat docs/<topic>/01-overview.md
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Structure
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
docs/
|
|
22
|
-
├── SKILL.md # Entry point
|
|
23
|
-
├── README.md # This file
|
|
24
|
-
├── SOURCE_MAP.json # Export index
|
|
25
|
-
├── core/ (1 files)
|
|
26
|
-
├── logging/ (1 files)
|
|
27
|
-
├── observability/ (2 files)
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Version
|
|
31
|
-
|
|
32
|
-
Package: @mastra/loggers
|
|
33
|
-
Version: 1.0.1
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Core API Reference
|
|
2
|
-
|
|
3
|
-
> API reference for core - 1 entries
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Reference: Mastra Class
|
|
9
|
-
|
|
10
|
-
> Documentation for the `Mastra` class in Mastra, the core entry point for managing agents, workflows, MCP servers, and server endpoints.
|
|
11
|
-
|
|
12
|
-
The `Mastra` class is the central orchestrator in any Mastra application, managing agents, workflows, storage, logging, observability, and more. Typically, you create a single instance of `Mastra` to coordinate your application.
|
|
13
|
-
|
|
14
|
-
Think of `Mastra` as a top-level registry where you register agents, workflows, tools, and other components that need to be accessible throughout your application.
|
|
15
|
-
|
|
16
|
-
## Usage example
|
|
17
|
-
|
|
18
|
-
```typescript title="src/mastra/index.ts"
|
|
19
|
-
import { Mastra } from "@mastra/core";
|
|
20
|
-
import { PinoLogger } from "@mastra/loggers";
|
|
21
|
-
import { LibSQLStore } from "@mastra/libsql";
|
|
22
|
-
import { weatherWorkflow } from "./workflows/weather-workflow";
|
|
23
|
-
import { weatherAgent } from "./agents/weather-agent";
|
|
24
|
-
|
|
25
|
-
export const mastra = new Mastra({
|
|
26
|
-
workflows: { weatherWorkflow },
|
|
27
|
-
agents: { weatherAgent },
|
|
28
|
-
storage: new LibSQLStore({
|
|
29
|
-
id: 'mastra-storage',
|
|
30
|
-
url: ":memory:",
|
|
31
|
-
}),
|
|
32
|
-
logger: new PinoLogger({
|
|
33
|
-
name: "Mastra",
|
|
34
|
-
level: "info",
|
|
35
|
-
}),
|
|
36
|
-
});
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Constructor parameters
|
|
40
|
-
|
|
41
|
-
Visit the [Configuration reference](https://mastra.ai/reference/configuration) for detailed documentation on all available configuration options.
|