@artinet/cruiser 0.1.1 → 0.1.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 +32 -32
- package/dist/claude/index.d.ts +24 -16
- package/dist/claude/index.js +18 -14
- package/dist/corsair.d.ts +52 -10
- package/dist/corsair.js +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/langchain/index.d.ts +16 -12
- package/dist/langchain/index.js +18 -13
- package/dist/langchain/utils.js +1 -1
- package/dist/mastra/index.d.ts +16 -12
- package/dist/mastra/index.js +16 -12
- package/dist/openai/index.d.ts +23 -15
- package/dist/openai/index.js +17 -13
- package/dist/strands/index.d.ts +16 -12
- package/dist/strands/index.js +16 -12
- package/dist/volt/index.d.ts +1 -1
- package/dist/volt/index.js +1 -1
- package/package.json +3 -3
package/dist/langchain/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @artinet/cruiser/langchain
|
|
5
5
|
* @description
|
|
6
|
-
* This adapter "
|
|
6
|
+
* This adapter "docks" LangChain agents ({@link ReactAgent} and compatible types) onto
|
|
7
7
|
* artinet, enabling them to participate in multi-agent workflows.
|
|
8
8
|
*
|
|
9
9
|
* ## Design Decisions
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* ```typescript
|
|
26
26
|
* import { createAgent } from "langchain";
|
|
27
|
-
* import {
|
|
27
|
+
* import { dock } from "@artinet/cruiser/langchain";
|
|
28
28
|
* import { serve } from "@artinet/sdk";
|
|
29
29
|
*
|
|
30
30
|
* const langchainAgent = await createAgent({
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* tools: [searchTool, calculatorTool],
|
|
33
33
|
* });
|
|
34
34
|
*
|
|
35
|
-
* const artinetAgent = await
|
|
35
|
+
* const artinetAgent = await dock(langchainAgent, { name: "Research Assistant" });
|
|
36
36
|
* serve({ agent: artinetAgent, port: 3000 });
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
import * as sdk from "@artinet/sdk";
|
|
42
42
|
import { getAgentCard, convertToLangChainMessage, extractA2AMessage, } from "./utils.js";
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Docks a LangChain agent onto artinet.
|
|
45
45
|
*
|
|
46
46
|
* Transforms a {@link ReactAgent} (or compatible agent type) into an
|
|
47
47
|
* {@link sdk.Agent | artinet-compatible agent} that can be deployed on artinet.
|
|
48
48
|
*
|
|
49
|
-
* @param agent - The {@link ReactAgent} to
|
|
49
|
+
* @param agent - The {@link ReactAgent} to dock
|
|
50
50
|
* @param card - Optional {@link sdk.A2A.AgentCardParams} configuration to customize identity and capabilities
|
|
51
51
|
* @param options - Optional {@link RunnableConfig} for execution options
|
|
52
52
|
*
|
|
@@ -54,18 +54,18 @@ import { getAgentCard, convertToLangChainMessage, extractA2AMessage, } from "./u
|
|
|
54
54
|
*
|
|
55
55
|
* @example Basic Usage
|
|
56
56
|
* ```typescript
|
|
57
|
-
* import {
|
|
57
|
+
* import { dock } from "@artinet/cruiser/langchain";
|
|
58
58
|
* import { createAgent } from "langchain";
|
|
59
59
|
*
|
|
60
60
|
* const agent = await createAgent({ model, tools });
|
|
61
|
-
* const artinetAgent = await
|
|
61
|
+
* const artinetAgent = await dock(agent, { name: "My Agent" });
|
|
62
62
|
* ```
|
|
63
63
|
*
|
|
64
64
|
* @example With Runnable Configuration
|
|
65
65
|
* ```typescript
|
|
66
|
-
* import {
|
|
66
|
+
* import { dock } from "@artinet/cruiser/langchain";
|
|
67
67
|
*
|
|
68
|
-
* const artinetAgent = await
|
|
68
|
+
* const artinetAgent = await dock(
|
|
69
69
|
* myAgent,
|
|
70
70
|
* { name: "Configured Agent" },
|
|
71
71
|
* {
|
|
@@ -78,9 +78,9 @@ import { getAgentCard, convertToLangChainMessage, extractA2AMessage, } from "./u
|
|
|
78
78
|
*
|
|
79
79
|
* @example With Custom Agent Card
|
|
80
80
|
* ```typescript
|
|
81
|
-
* import {
|
|
81
|
+
* import { dock } from "@artinet/cruiser/langchain";
|
|
82
82
|
*
|
|
83
|
-
* const artinetAgent = await
|
|
83
|
+
* const artinetAgent = await dock(myAgent, {
|
|
84
84
|
* name: "Research Bot",
|
|
85
85
|
* description: "AI-powered research assistant",
|
|
86
86
|
* skills: [
|
|
@@ -90,7 +90,7 @@ import { getAgentCard, convertToLangChainMessage, extractA2AMessage, } from "./u
|
|
|
90
90
|
* });
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
export const
|
|
93
|
+
export const dock = async (agent, card, options) => {
|
|
94
94
|
const agentCard = await getAgentCard({
|
|
95
95
|
agent,
|
|
96
96
|
card,
|
|
@@ -109,11 +109,16 @@ export const park = async (agent, card, options) => {
|
|
|
109
109
|
...result,
|
|
110
110
|
},
|
|
111
111
|
};
|
|
112
|
-
|
|
112
|
+
const completedUpdate = sdk.describe.update.completed({
|
|
113
113
|
taskId: task.id,
|
|
114
114
|
contextId: task.contextId,
|
|
115
115
|
message: responseMessage,
|
|
116
116
|
metadata,
|
|
117
117
|
});
|
|
118
|
+
yield completedUpdate;
|
|
118
119
|
});
|
|
119
120
|
};
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated Use {@link dock} instead.
|
|
123
|
+
*/
|
|
124
|
+
export const park = dock;
|
package/dist/langchain/utils.js
CHANGED
|
@@ -180,7 +180,7 @@ export function extractA2AMessage(taskId, contextId, result, _agent) {
|
|
|
180
180
|
if (typeof message.content === "string") {
|
|
181
181
|
parts.push(sdk.describe.part.text(message.content));
|
|
182
182
|
}
|
|
183
|
-
else {
|
|
183
|
+
else if (message.type === "ai") {
|
|
184
184
|
/**Pop the last block which belongs to the assistant */
|
|
185
185
|
const block = message.content.pop();
|
|
186
186
|
if (block && block.type === "text") {
|
package/dist/mastra/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @artinet/cruiser/mastra
|
|
5
5
|
* @description
|
|
6
|
-
* This adapter "
|
|
6
|
+
* This adapter "docks" {@link MastraAgent | Mastra agents} onto artinet,
|
|
7
7
|
* enabling them to participate in multi-agent workflows. Mastra is a TypeScript-first
|
|
8
8
|
* AI framework with built-in memory, workflows, and tool support.
|
|
9
9
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
* ```typescript
|
|
27
27
|
* import { Agent } from "@mastra/core/agent";
|
|
28
|
-
* import {
|
|
28
|
+
* import { dock } from "@artinet/cruiser/mastra";
|
|
29
29
|
* import { serve } from "@artinet/sdk";
|
|
30
30
|
*
|
|
31
31
|
* const mastraAgent = new Agent({
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* model: openai("gpt-4"),
|
|
35
35
|
* });
|
|
36
36
|
*
|
|
37
|
-
* const artinetAgent = await
|
|
37
|
+
* const artinetAgent = await dock(mastraAgent, { name: "My Assistant" });
|
|
38
38
|
* serve({ agent: artinetAgent, port: 3000 });
|
|
39
39
|
* ```
|
|
40
40
|
*
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
*/
|
|
43
43
|
import { OutputSchema } from "@mastra/core/stream";
|
|
44
44
|
import { Agent as MastraAgent, AgentExecutionOptions } from "@mastra/core/agent";
|
|
45
|
-
import { Park } from "../corsair.js";
|
|
45
|
+
import { Dock, Park } from "../corsair.js";
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Docks a Mastra agent onto artinet.
|
|
48
48
|
*
|
|
49
49
|
* Transforms a {@link MastraAgent} instance into an {@link sdk.Agent | A2A-compatible agent}
|
|
50
50
|
* that can be deployed on artinet. Preserves Mastra's thread-based memory by
|
|
51
51
|
* mapping context IDs to Mastra thread IDs.
|
|
52
52
|
*
|
|
53
|
-
* @param agent - The {@link MastraAgent} instance to
|
|
53
|
+
* @param agent - The {@link MastraAgent} instance to dock
|
|
54
54
|
* @param card - Optional {@link sdk.A2A.AgentCardParams} configuration to customize identity and capabilities
|
|
55
55
|
* @param options - Optional {@link AgentExecutionOptions} for execution (output schema, format, etc.)
|
|
56
56
|
*
|
|
@@ -58,7 +58,7 @@ import { Park } from "../corsair.js";
|
|
|
58
58
|
*
|
|
59
59
|
* @example Basic Usage
|
|
60
60
|
* ```typescript
|
|
61
|
-
* import {
|
|
61
|
+
* import { dock } from "@artinet/cruiser/mastra";
|
|
62
62
|
* import { Agent } from "@mastra/core/agent";
|
|
63
63
|
*
|
|
64
64
|
* const agent = new Agent({
|
|
@@ -67,12 +67,12 @@ import { Park } from "../corsair.js";
|
|
|
67
67
|
* model: openai("gpt-4"),
|
|
68
68
|
* });
|
|
69
69
|
*
|
|
70
|
-
* const artinetAgent = await
|
|
70
|
+
* const artinetAgent = await dock(agent, { name: "Helper Bot" });
|
|
71
71
|
* ```
|
|
72
72
|
*
|
|
73
73
|
* @example With Structured Output
|
|
74
74
|
* ```typescript
|
|
75
|
-
* import {
|
|
75
|
+
* import { dock } from "@artinet/cruiser/mastra";
|
|
76
76
|
* import { z } from "zod";
|
|
77
77
|
*
|
|
78
78
|
* const responseSchema = z.object({
|
|
@@ -80,7 +80,7 @@ import { Park } from "../corsair.js";
|
|
|
80
80
|
* confidence: z.number(),
|
|
81
81
|
* });
|
|
82
82
|
*
|
|
83
|
-
* const artinetAgent = await
|
|
83
|
+
* const artinetAgent = await dock(
|
|
84
84
|
* myAgent,
|
|
85
85
|
* { name: "Structured Agent" },
|
|
86
86
|
* { output: responseSchema }
|
|
@@ -89,7 +89,7 @@ import { Park } from "../corsair.js";
|
|
|
89
89
|
*
|
|
90
90
|
* @example With Tools
|
|
91
91
|
* ```typescript
|
|
92
|
-
* import {
|
|
92
|
+
* import { dock } from "@artinet/cruiser/mastra";
|
|
93
93
|
*
|
|
94
94
|
* const agentWithTools = new Agent({
|
|
95
95
|
* name: "research-bot",
|
|
@@ -98,10 +98,14 @@ import { Park } from "../corsair.js";
|
|
|
98
98
|
* tools: { webSearch, summarize, saveNote },
|
|
99
99
|
* });
|
|
100
100
|
*
|
|
101
|
-
* const artinetAgent = await
|
|
101
|
+
* const artinetAgent = await dock(agentWithTools, {
|
|
102
102
|
* name: "Research Assistant",
|
|
103
103
|
* description: "AI-powered research helper",
|
|
104
104
|
* });
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
107
|
+
export declare const dock: Dock<MastraAgent, AgentExecutionOptions<OutputSchema | undefined, "aisdk" | "mastra">>;
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated Use {@link dock} instead.
|
|
110
|
+
*/
|
|
107
111
|
export declare const park: Park<MastraAgent, AgentExecutionOptions<OutputSchema | undefined, "aisdk" | "mastra">>;
|
package/dist/mastra/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @artinet/cruiser/mastra
|
|
5
5
|
* @description
|
|
6
|
-
* This adapter "
|
|
6
|
+
* This adapter "docks" {@link MastraAgent | Mastra agents} onto artinet,
|
|
7
7
|
* enabling them to participate in multi-agent workflows. Mastra is a TypeScript-first
|
|
8
8
|
* AI framework with built-in memory, workflows, and tool support.
|
|
9
9
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
* ```typescript
|
|
27
27
|
* import { Agent } from "@mastra/core/agent";
|
|
28
|
-
* import {
|
|
28
|
+
* import { dock } from "@artinet/cruiser/mastra";
|
|
29
29
|
* import { serve } from "@artinet/sdk";
|
|
30
30
|
*
|
|
31
31
|
* const mastraAgent = new Agent({
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* model: openai("gpt-4"),
|
|
35
35
|
* });
|
|
36
36
|
*
|
|
37
|
-
* const artinetAgent = await
|
|
37
|
+
* const artinetAgent = await dock(mastraAgent, { name: "My Assistant" });
|
|
38
38
|
* serve({ agent: artinetAgent, port: 3000 });
|
|
39
39
|
* ```
|
|
40
40
|
*
|
|
@@ -44,13 +44,13 @@ import * as sdk from "@artinet/sdk";
|
|
|
44
44
|
import { getAgentCard, convertToCoreMessage } from "./utils.js";
|
|
45
45
|
import { v4 as uuidv4 } from "uuid";
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* Docks a Mastra agent onto artinet.
|
|
48
48
|
*
|
|
49
49
|
* Transforms a {@link MastraAgent} instance into an {@link sdk.Agent | A2A-compatible agent}
|
|
50
50
|
* that can be deployed on artinet. Preserves Mastra's thread-based memory by
|
|
51
51
|
* mapping context IDs to Mastra thread IDs.
|
|
52
52
|
*
|
|
53
|
-
* @param agent - The {@link MastraAgent} instance to
|
|
53
|
+
* @param agent - The {@link MastraAgent} instance to dock
|
|
54
54
|
* @param card - Optional {@link sdk.A2A.AgentCardParams} configuration to customize identity and capabilities
|
|
55
55
|
* @param options - Optional {@link AgentExecutionOptions} for execution (output schema, format, etc.)
|
|
56
56
|
*
|
|
@@ -58,7 +58,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
58
58
|
*
|
|
59
59
|
* @example Basic Usage
|
|
60
60
|
* ```typescript
|
|
61
|
-
* import {
|
|
61
|
+
* import { dock } from "@artinet/cruiser/mastra";
|
|
62
62
|
* import { Agent } from "@mastra/core/agent";
|
|
63
63
|
*
|
|
64
64
|
* const agent = new Agent({
|
|
@@ -67,12 +67,12 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
67
67
|
* model: openai("gpt-4"),
|
|
68
68
|
* });
|
|
69
69
|
*
|
|
70
|
-
* const artinetAgent = await
|
|
70
|
+
* const artinetAgent = await dock(agent, { name: "Helper Bot" });
|
|
71
71
|
* ```
|
|
72
72
|
*
|
|
73
73
|
* @example With Structured Output
|
|
74
74
|
* ```typescript
|
|
75
|
-
* import {
|
|
75
|
+
* import { dock } from "@artinet/cruiser/mastra";
|
|
76
76
|
* import { z } from "zod";
|
|
77
77
|
*
|
|
78
78
|
* const responseSchema = z.object({
|
|
@@ -80,7 +80,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
80
80
|
* confidence: z.number(),
|
|
81
81
|
* });
|
|
82
82
|
*
|
|
83
|
-
* const artinetAgent = await
|
|
83
|
+
* const artinetAgent = await dock(
|
|
84
84
|
* myAgent,
|
|
85
85
|
* { name: "Structured Agent" },
|
|
86
86
|
* { output: responseSchema }
|
|
@@ -89,7 +89,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
89
89
|
*
|
|
90
90
|
* @example With Tools
|
|
91
91
|
* ```typescript
|
|
92
|
-
* import {
|
|
92
|
+
* import { dock } from "@artinet/cruiser/mastra";
|
|
93
93
|
*
|
|
94
94
|
* const agentWithTools = new Agent({
|
|
95
95
|
* name: "research-bot",
|
|
@@ -98,13 +98,13 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
98
98
|
* tools: { webSearch, summarize, saveNote },
|
|
99
99
|
* });
|
|
100
100
|
*
|
|
101
|
-
* const artinetAgent = await
|
|
101
|
+
* const artinetAgent = await dock(agentWithTools, {
|
|
102
102
|
* name: "Research Assistant",
|
|
103
103
|
* description: "AI-powered research helper",
|
|
104
104
|
* });
|
|
105
105
|
* ```
|
|
106
106
|
*/
|
|
107
|
-
export const
|
|
107
|
+
export const dock = async (agent, card, options) => {
|
|
108
108
|
/**No need to segregate tasks between agents */
|
|
109
109
|
const agentCard = await getAgentCard({ agent, card, options });
|
|
110
110
|
sdk.logger.debug(`Mastra[${agent.id}]:[card:${JSON.stringify(agentCard)}]`);
|
|
@@ -143,3 +143,7 @@ export const park = async (agent, card, options) => {
|
|
|
143
143
|
yield completedUpdate;
|
|
144
144
|
});
|
|
145
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* @deprecated Use {@link dock} instead.
|
|
148
|
+
*/
|
|
149
|
+
export const park = dock;
|
package/dist/openai/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @artinet/cruiser/openai
|
|
5
5
|
* @description
|
|
6
|
-
* This adapter "
|
|
6
|
+
* This adapter "docks" {@link OpenAIAgent | OpenAI Agents} (from `@openai/agents`) into the
|
|
7
7
|
* artinet, enabling them to participate in multi-agent workflows.
|
|
8
8
|
*
|
|
9
9
|
* ## Design Decisions
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* ```typescript
|
|
26
26
|
* import { Agent } from "@openai/agents";
|
|
27
|
-
* import {
|
|
27
|
+
* import { dock } from "@artinet/cruiser/openai";
|
|
28
28
|
* import { serve } from "@artinet/sdk";
|
|
29
29
|
*
|
|
30
30
|
* const openaiAgent = new Agent({
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
* instructions: "You are a helpful assistant",
|
|
33
33
|
* });
|
|
34
34
|
*
|
|
35
|
-
* const artinetAgent = await
|
|
35
|
+
* const artinetAgent = await dock(openaiAgent, { name: "My Assistant" });
|
|
36
36
|
* serve({ agent: artinetAgent, port: 3000 });
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
39
39
|
* @see {@link https://platform.openai.com/docs/agents} OpenAI Agents Documentation
|
|
40
40
|
*/
|
|
41
41
|
import { Agent as OpenAIAgent, NonStreamRunOptions } from "@openai/agents";
|
|
42
|
-
import { Park } from "../corsair.js";
|
|
42
|
+
import { Dock, Park } from "../corsair.js";
|
|
43
43
|
/**
|
|
44
44
|
* Configuration options for OpenAI agent execution.
|
|
45
45
|
*
|
|
@@ -48,22 +48,26 @@ import { Park } from "../corsair.js";
|
|
|
48
48
|
*
|
|
49
49
|
* @see {@link NonStreamRunOptions} from `@openai/agents`
|
|
50
50
|
*/
|
|
51
|
-
export type
|
|
51
|
+
export type OpenAIDockOptions = NonStreamRunOptions<unknown>;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* @deprecated Use {@link OpenAIDockOptions} instead.
|
|
54
|
+
*/
|
|
55
|
+
export type OpenAIParkOptions = OpenAIDockOptions;
|
|
56
|
+
/**
|
|
57
|
+
* Docks an {@link OpenAIAgent} onto artinet.
|
|
54
58
|
*
|
|
55
59
|
* Transforms an OpenAI Agent instance into an {@link sdk.Agent | A2A-compatible agent}
|
|
56
60
|
* that can be deployed on artinet and communicate with other A2A agents.
|
|
57
61
|
*
|
|
58
|
-
* @param agent - The {@link OpenAIAgent} to
|
|
62
|
+
* @param agent - The {@link OpenAIAgent} to dock
|
|
59
63
|
* @param card - Optional {@link sdk.A2A.AgentCardParams} configuration to customize identity and capabilities
|
|
60
|
-
* @param options - Optional {@link
|
|
64
|
+
* @param options - Optional {@link OpenAIDockOptions} (maxTurns, signal, hooks, etc.)
|
|
61
65
|
*
|
|
62
66
|
* @returns A Promise resolving to an {@link sdk.Agent} ready for deployment
|
|
63
67
|
*
|
|
64
68
|
* @example Basic Usage
|
|
65
69
|
* ```typescript
|
|
66
|
-
* import {
|
|
70
|
+
* import { dock } from "@artinet/cruiser/openai";
|
|
67
71
|
* import { Agent } from "@openai/agents";
|
|
68
72
|
*
|
|
69
73
|
* const agent = new Agent({
|
|
@@ -71,12 +75,12 @@ export type OpenAIParkOptions = NonStreamRunOptions<unknown>;
|
|
|
71
75
|
* instructions: "You are a helpful assistant",
|
|
72
76
|
* });
|
|
73
77
|
*
|
|
74
|
-
* const artinetAgent = await
|
|
78
|
+
* const artinetAgent = await dock(agent, { name: "Helper Bot" });
|
|
75
79
|
* ```
|
|
76
80
|
*
|
|
77
81
|
* @example With Tools
|
|
78
82
|
* ```typescript
|
|
79
|
-
* import {
|
|
83
|
+
* import { dock } from "@artinet/cruiser/openai";
|
|
80
84
|
* import { Agent, tool } from "@openai/agents";
|
|
81
85
|
* import { z } from "zod";
|
|
82
86
|
*
|
|
@@ -93,12 +97,12 @@ export type OpenAIParkOptions = NonStreamRunOptions<unknown>;
|
|
|
93
97
|
* tools: [searchTool],
|
|
94
98
|
* });
|
|
95
99
|
*
|
|
96
|
-
* const artinetAgent = await
|
|
100
|
+
* const artinetAgent = await dock(agent, { name: "Research Bot" });
|
|
97
101
|
* ```
|
|
98
102
|
*
|
|
99
103
|
* @example With Execution Options
|
|
100
104
|
* ```typescript
|
|
101
|
-
* import {
|
|
105
|
+
* import { dock } from "@artinet/cruiser/openai";
|
|
102
106
|
* import { Agent } from "@openai/agents";
|
|
103
107
|
*
|
|
104
108
|
* const agent = new Agent({
|
|
@@ -106,7 +110,7 @@ export type OpenAIParkOptions = NonStreamRunOptions<unknown>;
|
|
|
106
110
|
* instructions: "You are a helpful assistant",
|
|
107
111
|
* });
|
|
108
112
|
*
|
|
109
|
-
* const artinetAgent = await
|
|
113
|
+
* const artinetAgent = await dock(
|
|
110
114
|
* agent,
|
|
111
115
|
* { name: "Limited Agent" },
|
|
112
116
|
* {
|
|
@@ -116,4 +120,8 @@ export type OpenAIParkOptions = NonStreamRunOptions<unknown>;
|
|
|
116
120
|
* );
|
|
117
121
|
* ```
|
|
118
122
|
*/
|
|
119
|
-
export declare const
|
|
123
|
+
export declare const dock: Dock<OpenAIAgent, OpenAIDockOptions>;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Use {@link dock} instead.
|
|
126
|
+
*/
|
|
127
|
+
export declare const park: Park<OpenAIAgent, OpenAIDockOptions>;
|
package/dist/openai/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @artinet/cruiser/openai
|
|
5
5
|
* @description
|
|
6
|
-
* This adapter "
|
|
6
|
+
* This adapter "docks" {@link OpenAIAgent | OpenAI Agents} (from `@openai/agents`) into the
|
|
7
7
|
* artinet, enabling them to participate in multi-agent workflows.
|
|
8
8
|
*
|
|
9
9
|
* ## Design Decisions
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*
|
|
25
25
|
* ```typescript
|
|
26
26
|
* import { Agent } from "@openai/agents";
|
|
27
|
-
* import {
|
|
27
|
+
* import { dock } from "@artinet/cruiser/openai";
|
|
28
28
|
* import { serve } from "@artinet/sdk";
|
|
29
29
|
*
|
|
30
30
|
* const openaiAgent = new Agent({
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* instructions: "You are a helpful assistant",
|
|
33
33
|
* });
|
|
34
34
|
*
|
|
35
|
-
* const artinetAgent = await
|
|
35
|
+
* const artinetAgent = await dock(openaiAgent, { name: "My Assistant" });
|
|
36
36
|
* serve({ agent: artinetAgent, port: 3000 });
|
|
37
37
|
* ```
|
|
38
38
|
*
|
|
@@ -42,20 +42,20 @@ import { run, } from "@openai/agents";
|
|
|
42
42
|
import * as sdk from "@artinet/sdk";
|
|
43
43
|
import { getAgentCard, convertToAgentInputItem, extractA2AMessage, } from "./utils.js";
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Docks an {@link OpenAIAgent} onto artinet.
|
|
46
46
|
*
|
|
47
47
|
* Transforms an OpenAI Agent instance into an {@link sdk.Agent | A2A-compatible agent}
|
|
48
48
|
* that can be deployed on artinet and communicate with other A2A agents.
|
|
49
49
|
*
|
|
50
|
-
* @param agent - The {@link OpenAIAgent} to
|
|
50
|
+
* @param agent - The {@link OpenAIAgent} to dock
|
|
51
51
|
* @param card - Optional {@link sdk.A2A.AgentCardParams} configuration to customize identity and capabilities
|
|
52
|
-
* @param options - Optional {@link
|
|
52
|
+
* @param options - Optional {@link OpenAIDockOptions} (maxTurns, signal, hooks, etc.)
|
|
53
53
|
*
|
|
54
54
|
* @returns A Promise resolving to an {@link sdk.Agent} ready for deployment
|
|
55
55
|
*
|
|
56
56
|
* @example Basic Usage
|
|
57
57
|
* ```typescript
|
|
58
|
-
* import {
|
|
58
|
+
* import { dock } from "@artinet/cruiser/openai";
|
|
59
59
|
* import { Agent } from "@openai/agents";
|
|
60
60
|
*
|
|
61
61
|
* const agent = new Agent({
|
|
@@ -63,12 +63,12 @@ import { getAgentCard, convertToAgentInputItem, extractA2AMessage, } from "./uti
|
|
|
63
63
|
* instructions: "You are a helpful assistant",
|
|
64
64
|
* });
|
|
65
65
|
*
|
|
66
|
-
* const artinetAgent = await
|
|
66
|
+
* const artinetAgent = await dock(agent, { name: "Helper Bot" });
|
|
67
67
|
* ```
|
|
68
68
|
*
|
|
69
69
|
* @example With Tools
|
|
70
70
|
* ```typescript
|
|
71
|
-
* import {
|
|
71
|
+
* import { dock } from "@artinet/cruiser/openai";
|
|
72
72
|
* import { Agent, tool } from "@openai/agents";
|
|
73
73
|
* import { z } from "zod";
|
|
74
74
|
*
|
|
@@ -85,12 +85,12 @@ import { getAgentCard, convertToAgentInputItem, extractA2AMessage, } from "./uti
|
|
|
85
85
|
* tools: [searchTool],
|
|
86
86
|
* });
|
|
87
87
|
*
|
|
88
|
-
* const artinetAgent = await
|
|
88
|
+
* const artinetAgent = await dock(agent, { name: "Research Bot" });
|
|
89
89
|
* ```
|
|
90
90
|
*
|
|
91
91
|
* @example With Execution Options
|
|
92
92
|
* ```typescript
|
|
93
|
-
* import {
|
|
93
|
+
* import { dock } from "@artinet/cruiser/openai";
|
|
94
94
|
* import { Agent } from "@openai/agents";
|
|
95
95
|
*
|
|
96
96
|
* const agent = new Agent({
|
|
@@ -98,7 +98,7 @@ import { getAgentCard, convertToAgentInputItem, extractA2AMessage, } from "./uti
|
|
|
98
98
|
* instructions: "You are a helpful assistant",
|
|
99
99
|
* });
|
|
100
100
|
*
|
|
101
|
-
* const artinetAgent = await
|
|
101
|
+
* const artinetAgent = await dock(
|
|
102
102
|
* agent,
|
|
103
103
|
* { name: "Limited Agent" },
|
|
104
104
|
* {
|
|
@@ -108,7 +108,7 @@ import { getAgentCard, convertToAgentInputItem, extractA2AMessage, } from "./uti
|
|
|
108
108
|
* );
|
|
109
109
|
* ```
|
|
110
110
|
*/
|
|
111
|
-
export const
|
|
111
|
+
export const dock = async (agent, card, options) => {
|
|
112
112
|
const agentCard = await getAgentCard({ agent, card });
|
|
113
113
|
sdk.logger.debug(`OpenAI[${agent.name}]:[card:${JSON.stringify(agentCard)}]`);
|
|
114
114
|
return sdk.cr8(agentCard).from(async function* (context) {
|
|
@@ -134,3 +134,7 @@ export const park = async (agent, card, options) => {
|
|
|
134
134
|
yield completedUpdate;
|
|
135
135
|
});
|
|
136
136
|
};
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated Use {@link dock} instead.
|
|
139
|
+
*/
|
|
140
|
+
export const park = dock;
|
package/dist/strands/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module @artinet/cruiser/strands
|
|
5
5
|
* @description
|
|
6
|
-
* This adapter "
|
|
6
|
+
* This adapter "docks" {@link StrandsAgent | Strands Agents} (from `@strands-agents/sdk`) into the
|
|
7
7
|
* artinet, enabling them to participate in multi-agent workflows.
|
|
8
8
|
* Strands is AWS's open-source agent framework with native Bedrock integration.
|
|
9
9
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
* ```typescript
|
|
27
27
|
* import { Agent } from "@strands-agents/sdk";
|
|
28
|
-
* import {
|
|
28
|
+
* import { dock } from "@artinet/cruiser/strands";
|
|
29
29
|
* import { serve } from "@artinet/sdk";
|
|
30
30
|
*
|
|
31
31
|
* const strandsAgent = new Agent({
|
|
@@ -33,28 +33,28 @@
|
|
|
33
33
|
* systemPrompt: "You are a helpful assistant",
|
|
34
34
|
* });
|
|
35
35
|
*
|
|
36
|
-
* const artinetAgent = await
|
|
36
|
+
* const artinetAgent = await dock(strandsAgent, { name: "Strands Bot" });
|
|
37
37
|
* serve({agent: artinetAgent, port: 3000 });
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
40
|
* @see {@link https://strandsagents.com/docs} Strands Agents Documentation
|
|
41
41
|
*/
|
|
42
42
|
import { Agent as StrandsAgent } from "@strands-agents/sdk";
|
|
43
|
-
import { Park } from "../corsair.js";
|
|
43
|
+
import { Dock, Park } from "../corsair.js";
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Docks a {@link StrandsAgent} into artinet.
|
|
46
46
|
*
|
|
47
47
|
* Transforms a Strands Agent instance into an {@link sdk.Agent | A2A-compatible agent}
|
|
48
48
|
* that can be deployed on artinet.
|
|
49
49
|
*
|
|
50
|
-
* @param agent - The {@link StrandsAgent} to
|
|
50
|
+
* @param agent - The {@link StrandsAgent} to dock
|
|
51
51
|
* @param card - Optional {@link sdk.A2A.AgentCardParams} configuration to customize identity and capabilities
|
|
52
52
|
*
|
|
53
53
|
* @returns A Promise resolving to an {@link sdk.Agent} ready for deployment
|
|
54
54
|
*
|
|
55
55
|
* @example Basic Usage
|
|
56
56
|
* ```typescript
|
|
57
|
-
* import {
|
|
57
|
+
* import { dock } from "@artinet/cruiser/strands";
|
|
58
58
|
* import { Agent } from "@strands-agents/sdk";
|
|
59
59
|
*
|
|
60
60
|
* const agent = new Agent({
|
|
@@ -62,12 +62,12 @@ import { Park } from "../corsair.js";
|
|
|
62
62
|
* systemPrompt: "Be helpful and concise",
|
|
63
63
|
* });
|
|
64
64
|
*
|
|
65
|
-
* const artinetAgent = await
|
|
65
|
+
* const artinetAgent = await dock(agent, { name: "Quick Helper" });
|
|
66
66
|
* ```
|
|
67
67
|
*
|
|
68
68
|
* @example With Custom Tools
|
|
69
69
|
* ```typescript
|
|
70
|
-
* import {
|
|
70
|
+
* import { dock } from "@artinet/cruiser/strands";
|
|
71
71
|
* import { Agent, tool } from "@strands-agents/sdk";
|
|
72
72
|
*
|
|
73
73
|
* const agent = new Agent({
|
|
@@ -76,7 +76,7 @@ import { Park } from "../corsair.js";
|
|
|
76
76
|
* tools: [calculatorTool, converterTool],
|
|
77
77
|
* });
|
|
78
78
|
*
|
|
79
|
-
* const artinetAgent = await
|
|
79
|
+
* const artinetAgent = await dock(agent, {
|
|
80
80
|
* name: "Math Helper",
|
|
81
81
|
* description: "Calculator and unit conversion assistant",
|
|
82
82
|
* });
|
|
@@ -84,7 +84,7 @@ import { Park } from "../corsair.js";
|
|
|
84
84
|
*
|
|
85
85
|
* @example With AWS Bedrock Configuration
|
|
86
86
|
* ```typescript
|
|
87
|
-
* import {
|
|
87
|
+
* import { dock } from "@artinet/cruiser/strands";
|
|
88
88
|
* import { Agent } from "@strands-agents/sdk";
|
|
89
89
|
*
|
|
90
90
|
* const agent = new Agent({
|
|
@@ -93,7 +93,11 @@ import { Park } from "../corsair.js";
|
|
|
93
93
|
* region: "us-west-2",
|
|
94
94
|
* });
|
|
95
95
|
*
|
|
96
|
-
* const artinetAgent = await
|
|
96
|
+
* const artinetAgent = await dock(agent, { name: "Enterprise Bot" });
|
|
97
97
|
* ```
|
|
98
98
|
*/
|
|
99
|
+
export declare const dock: Dock<StrandsAgent, never>;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated Use {@link dock} instead.
|
|
102
|
+
*/
|
|
99
103
|
export declare const park: Park<StrandsAgent, never>;
|