Skip to content

Commit ccf6a53

Browse files
committed
fix readme
1 parent e7bb0d4 commit ccf6a53

File tree

1 file changed

+17
-33
lines changed

1 file changed

+17
-33
lines changed
Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,30 @@
1-
# @ag-ui/mastra
1+
# @ag-ui/langchain
22

3-
Implementation of the AG-UI protocol for Mastra.
4-
5-
Connects Mastra agents (local and remote) to frontend applications via the AG-UI protocol. Supports streaming responses, memory management, and tool execution.
3+
Implementation of the AG-UI protocol for LangChain.
64

75
## Installation
86

97
```bash
10-
npm install @ag-ui/mastra
11-
pnpm add @ag-ui/mastra
12-
yarn add @ag-ui/mastra
8+
npm install @ag-ui/langchain
9+
pnpm add @ag-ui/langchain
10+
yarn add @ag-ui/langchain
1311
```
1412

1513
## Usage
1614

1715
```ts
18-
import { MastraAgent } from "@ag-ui/mastra";
19-
import { mastra } from "./mastra"; // Your Mastra instance
16+
import { LangChainAgent } from "@ag-ui/langchain";
2017

2118
// Create an AG-UI compatible agent
22-
const agent = new MastraAgent({
23-
agent: mastra.getAgent("weather-agent"),
24-
resourceId: "user-123",
25-
});
26-
27-
// Run with streaming
28-
const result = await agent.runAgent({
29-
messages: [{ role: "user", content: "What's the weather like?" }],
30-
});
31-
```
32-
33-
## Features
34-
35-
- **Local & remote agents** – Works with in-process and network Mastra agents
36-
- **Memory integration** – Automatic thread and working memory management
37-
- **Tool streaming** – Real-time tool call execution and results
38-
- **State management** – Bidirectional state synchronization
39-
40-
## To run the example server in the dojo
41-
42-
```bash
43-
cd integrations/mastra/typescript/examples
44-
pnpm install
45-
pnpm run dev
19+
const agent = new LangChainAgent({
20+
chainFn: async ({ messages, tools, threadId }) => {
21+
// Your chosen llm model
22+
const { ChatOpenAI } = await import("@langchain/openai");
23+
const chatOpenAI = new ChatOpenAI({ model: "gpt-4o" });
24+
const model = chatOpenAI.bindTools(tools, {
25+
strict: true,
26+
});
27+
return model.stream(messages, { tools, metadata: { conversation_id: threadId } });
28+
},
29+
})
4630
```

0 commit comments

Comments
 (0)