@blaxel/langgraph 0.2.61 → 0.2.62-preview.65
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/README.md +71 -90
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,75 +1,12 @@
|
|
|
1
|
-
# Blaxel
|
|
1
|
+
# Blaxel TypeScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
<img src="https://blaxel.ai/logo-bg.png" alt="Blaxel"/>
|
|
5
|
-
</p>
|
|
3
|
+
[Blaxel](https://blaxel.ai) is a perpetual sandbox platform that achieves near instant latency by keeping infinite secure sandboxes on automatic standby, while co-hosting your agent logic to cut network overhead.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
This package contains helper functions for Blaxel's TypeScript SDK, to let you retrieve model clients and MCP tool definitions in the format required by LangChain/LangGraph.
|
|
8
6
|
|
|
7
|
+
## Example
|
|
9
8
|
|
|
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 LangChain/LangGraph, which lets you retrieve Blaxel resources in LangChain/LangGraph format.
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
## npm
|
|
28
|
-
npm install @blaxel/langgraph
|
|
29
|
-
|
|
30
|
-
## pnpm
|
|
31
|
-
pnpm i @blaxel/langgraph
|
|
32
|
-
|
|
33
|
-
## yarn
|
|
34
|
-
yarn add @blaxel/langgraph
|
|
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
9
|
```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 Langgraph
|
|
73
10
|
import { blTools, blModel } from "@blaxel/langgraph";
|
|
74
11
|
|
|
75
12
|
const stream = await createReactAgent({
|
|
@@ -94,45 +31,89 @@ const stream = await createReactAgent({
|
|
|
94
31
|
}).stream({
|
|
95
32
|
messages: [new HumanMessage(process.argv[2])],
|
|
96
33
|
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# npm
|
|
40
|
+
npm install @blaxel/langgraph
|
|
41
|
+
|
|
42
|
+
# yarn
|
|
43
|
+
yarn add @blaxel/langgraph
|
|
97
44
|
|
|
45
|
+
# bun
|
|
46
|
+
bun add @blaxel/langgraph
|
|
98
47
|
```
|
|
99
48
|
|
|
49
|
+
## Authentication
|
|
100
50
|
|
|
101
|
-
|
|
51
|
+
The SDK authenticates with your Blaxel workspace using these sources (in priority order):
|
|
102
52
|
|
|
103
|
-
Blaxel CLI
|
|
53
|
+
1. Blaxel CLI, when logged in
|
|
54
|
+
2. Environment variables in `.env` file (`BL_WORKSPACE`, `BL_API_KEY`)
|
|
55
|
+
3. System environment variables
|
|
56
|
+
4. Blaxel configuration file (`~/.blaxel/config.yaml`)
|
|
104
57
|
|
|
105
|
-
|
|
106
|
-
- **Node.js:** v18 or later.
|
|
107
|
-
- **Blaxel CLI:** Make sure you have Blaxel CLI installed. If not, [install it](https://docs.blaxel.ai/cli-reference/introduction):
|
|
108
|
-
```bash
|
|
109
|
-
curl -fsSL \
|
|
110
|
-
https://raw.githubusercontent.com/blaxel-ai/toolkit/main/install.sh \
|
|
111
|
-
| BINDIR=/usr/local/bin sudo -E sh
|
|
112
|
-
```
|
|
113
|
-
- **Blaxel login:** Login to Blaxel:
|
|
114
|
-
```bash
|
|
115
|
-
bl login YOUR-WORKSPACE
|
|
116
|
-
```
|
|
58
|
+
When developing locally, the recommended method is to just log in to your workspace with the Blaxel CLI:
|
|
117
59
|
|
|
118
60
|
```bash
|
|
119
|
-
bl
|
|
120
|
-
cd myfolder
|
|
121
|
-
bl deploy
|
|
61
|
+
bl login YOUR-WORKSPACE
|
|
122
62
|
```
|
|
123
63
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
-
|
|
64
|
+
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.
|
|
65
|
+
|
|
66
|
+
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.
|
|
127
67
|
|
|
68
|
+
## Usage
|
|
128
69
|
|
|
70
|
+
### Model use
|
|
129
71
|
|
|
130
|
-
|
|
72
|
+
Blaxel acts as a unified gateway for model APIs, centralizing access credentials, tracing and telemetry. You can integrate with any model API provider, or deploy your own custom model. When a model is deployed on Blaxel, a global API endpoint is also created to call it.
|
|
73
|
+
|
|
74
|
+
This package includes a helper function that creates a reference to a model deployed on Blaxel and returns a framework-specific model client that routes API calls through Blaxel's unified gateway.
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
// With LangChain
|
|
78
|
+
import { blModel } from "@blaxel/langgraph";
|
|
79
|
+
const model = await blModel("claude-3-5-sonnet");
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### MCP tool use
|
|
131
83
|
|
|
132
|
-
|
|
84
|
+
Blaxel lets you deploy and host Model Context Protocol (MCP) servers, accessible at a global endpoint over streamable HTTP.
|
|
133
85
|
|
|
86
|
+
This package includes a helper function that retrieves and returns tool definitions from a Blaxel-hosted MCP server in the format required by specific frameworks.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// With LangChain
|
|
90
|
+
import { blTools } from "@blaxel/langgraph";
|
|
91
|
+
const tools = await blTools(['blaxel-search'])
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Telemetry
|
|
95
|
+
|
|
96
|
+
Instrumentation happens automatically when workloads run on Blaxel.
|
|
97
|
+
|
|
98
|
+
Enable automatic telemetry by importing the `@blaxel/telemetry` package:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import "@blaxel/telemetry";
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Requirements
|
|
105
|
+
|
|
106
|
+
- Node.js v18 or later
|
|
107
|
+
|
|
108
|
+
## Documentation
|
|
109
|
+
|
|
110
|
+
- [Connect to MCP servers hosted on Blaxel](https://docs.blaxel.ai/Agents/Develop-an-agent-ts)
|
|
111
|
+
- [Connect to model APIs hosted on Blaxel](https://docs.blaxel.ai/Agents/Develop-an-agent-ts)
|
|
112
|
+
|
|
113
|
+
## Contributing
|
|
134
114
|
|
|
115
|
+
Contributions are welcome! Please feel free to [submit a pull request](https://github.com/blaxel-ai/sdk-typescript/pulls).
|
|
135
116
|
|
|
136
117
|
## License
|
|
137
118
|
|
|
138
|
-
This project is licensed under the MIT License
|
|
119
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaxel/langgraph",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.62-preview.65",
|
|
4
4
|
"description": "Blaxel SDK for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blaxel, INC (https://blaxel.ai)",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"dist"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@blaxel/core": "
|
|
52
|
+
"@blaxel/core": "0.2.62-preview.65",
|
|
53
53
|
"@google/generative-ai": "^0.24.1",
|
|
54
54
|
"@langchain/anthropic": "^1.1.1",
|
|
55
55
|
"@langchain/cohere": "^1.0.0",
|