@moldea.ai/adapter-langchain 3.0.2 → 3.0.3
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 +3 -1
- package/docs/binding-example.md +155 -0
- package/docs/index.md +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ const core = createCore({ adapters: [langChainAdapter] });
|
|
|
19
19
|
|
|
20
20
|
## Verified target
|
|
21
21
|
|
|
22
|
-
Version `3.0.
|
|
22
|
+
Version `3.0.3` supports Repository Format `1`, `@moldea.ai/core ^4.0.0`, and declared ranges that intersect `langchain >=1.5.9` with companion `@langchain/core >=1.2.8`. Those minimum versions are verified. Later stable releases are eligible for deterministic inspection on a best-effort basis and must still match the documented source patterns. Qualification evidence records the exact package versions and date used for each execution. The target recognizes:
|
|
23
23
|
|
|
24
24
|
- directly exported package-root `createAgent(...)` definitions
|
|
25
25
|
- direct instruction-loader calls and `SystemMessage` construction
|
|
@@ -35,6 +35,8 @@ The package exports only `langChainAdapter`. It has no default export, configura
|
|
|
35
35
|
|
|
36
36
|
## Documentation
|
|
37
37
|
|
|
38
|
+
- [Complete binding example](docs/binding-example.md): manifest, canonical instructions, runtime source, and supported schema or routing relationships.
|
|
39
|
+
|
|
38
40
|
These guides are included in the installed package. Open only the page relevant to your task.
|
|
39
41
|
|
|
40
42
|
- [Package overview](docs/index.md)
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Binding example
|
|
3
|
+
description: Complete manifest and source files for inspecting langchain bindings locally.
|
|
4
|
+
order: 5
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Binding example
|
|
8
|
+
|
|
9
|
+
Read this example before searching adapter implementation for binding syntax. It is a complete **static inspection** file set, not a deployment starter or a live provider test. The files are checked together through this adapter and Core without installing or executing the target SDK. Keep application setup, credentials, provider model access, tool execution, and deployment configuration separate.
|
|
10
|
+
|
|
11
|
+
## How the bindings connect
|
|
12
|
+
|
|
13
|
+
Bind the exported `createAgent` result. `systemPrompt` calls the canonical loader, `responseFormat` uses the bound agent output schema, and each tool has a distinct implementation, registration, and input schema. The example uses no middleware: unknown middleware can leave relationships unresolved. This target does not establish handoff, agent input-schema, or tool output-schema evidence.
|
|
14
|
+
|
|
15
|
+
Paths below are repository-root-relative logical paths. Keep the canonical instructions as the policy source. General manifest semantics belong to the [Repository Format specification](https://packages.moldea.ai/repository-format/). Use the other local guides for the full supported boundary and limitations; this example does not expand them.
|
|
16
|
+
|
|
17
|
+
## Files
|
|
18
|
+
|
|
19
|
+
<!-- example:start -->
|
|
20
|
+
|
|
21
|
+
### /moldea/moldea.yaml
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
version: 1
|
|
25
|
+
agents:
|
|
26
|
+
support:
|
|
27
|
+
runtime:
|
|
28
|
+
id: 'langchain'
|
|
29
|
+
bindings:
|
|
30
|
+
runtimeAgent:
|
|
31
|
+
path: '/src/agent.ts'
|
|
32
|
+
symbol: 'supportAgent'
|
|
33
|
+
instructionLoader:
|
|
34
|
+
path: '/src/instructions.ts'
|
|
35
|
+
symbol: 'loadSupportInstruction'
|
|
36
|
+
outputSchema:
|
|
37
|
+
path: '/src/contracts.ts'
|
|
38
|
+
symbol: 'SupportOutputSchema'
|
|
39
|
+
tools:
|
|
40
|
+
find-order:
|
|
41
|
+
name: 'find_order'
|
|
42
|
+
description: 'Finds an order.'
|
|
43
|
+
implementation:
|
|
44
|
+
path: '/src/implementations.ts'
|
|
45
|
+
symbol: 'findOrder'
|
|
46
|
+
registration:
|
|
47
|
+
path: '/src/tools.ts'
|
|
48
|
+
symbol: 'findOrderTool'
|
|
49
|
+
inputSchema:
|
|
50
|
+
path: '/src/contracts.ts'
|
|
51
|
+
symbol: 'FindOrderInputSchema'
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### /package.json
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@langchain/core": "~1.2.8",
|
|
60
|
+
"langchain": "~1.5.9",
|
|
61
|
+
"zod": "4.6.4"
|
|
62
|
+
},
|
|
63
|
+
"name": "binding-example",
|
|
64
|
+
"private": true,
|
|
65
|
+
"type": "module"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### /moldea/project.md
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
72
|
+
# Fixture project
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### /moldea/agents/support/description.md
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
Supports customers.
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### /moldea/agents/support/instruction.md
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
You are the `support` agent.
|
|
85
|
+
|
|
86
|
+
Answer from supplied support facts. Do not invent order status or account information.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### /src/contracts.ts
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { z } from 'zod';
|
|
93
|
+
|
|
94
|
+
// response and tool contracts
|
|
95
|
+
export const SupportOutputSchema = z.object({ summary: z.string() });
|
|
96
|
+
export const FindOrderInputSchema = z.object({ orderId: z.string() });
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### /src/instructions.ts
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { readFileSync } from 'node:fs';
|
|
103
|
+
|
|
104
|
+
/** Reads the canonical support instruction. */
|
|
105
|
+
export const loadSupportInstruction = (): string =>
|
|
106
|
+
readFileSync(new URL('../moldea/agents/support/instruction.md', import.meta.url), 'utf8');
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### /src/implementations.ts
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
/** Looks up an order in the example's fixed catalog. */
|
|
113
|
+
export const findOrder = async ({ orderId }: { orderId: string }) => ({
|
|
114
|
+
orderId,
|
|
115
|
+
status: orderId === 'order-1042' ? ('shipped' as const) : ('not_found' as const),
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### /src/tools.ts
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { tool } from '@langchain/core/tools';
|
|
123
|
+
import { FindOrderInputSchema } from './contracts.js';
|
|
124
|
+
import { findOrder } from './implementations.js';
|
|
125
|
+
export const findOrderTool = tool(findOrder, {
|
|
126
|
+
name: 'find_order',
|
|
127
|
+
description: 'Finds an order.',
|
|
128
|
+
schema: FindOrderInputSchema,
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### /src/agent.ts
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { createAgent, providerStrategy, SystemMessage } from 'langchain';
|
|
136
|
+
import { SupportOutputSchema } from './contracts.js';
|
|
137
|
+
import { loadSupportInstruction } from './instructions.js';
|
|
138
|
+
import { findOrderTool } from './tools.js';
|
|
139
|
+
const MIDDLEWARE = [];
|
|
140
|
+
const TOOLS = [findOrderTool];
|
|
141
|
+
export const supportAgent = createAgent({
|
|
142
|
+
model: 'openai:gpt-4o',
|
|
143
|
+
name: 'support-runtime',
|
|
144
|
+
systemPrompt: new SystemMessage(loadSupportInstruction()),
|
|
145
|
+
responseFormat: providerStrategy({ schema: SupportOutputSchema, strict: true }),
|
|
146
|
+
middleware: MIDDLEWARE,
|
|
147
|
+
tools: TOOLS,
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
<!-- example:end -->
|
|
152
|
+
|
|
153
|
+
## What the check establishes
|
|
154
|
+
|
|
155
|
+
The integration check reads these exact file blocks, requires positive adapter evidence for the documented relationships, and rejects a broken runtime binding. It does not prove that instructions are followed, that every SDK version accepts these forms, or that the application is ready for production. Continue using the installed adapter diagnostics for your actual source.
|
package/docs/index.md
CHANGED
|
@@ -11,3 +11,5 @@ order: 1
|
|
|
11
11
|
The adapter begins at each declared runtime-agent path, finds its nearest owning package, checks the primary and companion declarations together, and returns immutable evidence and stable diagnostics through Core. It does not execute the application or treat package presence as proof of an agent definition.
|
|
12
12
|
|
|
13
13
|
The package exports only `langChainAdapter`. The generated API reference derives that surface from the package export.
|
|
14
|
+
|
|
15
|
+
Start with the [complete binding example](https://packages.moldea.ai/adapters/langchain/binding-example/) when connecting runtime source to canonical instructions, schemas, tools, or routing metadata. The same example ships locally as `docs/binding-example.md` in the installed package.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moldea.ai/adapter-langchain",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Deterministic runtime evidence and diagnostics for LangChain TypeScript agents.",
|
|
5
5
|
"homepage": "https://github.com/moldea-ai/packages/tree/main/projects/adapter-langchain#readme",
|
|
6
6
|
"bugs": {
|