@blaxel/langgraph 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.
- package/README.md +138 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
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 LangChain/LangGraph 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 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
|
+
```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
|
+
import { blTools, blModel } from "@blaxel/langgraph";
|
|
74
|
+
|
|
75
|
+
const stream = await createReactAgent({
|
|
76
|
+
llm: await blModel("gpt-4o-mini"),
|
|
77
|
+
prompt: prompt,
|
|
78
|
+
tools: [
|
|
79
|
+
...(await blTools(["blaxel-search", "webcrawl"])),
|
|
80
|
+
tool(
|
|
81
|
+
async (input: any) => {
|
|
82
|
+
console.debug("TOOLCALLING: local weather", input);
|
|
83
|
+
return `The weather in ${input.city} is sunny`;
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "weather",
|
|
87
|
+
description: "Get the weather in a specific city",
|
|
88
|
+
schema: z.object({
|
|
89
|
+
city: z.string(),
|
|
90
|
+
}),
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
],
|
|
94
|
+
}).stream({
|
|
95
|
+
messages: [new HumanMessage(process.argv[2])],
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
## Quickstart
|
|
102
|
+
|
|
103
|
+
Blaxel CLI gives you a quick way to create new applications: agents, MCP servers, jobs, etc - and deploy them to Blaxel.
|
|
104
|
+
|
|
105
|
+
**Prerequisites**:
|
|
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
|
+
```
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
bl create-agent-app myfolder
|
|
120
|
+
cd myfolder
|
|
121
|
+
bl deploy
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Also available:
|
|
125
|
+
- `bl create-mcp-server`
|
|
126
|
+
- `bl create-job`
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## Contributing
|
|
131
|
+
|
|
132
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
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/langgraph",
|
|
3
|
-
"version": "0.2.
|
|
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)",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"langchain": "^0.3.24",
|
|
66
66
|
"zod": "^3.24.3",
|
|
67
67
|
"zod-to-json-schema": "^3.24.5",
|
|
68
|
-
"@blaxel/core": "0.2.
|
|
68
|
+
"@blaxel/core": "0.2.7-preview.7"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@eslint/js": "^9.26.0",
|