@moldea.ai/adapter-openai-agents-sdk 3.0.1 → 3.0.2
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 +218 -0
- package/docs/index.md +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ The package implements the official `openai-agents-sdk` runtime adapter for `@mo
|
|
|
8
8
|
|
|
9
9
|
## Supported target
|
|
10
10
|
|
|
11
|
-
Version `3.0.
|
|
11
|
+
Version `3.0.2` supports:
|
|
12
12
|
|
|
13
13
|
- Repository Format version `1`
|
|
14
14
|
- `@moldea.ai/core ^4.0.0`
|
|
@@ -91,6 +91,8 @@ Unit and integration tests are colocated with their implementation modules. Adap
|
|
|
91
91
|
|
|
92
92
|
## Documentation
|
|
93
93
|
|
|
94
|
+
- [Complete binding example](docs/binding-example.md): manifest, canonical instructions, runtime source, and supported schema or routing relationships.
|
|
95
|
+
|
|
94
96
|
These guides are included in the installed package. Open only the page relevant to your task.
|
|
95
97
|
|
|
96
98
|
- [Package overview](docs/index.md)
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Binding example
|
|
3
|
+
description: Complete manifest and source files for inspecting openai-agents-sdk 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 each exported `Agent` instance. `instructions` calls its canonical loader and `outputType` names the agent output schema. Tool implementation, registration, input, and output are separate bindings. A handoff links the registered target agent; its static routing description must match that target's `handoff-description.md`. Do not put a handoff into the manifest's ordinary `tools` map.
|
|
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
|
+
billing:
|
|
27
|
+
runtime:
|
|
28
|
+
id: 'openai-agents-sdk'
|
|
29
|
+
bindings:
|
|
30
|
+
runtimeAgent:
|
|
31
|
+
path: '/src/agents.ts'
|
|
32
|
+
symbol: 'billingAgent'
|
|
33
|
+
instructionLoader:
|
|
34
|
+
path: '/src/instructions.ts'
|
|
35
|
+
symbol: 'loadBillingInstruction'
|
|
36
|
+
triage:
|
|
37
|
+
runtime:
|
|
38
|
+
id: 'openai-agents-sdk'
|
|
39
|
+
bindings:
|
|
40
|
+
runtimeAgent:
|
|
41
|
+
path: '/src/agents.ts'
|
|
42
|
+
symbol: 'triageAgent'
|
|
43
|
+
instructionLoader:
|
|
44
|
+
path: '/src/instructions.ts'
|
|
45
|
+
symbol: 'loadTriageInstruction'
|
|
46
|
+
outputSchema:
|
|
47
|
+
path: '/src/contracts.ts'
|
|
48
|
+
symbol: 'TriageOutputSchema'
|
|
49
|
+
tools:
|
|
50
|
+
find-order:
|
|
51
|
+
name: 'find_order'
|
|
52
|
+
description: 'Retrieves one order by its identifier.'
|
|
53
|
+
implementation:
|
|
54
|
+
path: '/src/find-order.ts'
|
|
55
|
+
symbol: 'findOrder'
|
|
56
|
+
registration:
|
|
57
|
+
path: '/src/tools.ts'
|
|
58
|
+
symbol: 'findOrderTool'
|
|
59
|
+
inputSchema:
|
|
60
|
+
path: '/src/contracts.ts'
|
|
61
|
+
symbol: 'FindOrderInputSchema'
|
|
62
|
+
outputSchema:
|
|
63
|
+
path: '/src/contracts.ts'
|
|
64
|
+
symbol: 'FindOrderOutputSchema'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### /moldea/project.md
|
|
68
|
+
|
|
69
|
+
```markdown
|
|
70
|
+
# OpenAI Agents SDK adapter fixture
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### /moldea/agents/billing/description.md
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
Handles customer billing requests.
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### /moldea/agents/billing/handoff-description.md
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
Route billing questions and payment issues here.
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### /moldea/agents/billing/instruction.md
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
You are the `billing` agent.
|
|
89
|
+
|
|
90
|
+
Resolve billing requests from the supplied facts. Ask when essential details are missing.
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### /moldea/agents/triage/description.md
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
Routes customer support requests.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### /moldea/agents/triage/instruction.md
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
You are the `triage` agent.
|
|
103
|
+
|
|
104
|
+
Route billing requests to billing. Do not invent account facts.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### /package.json
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"dependencies": {
|
|
112
|
+
"@openai/agents": "^0.16.1",
|
|
113
|
+
"zod": "4.6.4"
|
|
114
|
+
},
|
|
115
|
+
"name": "binding-example",
|
|
116
|
+
"private": true,
|
|
117
|
+
"type": "module"
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### /src/agents.ts
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import { Agent, handoff } from '@openai/agents';
|
|
125
|
+
|
|
126
|
+
import { TriageOutputSchema } from './contracts.js';
|
|
127
|
+
import { loadTriageInstruction, loadBillingInstruction } from './instructions.js';
|
|
128
|
+
import { billingRoutingDescription } from './metadata.js';
|
|
129
|
+
import { findOrderTool } from './tools.js';
|
|
130
|
+
|
|
131
|
+
export const billingAgent = new Agent({
|
|
132
|
+
name: 'billing',
|
|
133
|
+
instructions: loadBillingInstruction(),
|
|
134
|
+
handoffDescription: billingRoutingDescription,
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
const configuredBillingHandoff = handoff(billingAgent, {
|
|
138
|
+
toolNameOverride: 'route_billing',
|
|
139
|
+
toolDescriptionOverride: billingRoutingDescription,
|
|
140
|
+
});
|
|
141
|
+
const triageTools = [findOrderTool];
|
|
142
|
+
const triageHandoffs = [billingAgent, configuredBillingHandoff];
|
|
143
|
+
|
|
144
|
+
export const triageAgent = Agent.create({
|
|
145
|
+
name: 'triage',
|
|
146
|
+
instructions: loadTriageInstruction(),
|
|
147
|
+
outputType: TriageOutputSchema,
|
|
148
|
+
tools: triageTools,
|
|
149
|
+
handoffs: triageHandoffs,
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### /src/contracts.ts
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { z } from 'zod';
|
|
157
|
+
|
|
158
|
+
// response and tool contracts
|
|
159
|
+
export const TriageOutputSchema = z.object({ summary: z.string() });
|
|
160
|
+
export const FindOrderInputSchema = z.object({ orderId: z.string() });
|
|
161
|
+
export const FindOrderOutputSchema = z.object({
|
|
162
|
+
orderId: z.string(),
|
|
163
|
+
status: z.enum(['shipped', 'not_found']),
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### /src/find-order.ts
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
/** Looks up an order in the example's fixed catalog. */
|
|
171
|
+
export const findOrder = async ({ orderId }: { orderId: string }) => ({
|
|
172
|
+
orderId,
|
|
173
|
+
status: orderId === 'order-1042' ? ('shipped' as const) : ('not_found' as const),
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### /src/instructions.ts
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
import { readFileSync } from 'node:fs';
|
|
181
|
+
|
|
182
|
+
/** Reads the canonical triage instruction. */
|
|
183
|
+
export const loadTriageInstruction = (): string =>
|
|
184
|
+
readFileSync(new URL('../moldea/agents/triage/instruction.md', import.meta.url), 'utf8');
|
|
185
|
+
|
|
186
|
+
/** Reads the canonical billing instruction. */
|
|
187
|
+
export const loadBillingInstruction = (): string =>
|
|
188
|
+
readFileSync(new URL('../moldea/agents/billing/instruction.md', import.meta.url), 'utf8');
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### /src/metadata.ts
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
export const billingRoutingDescription = 'Route billing questions and payment issues here.';
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### /src/tools.ts
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { tool } from '@openai/agents';
|
|
201
|
+
|
|
202
|
+
import { FindOrderInputSchema, FindOrderOutputSchema } from './contracts.js';
|
|
203
|
+
import { findOrder } from './find-order.js';
|
|
204
|
+
|
|
205
|
+
export const findOrderTool = tool({
|
|
206
|
+
name: 'find_order',
|
|
207
|
+
description: 'Retrieves one order by its identifier.',
|
|
208
|
+
parameters: FindOrderInputSchema,
|
|
209
|
+
outputSchema: FindOrderOutputSchema,
|
|
210
|
+
execute: findOrder,
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
<!-- example:end -->
|
|
215
|
+
|
|
216
|
+
## What the check establishes
|
|
217
|
+
|
|
218
|
+
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
|
@@ -27,3 +27,5 @@ The adapter never imports or calls the SDK, requires no API key, executes no rep
|
|
|
27
27
|
## Public surface
|
|
28
28
|
|
|
29
29
|
The package exports only `openAiAgentsSdkAdapter`. It has no default export, configuration factory, SDK facade, parser export, public diagnostic registry, or mutable runtime state. The generated [API reference](https://packages.moldea.ai/adapters/openai-agents-sdk/api/) derives that surface from the package export.
|
|
30
|
+
|
|
31
|
+
Start with the [complete binding example](https://packages.moldea.ai/adapters/openai-agents-sdk/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-openai-agents-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Deterministic runtime evidence and diagnostics for direct OpenAI Agents SDK integrations.",
|
|
5
5
|
"homepage": "https://github.com/moldea-ai/packages/tree/main/projects/adapter-openai-agents-sdk#readme",
|
|
6
6
|
"bugs": {
|