@mastra/openai 1.1.1-alpha.0 → 1.1.1-alpha.1

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 CHANGED
@@ -1,24 +1,20 @@
1
1
  # @mastra/openai
2
2
 
3
- `@mastra/openai` connects Mastra to the OpenAI Agents SDK. Use it when you want to register an OpenAI SDK agent with Mastra and call it through Mastra-compatible `generate()` and `stream()` methods.
3
+ `@mastra/openai` connects Mastra to the OpenAI Agents SDK. Use it when you want the OpenAI SDK's native agent loop, handoffs, and tools while exposing the agent through Mastra-compatible `generate()` and `stream()` methods.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @mastra/openai @openai/agents
8
+ npm install @mastra/openai
9
+ npm install @openai/agents
9
10
  ```
10
11
 
11
- ## Overview
12
+ ## Usage
12
13
 
13
- The package exports `OpenAISDKAgent`, a Mastra `Agent` wrapper around the OpenAI Agents SDK run loop.
14
-
15
- `OpenAISDKAgent` keeps the OpenAI SDK run loop in charge. Mastra receives compatible outputs, usage data, and tracing data for the run.
16
-
17
- ## Create an OpenAI SDK agent
18
-
19
- Pass OpenAI Agents SDK configuration through `sdkOptions`. `OpenAISDKAgent` creates the SDK agent on first use.
14
+ Set `OPENAI_API_KEY` before creating the agent.
20
15
 
21
16
  ```typescript
17
+ import { Mastra } from '@mastra/core/mastra';
22
18
  import { OpenAISDKAgent } from '@mastra/openai';
23
19
 
24
20
  export const openaiAgent = new OpenAISDKAgent({
@@ -28,65 +24,23 @@ export const openaiAgent = new OpenAISDKAgent({
28
24
  sdkOptions: {
29
25
  name: 'Repository assistant',
30
26
  instructions: 'Answer clearly and cite the relevant files.',
31
- model: '__GATEWAY_OPENAI_MODEL_BASE__',
27
+ model: 'openai/gpt-5.6-sol',
32
28
  },
33
29
  });
34
- ```
35
-
36
- You can also pass an existing OpenAI SDK agent when your app already creates or owns it.
37
-
38
- ```typescript
39
- import { Agent as OpenAIAgent } from '@openai/agents';
40
- import { OpenAISDKAgent } from '@mastra/openai';
41
-
42
- const sdkAgent = new OpenAIAgent({
43
- name: 'Repository assistant',
44
- instructions: 'Answer clearly and cite the relevant files.',
45
- model: '__GATEWAY_OPENAI_MODEL_BASE__',
46
- });
47
-
48
- export const openaiAgent = new OpenAISDKAgent({
49
- id: 'openai-sdk-agent',
50
- description: 'Use OpenAI Agents SDK through Mastra.',
51
- agent: sdkAgent,
52
- });
53
- ```
54
-
55
- You can register the wrapper anywhere Mastra accepts an `Agent`.
56
-
57
- ```typescript
58
- import { Mastra } from '@mastra/core/mastra';
59
30
 
60
31
  export const mastra = new Mastra({
61
- agents: {
62
- openaiAgent,
63
- },
32
+ agents: { openaiAgent },
64
33
  });
65
34
  ```
66
35
 
67
- ## Run the agent
36
+ ## Documentation
68
37
 
69
- ```typescript
70
- const result = await openaiAgent.generate('Summarize the latest changes in this repository.', {
71
- runId: 'openai-run',
72
- maxSteps: 3,
73
- });
74
-
75
- console.log(result.text);
76
- ```
38
+ - [OpenAI Agents SDK integration](https://mastra.ai/docs/connections/sdk-agents#openai-agents-sdk)
77
39
 
78
- ```typescript
79
- const stream = await openaiAgent.stream('Review this package for test gaps.');
80
-
81
- for await (const chunk of stream.fullStream) {
82
- if (chunk.type === 'text-delta') {
83
- process.stdout.write(chunk.payload.text);
84
- }
85
- }
86
- ```
40
+ ## Changelog
87
41
 
88
- ## Configure OpenAI
42
+ See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/agent-sdks/openai/CHANGELOG.md) for version history and release notes.
89
43
 
90
- `OpenAISDKAgent` forwards `sdkOptions` to the OpenAI SDK `Agent` constructor when `agent` is not provided. These include `name`, `instructions`, `model`, `tools`, `handoffs`, guardrails, and other OpenAI Agents SDK agent settings.
44
+ ## Support
91
45
 
92
- Mastra `generate()` and `stream()` execution options drive the run. `maxSteps` maps to OpenAI `maxTurns`, and `abortSignal` maps to OpenAI `signal`.
46
+ We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
@@ -3,7 +3,7 @@ name: mastra-openai
3
3
  description: Documentation for @mastra/openai. Use when working with @mastra/openai APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/openai"
6
- version: "1.1.1-alpha.0"
6
+ version: "1.1.1-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.1-alpha.0",
2
+ "version": "1.1.1-alpha.1",
3
3
  "package": "@mastra/openai",
4
4
  "exports": {},
5
5
  "modules": {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/openai",
3
- "version": "1.1.1-alpha.0",
3
+ "version": "1.1.1-alpha.1",
4
4
  "description": "OpenAI Agents SDK package for Mastra",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,9 +35,9 @@
35
35
  "typescript": "^7.0.2",
36
36
  "vitest": "4.1.10",
37
37
  "zod": "^4.4.3",
38
- "@internal/lint": "0.0.129",
39
38
  "@internal/types-builder": "0.0.104",
40
- "@mastra/core": "1.64.0-alpha.2"
39
+ "@internal/lint": "0.0.129",
40
+ "@mastra/core": "1.64.0-alpha.7"
41
41
  },
42
42
  "homepage": "https://mastra.ai",
43
43
  "repository": {