@blaxel/mastra 0.2.6 → 0.2.7-preview.7

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.
Files changed (2) hide show
  1. package/README.md +139 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,139 @@
1
+ # Blaxel Typescript SDK
2
+
3
+ <p align="center">
4
+ <img src="https://blaxel.ai/logo.png" alt="Blaxel"/>
5
+ </p>
6
+
7
+ **Blaxel is a computing platform for AI agent builders, with all the services and infrastructure to build and deploy agents efficiently.** This repository contains the TypeScript SDK to interact with Blaxel resources using Mastra format.
8
+
9
+
10
+ ## Table of Contents
11
+
12
+ - [Installation](#installation)
13
+ - [Optional libraries](#optional-libraries)
14
+ - [Authentication](#authentication)
15
+ - [Features](#features)
16
+ - [Quickstart](#quickstart)
17
+ - [Contributing](#contributing)
18
+ - [License](#license)
19
+
20
+
21
+
22
+ ## Installation
23
+
24
+ Install Blaxel SDK for Mastra, which lets you retrieve Blaxel resources in Mastra format.
25
+
26
+ ```bash
27
+ ## npm
28
+ npm install @blaxel/mastra
29
+
30
+ ## pnpm
31
+ pnpm i @blaxel/mastra
32
+
33
+ ## yarn
34
+ yarn add @blaxel/mastra
35
+ ```
36
+
37
+
38
+ ### Optional libraries
39
+ Blaxel SDK is split between multiple packages. *core* is the minimal package to connect to Blaxel. You can find other packages to help you integrate with your favorite AI framework, or set up telemetry.
40
+
41
+ - [@blaxel/telemetry](@blaxel/telemetry/README.md)
42
+ - [@blaxel/core](@blaxel/core/README.md)
43
+
44
+ Instrumentation happens automatically when workloads run on Blaxel. To enable telemetry, simply require the SDK in your project's entry point.
45
+ ```ts
46
+ import "@blaxel/telemetry";
47
+ ```
48
+
49
+
50
+ ### Authentication
51
+
52
+ The Blaxel SDK authenticates with your workspace using credentials from these sources, in priority order:
53
+ 1. When running on Blaxel, authentication is handled automatically
54
+ 2. Variables in your .env file (`BL_WORKSPACE` and `BL_API_KEY`, or see [this page](https://docs.blaxel.ai/Agents/Variables-and-secrets) for other authentication options).
55
+ 3. Environment variables from your machine
56
+ 4. Configuration file created locally when you log in through Blaxel CLI (or deploy on Blaxel)
57
+
58
+ When developing locally, the recommended method is to just log in to your workspace with Blaxel CLI. This allows you to run Blaxel SDK functions that will automatically connect to your workspace without additional setup. When you deploy on Blaxel, this connection persists automatically.
59
+
60
+ When running Blaxel SDK from a remote server that is not Blaxel-hosted, we recommend using environment variables as described in the third option above.
61
+
62
+
63
+
64
+ ## Features
65
+ - [Connect to MCP servers hosted on Blaxel](https://docs.blaxel.ai/Agents/Develop-an-agent-ts)
66
+ - [Connect to model APIs hosted on Blaxel](https://docs.blaxel.ai/Agents/Develop-an-agent-ts)
67
+
68
+
69
+ ## Connect to MCP server tools and models on Blaxel
70
+
71
+ ```ts
72
+ // With Mastra
73
+ import { blTools, blModel } from "@blaxel/mastra";
74
+
75
+ const agent = new Agent({
76
+ name: "blaxel-agent-mastra",
77
+ model: await blModel("gpt-4o-mini"),
78
+ instructions: prompt,
79
+ tools: {
80
+ ...(await blTools(["blaxel-search", "webcrawl"])),
81
+ weatherTool: createTool({
82
+ id: "weatherTool",
83
+ description: "Get the weather in a specific city",
84
+ inputSchema: z.object({
85
+ city: z.string(),
86
+ }),
87
+ outputSchema: z.object({
88
+ weather: z.string(),
89
+ }),
90
+ execute: async ({ context }) => {
91
+ console.debug("TOOLCALLING: local weather", context);
92
+ return `The weather in ${context.city} is sunny`;
93
+ },
94
+ }),
95
+ },
96
+ });
97
+ const stream = await agent.stream([{ role: "user", content: process.argv[2] }]);
98
+
99
+ ```
100
+
101
+
102
+ ## Quickstart
103
+
104
+ Blaxel CLI gives you a quick way to create new applications: agents, MCP servers, jobs, etc - and deploy them to Blaxel.
105
+
106
+ **Prerequisites**:
107
+ - **Node.js:** v18 or later.
108
+ - **Blaxel CLI:** Make sure you have Blaxel CLI installed. If not, [install it](https://docs.blaxel.ai/cli-reference/introduction):
109
+ ```bash
110
+ curl -fsSL \
111
+ https://raw.githubusercontent.com/blaxel-ai/toolkit/main/install.sh \
112
+ | BINDIR=/usr/local/bin sudo -E sh
113
+ ```
114
+ - **Blaxel login:** Login to Blaxel:
115
+ ```bash
116
+ bl login YOUR-WORKSPACE
117
+ ```
118
+
119
+ ```bash
120
+ bl create-agent-app myfolder
121
+ cd myfolder
122
+ bl deploy
123
+ ```
124
+
125
+ Also available:
126
+ - `bl create-mcp-server`
127
+ - `bl create-job`
128
+
129
+
130
+
131
+ ## Contributing
132
+
133
+ Contributions are welcome! Please feel free to submit a Pull Request.
134
+
135
+
136
+
137
+ ## License
138
+
139
+ This project is licensed under the MIT License - see the LICENSE file for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/mastra",
3
- "version": "0.2.6",
3
+ "version": "0.2.7-preview.7",
4
4
  "description": "Blaxel SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",
@@ -53,7 +53,7 @@
53
53
  "dist"
54
54
  ],
55
55
  "dependencies": {
56
- "@blaxel/vercel": "0.2.6"
56
+ "@blaxel/vercel": "0.2.7-preview.7"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@eslint/js": "^9.26.0",