experimental-agent 0.3.0 → 0.4.0

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
@@ -23,6 +23,22 @@ import { agent } from "experimental-agent";
23
23
  export const myAgent = agent("my-agent", {
24
24
  model: "anthropic/claude-opus-4.6",
25
25
  system: "You are a helpful coding assistant.",
26
+ skills: [
27
+ { type: "sandbox", path: ".agent/skills/project" },
28
+ { type: "host", path: "./skills/company" },
29
+ {
30
+ type: "git",
31
+ repo: "https://github.com/acme/agent-skills.git",
32
+ ref: "v1.2.0",
33
+ path: "skills",
34
+ },
35
+ {
36
+ type: "inline",
37
+ name: "incident-triage",
38
+ description: "Triage incidents safely",
39
+ instructions: "1. Gather context\n2. Confirm blast radius\n3. Propose mitigations",
40
+ },
41
+ ],
26
42
  });
27
43
  ```
28
44
 
@@ -111,6 +127,50 @@ agent("my-agent", {
111
127
 
112
128
  The SDK stores `Session`, `Message`, `Part`, `Sandbox`. Everything else — users, titles, access control — belongs in your database. Session ID is your join key.
113
129
 
130
+ ## Skills
131
+
132
+ `skills` is the canonical skills API for both `agent(...)` defaults and `session.update(...)` overrides.
133
+
134
+ - `{ type: "sandbox", path: "..." }` reads skills already present in sandbox
135
+ - `{ type: "host", path: "..." }` copies skills from host filesystem into sandbox materialized dirs
136
+ - `{ type: "git", ... }` clones a git repo into sandbox materialized dirs (optionally with `ref`, `path`, `name`)
137
+ - `{ type: "inline", ... }` writes an inline `SKILL.md` into sandbox materialized dirs
138
+
139
+ ```ts
140
+ const session = myAgent.session("chat-123");
141
+
142
+ await session.update({
143
+ skills: [
144
+ {
145
+ type: "git",
146
+ repo: "https://github.com/acme/agent-skills.git",
147
+ ref: "main",
148
+ path: "skills",
149
+ name: "release-playbook",
150
+ },
151
+ ],
152
+ });
153
+ ```
154
+
155
+ ### Migration
156
+
157
+ Legacy `skillsDir` configuration is deprecated. Migrate to `skills`:
158
+
159
+ ```ts
160
+ // before
161
+ agent("my-agent", {
162
+ skillsDir: [".agent/skills", ".agent/skills/shared"],
163
+ });
164
+
165
+ // after
166
+ agent("my-agent", {
167
+ skills: [
168
+ { type: "sandbox", path: ".agent/skills" },
169
+ { type: "sandbox", path: ".agent/skills/shared" },
170
+ ],
171
+ });
172
+ ```
173
+
114
174
  ## Documentation
115
175
 
116
176
  Full docs at [packages/agent/docs](./docs/).
@@ -125,3 +185,4 @@ pnpm test # vitest run
125
185
  pnpm test:watch # vitest watch
126
186
  pnpm typecheck # tsc --noEmit
127
187
  ```
188
+
@@ -2,6 +2,68 @@ import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
2
2
  import { NetworkPolicy } from '@vercel/sandbox';
3
3
  import { UIMessage } from 'ai';
4
4
 
5
+ type SkillSourceType = "sandbox" | "host" | "git" | "inline";
6
+ type SandboxSkillInput = {
7
+ type: "sandbox";
8
+ path: string;
9
+ };
10
+ type HostSkillInput = {
11
+ type: "host";
12
+ path: string;
13
+ };
14
+ type GitSkillInput = {
15
+ type: "git";
16
+ repo: string;
17
+ ref?: string;
18
+ path?: string;
19
+ /**
20
+ * Skill directory name under `path`.
21
+ */
22
+ name?: string;
23
+ };
24
+ type InlineSkillInput = {
25
+ type: "inline";
26
+ name: string;
27
+ description: string;
28
+ instructions: string;
29
+ };
30
+ type SkillInput = SandboxSkillInput | HostSkillInput | GitSkillInput | InlineSkillInput;
31
+ type SandboxSkillEntry = {
32
+ type: "sandbox";
33
+ path: string;
34
+ };
35
+ type HostSkillEntry = {
36
+ type: "host";
37
+ path: string;
38
+ };
39
+ type GitSkillEntry = {
40
+ type: "git";
41
+ repo: string;
42
+ ref?: string;
43
+ path?: string;
44
+ /**
45
+ * Skill directory name under `path`.
46
+ */
47
+ name?: string;
48
+ };
49
+ type InlineSkillEntry = {
50
+ type: "inline";
51
+ name: string;
52
+ description: string;
53
+ instructions: string;
54
+ };
55
+ type SkillEntry = SandboxSkillEntry | HostSkillEntry | GitSkillEntry | InlineSkillEntry;
56
+
57
+ type GenerationOptions = {
58
+ maxSteps?: number;
59
+ temperature?: number;
60
+ topK?: number;
61
+ topP?: number;
62
+ frequencyPenalty?: number;
63
+ presencePenalty?: number;
64
+ maxOutputTokens?: number;
65
+ headers?: Record<string, string>;
66
+ };
5
67
  type Session = {
6
68
  id: string;
7
69
  createdAt: number;
@@ -11,17 +73,30 @@ type Session = {
11
73
  sandboxId: string | null;
12
74
  lastMessageId: string | null;
13
75
  activeTools: string[] | null;
14
- skillsDir: string[] | null;
15
- generation: {
16
- maxSteps?: number;
17
- temperature?: number;
18
- topK?: number;
19
- topP?: number;
20
- frequencyPenalty?: number;
21
- presencePenalty?: number;
22
- maxOutputTokens?: number;
23
- headers?: Record<string, string>;
24
- } | null;
76
+ skills: SkillInput[] | null;
77
+ generation: GenerationOptions | null;
78
+ };
79
+ type MessageUsage = {
80
+ steps: {
81
+ stepIndex: number;
82
+ model: string;
83
+ inputTokens: number;
84
+ outputTokens: number;
85
+ totalTokens: number;
86
+ cacheReadTokens: number;
87
+ cacheWriteTokens: number;
88
+ reasoningTokens: number;
89
+ }[];
90
+ summary: {
91
+ model: string;
92
+ inputTokens: number;
93
+ outputTokens: number;
94
+ totalTokens: number;
95
+ cacheReadTokens: number;
96
+ cacheWriteTokens: number;
97
+ reasoningTokens: number;
98
+ stepCount: number;
99
+ };
25
100
  };
26
101
  type Message = {
27
102
  id: string;
@@ -35,29 +110,9 @@ type Message = {
35
110
  index: number;
36
111
  part: unknown;
37
112
  } | null;
38
- usage: {
39
- steps: {
40
- stepIndex: number;
41
- model: string;
42
- inputTokens: number;
43
- outputTokens: number;
44
- totalTokens: number;
45
- cacheReadTokens: number;
46
- cacheWriteTokens: number;
47
- reasoningTokens: number;
48
- }[];
49
- summary: {
50
- model: string;
51
- inputTokens: number;
52
- outputTokens: number;
53
- totalTokens: number;
54
- cacheReadTokens: number;
55
- cacheWriteTokens: number;
56
- reasoningTokens: number;
57
- stepCount: number;
58
- };
59
- } | null;
113
+ usage: MessageUsage | null;
60
114
  workflowRunId?: string | null;
115
+ metadata?: Record<string, unknown> | null;
61
116
  };
62
117
  type Part = {
63
118
  id: string;
@@ -198,4 +253,4 @@ interface Storage {
198
253
  type StorageInput = StorageHandlers | StorageStepFunction;
199
254
  declare function toStorage(h: StorageInput): Storage;
200
255
 
201
- export { type Message as M, type Part as P, type StorageHandlers as S, type Sandbox as a, type Session as b, type Setup as c, type SetupSnapshot as d, type Storage as e, type StorageCall as f, StorageStep as g, type StorageStepFunction as h, type StorageInput as i, toStorage as t };
256
+ export { type GenerationOptions as G, type HostSkillEntry as H, type InlineSkillEntry as I, type Message as M, type Part as P, type StorageHandlers as S, type MessageUsage as a, type Sandbox as b, type Session as c, type Setup as d, type SetupSnapshot as e, type Storage as f, type StorageCall as g, StorageStep as h, type StorageStepFunction as i, type SkillInput as j, type StorageInput as k, type GitSkillEntry as l, type GitSkillInput as m, type HostSkillInput as n, type InlineSkillInput as o, type SandboxSkillEntry as p, type SandboxSkillInput as q, type SkillEntry as r, type SkillSourceType as s, toStorage as t };
@@ -2,6 +2,68 @@ import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
2
2
  import { NetworkPolicy } from '@vercel/sandbox';
3
3
  import { UIMessage } from 'ai';
4
4
 
5
+ type SkillSourceType = "sandbox" | "host" | "git" | "inline";
6
+ type SandboxSkillInput = {
7
+ type: "sandbox";
8
+ path: string;
9
+ };
10
+ type HostSkillInput = {
11
+ type: "host";
12
+ path: string;
13
+ };
14
+ type GitSkillInput = {
15
+ type: "git";
16
+ repo: string;
17
+ ref?: string;
18
+ path?: string;
19
+ /**
20
+ * Skill directory name under `path`.
21
+ */
22
+ name?: string;
23
+ };
24
+ type InlineSkillInput = {
25
+ type: "inline";
26
+ name: string;
27
+ description: string;
28
+ instructions: string;
29
+ };
30
+ type SkillInput = SandboxSkillInput | HostSkillInput | GitSkillInput | InlineSkillInput;
31
+ type SandboxSkillEntry = {
32
+ type: "sandbox";
33
+ path: string;
34
+ };
35
+ type HostSkillEntry = {
36
+ type: "host";
37
+ path: string;
38
+ };
39
+ type GitSkillEntry = {
40
+ type: "git";
41
+ repo: string;
42
+ ref?: string;
43
+ path?: string;
44
+ /**
45
+ * Skill directory name under `path`.
46
+ */
47
+ name?: string;
48
+ };
49
+ type InlineSkillEntry = {
50
+ type: "inline";
51
+ name: string;
52
+ description: string;
53
+ instructions: string;
54
+ };
55
+ type SkillEntry = SandboxSkillEntry | HostSkillEntry | GitSkillEntry | InlineSkillEntry;
56
+
57
+ type GenerationOptions = {
58
+ maxSteps?: number;
59
+ temperature?: number;
60
+ topK?: number;
61
+ topP?: number;
62
+ frequencyPenalty?: number;
63
+ presencePenalty?: number;
64
+ maxOutputTokens?: number;
65
+ headers?: Record<string, string>;
66
+ };
5
67
  type Session = {
6
68
  id: string;
7
69
  createdAt: number;
@@ -11,17 +73,30 @@ type Session = {
11
73
  sandboxId: string | null;
12
74
  lastMessageId: string | null;
13
75
  activeTools: string[] | null;
14
- skillsDir: string[] | null;
15
- generation: {
16
- maxSteps?: number;
17
- temperature?: number;
18
- topK?: number;
19
- topP?: number;
20
- frequencyPenalty?: number;
21
- presencePenalty?: number;
22
- maxOutputTokens?: number;
23
- headers?: Record<string, string>;
24
- } | null;
76
+ skills: SkillInput[] | null;
77
+ generation: GenerationOptions | null;
78
+ };
79
+ type MessageUsage = {
80
+ steps: {
81
+ stepIndex: number;
82
+ model: string;
83
+ inputTokens: number;
84
+ outputTokens: number;
85
+ totalTokens: number;
86
+ cacheReadTokens: number;
87
+ cacheWriteTokens: number;
88
+ reasoningTokens: number;
89
+ }[];
90
+ summary: {
91
+ model: string;
92
+ inputTokens: number;
93
+ outputTokens: number;
94
+ totalTokens: number;
95
+ cacheReadTokens: number;
96
+ cacheWriteTokens: number;
97
+ reasoningTokens: number;
98
+ stepCount: number;
99
+ };
25
100
  };
26
101
  type Message = {
27
102
  id: string;
@@ -35,29 +110,9 @@ type Message = {
35
110
  index: number;
36
111
  part: unknown;
37
112
  } | null;
38
- usage: {
39
- steps: {
40
- stepIndex: number;
41
- model: string;
42
- inputTokens: number;
43
- outputTokens: number;
44
- totalTokens: number;
45
- cacheReadTokens: number;
46
- cacheWriteTokens: number;
47
- reasoningTokens: number;
48
- }[];
49
- summary: {
50
- model: string;
51
- inputTokens: number;
52
- outputTokens: number;
53
- totalTokens: number;
54
- cacheReadTokens: number;
55
- cacheWriteTokens: number;
56
- reasoningTokens: number;
57
- stepCount: number;
58
- };
59
- } | null;
113
+ usage: MessageUsage | null;
60
114
  workflowRunId?: string | null;
115
+ metadata?: Record<string, unknown> | null;
61
116
  };
62
117
  type Part = {
63
118
  id: string;
@@ -198,4 +253,4 @@ interface Storage {
198
253
  type StorageInput = StorageHandlers | StorageStepFunction;
199
254
  declare function toStorage(h: StorageInput): Storage;
200
255
 
201
- export { type Message as M, type Part as P, type StorageHandlers as S, type Sandbox as a, type Session as b, type Setup as c, type SetupSnapshot as d, type Storage as e, type StorageCall as f, StorageStep as g, type StorageStepFunction as h, type StorageInput as i, toStorage as t };
256
+ export { type GenerationOptions as G, type HostSkillEntry as H, type InlineSkillEntry as I, type Message as M, type Part as P, type StorageHandlers as S, type MessageUsage as a, type Sandbox as b, type Session as c, type Setup as d, type SetupSnapshot as e, type Storage as f, type StorageCall as g, StorageStep as h, type StorageStepFunction as i, type SkillInput as j, type StorageInput as k, type GitSkillEntry as l, type GitSkillInput as m, type HostSkillInput as n, type InlineSkillInput as o, type SandboxSkillEntry as p, type SandboxSkillInput as q, type SkillEntry as r, type SkillSourceType as s, toStorage as t };