@soft-boy/agentschema 0.3.0 → 0.3.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 +43 -233
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,26 +4,26 @@ Define an AI-Agent as a folder of Markdown files.
|
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
my-agent/
|
|
7
|
-
├── agent.md
|
|
8
|
-
├── env.md
|
|
9
|
-
├── tools/
|
|
10
|
-
│ ├── agent_toolset_20260401.md
|
|
11
|
-
│ └── get_weather.md
|
|
12
|
-
├── skills/
|
|
7
|
+
├── agent.md # the agent
|
|
8
|
+
├── env.md # the environment it runs in
|
|
9
|
+
├── tools/
|
|
10
|
+
│ ├── agent_toolset_20260401.md # the pre-built tools to enable
|
|
11
|
+
│ └── get_weather.md # a custom tool
|
|
12
|
+
├── skills/
|
|
13
13
|
│ └── code-review/
|
|
14
|
-
│ └── SKILL.md
|
|
15
|
-
└── vaults/
|
|
16
|
-
└──
|
|
17
|
-
└──
|
|
14
|
+
│ └── SKILL.md # instructions the agent loads when needed
|
|
15
|
+
└── vaults/
|
|
16
|
+
└── secrets/
|
|
17
|
+
└── creds.md # a credential, without its secrets
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
**Status:** v0.2
|
|
20
|
+
**Status:** v0.2 draft. v0.2 breaks from the Claude Managed Agents schema: tools move out of `agent.md` and into `tools/`.
|
|
21
21
|
|
|
22
22
|
## Philosophy
|
|
23
23
|
|
|
24
|
-
1. **One folder, one agent.** A folder defines one agent,
|
|
25
|
-
2. **Everything is a Markdown file.**
|
|
26
|
-
3. **Inspired by Claude Managed Agents, not tied to it.**
|
|
24
|
+
1. **One folder, one agent.** A folder defines one agent, its environment, and what it needs to run. Sessions and each user's own credentials come from whatever runs the agent.
|
|
25
|
+
2. **Everything is a Markdown file.** Plain files you can read, diff, review and version. Settings go in YAML frontmatter, and prose goes in the body.
|
|
26
|
+
3. **Inspired by Claude Managed Agents, not tied to it.** The files use its field names, and tools are compiled into its format, but any runtime that can read the files can run the agent.
|
|
27
27
|
|
|
28
28
|
## Install
|
|
29
29
|
|
|
@@ -31,51 +31,25 @@ my-agent/
|
|
|
31
31
|
npm install -g @soft-boy/agentschema
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
This installs
|
|
34
|
+
This installs `agentschema`, and `ags` as a short name for it.
|
|
35
35
|
|
|
36
36
|
## Specification
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
An instance is a folder of Markdown files. `agent.md` and `env.md` are required.
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
my-agent/
|
|
44
|
-
├── agent.md # the agent
|
|
45
|
-
├── env.md # the environment (computer)
|
|
46
|
-
├── tools/ # tool files, nested however you like
|
|
47
|
-
│ ├── agent_toolset_20260401.md # the pre-built tools to enable
|
|
48
|
-
│ └── get_weather.md
|
|
49
|
-
├── skills/ # optional: one folder per skill
|
|
50
|
-
│ └── code-review/
|
|
51
|
-
│ ├── SKILL.md
|
|
52
|
-
│ └── checklist.md # any other files the skill needs
|
|
53
|
-
└── vaults/ # optional: one folder per vault
|
|
54
|
-
└── Ops/
|
|
55
|
-
├── vault.md # optional: the vault's metadata
|
|
56
|
-
└── Slack.md # one file per credential
|
|
57
|
-
```
|
|
38
|
+
`agent.md` and `env.md` are required; everything else is optional. `agentschema check` validates a folder without calling the API.
|
|
58
39
|
|
|
59
40
|
### `agent.md`
|
|
60
|
-
Field reference: [Agent setup](https://platform.claude.com/docs/en/managed-agents/agent-setup).
|
|
61
41
|
|
|
62
|
-
|
|
63
|
-
- **Body** is the agent's system prompt, sent as `system` exactly as written (leading and trailing whitespace trimmed). An empty body means no system prompt.
|
|
64
|
-
- Setting `system` in the frontmatter is an error, because the body is the system prompt. So is `tools`, because tools live in `tools/`.
|
|
42
|
+
The frontmatter uses the fields of a [Managed Agents agent](https://platform.claude.com/docs/en/managed-agents/agent-setup), and `name` and `model` are required. The body is the system prompt.
|
|
65
43
|
|
|
66
44
|
### `env.md`
|
|
67
|
-
Field reference: [Environments](https://platform.claude.com/docs/en/managed-agents/environments).
|
|
68
45
|
|
|
69
|
-
|
|
70
|
-
- **Body** is a note for people reading the folder. It is not sent anywhere.
|
|
46
|
+
The frontmatter uses the fields of a [Managed Agents environment](https://platform.claude.com/docs/en/managed-agents/environments). The body is a note for people, and isn't sent anywhere.
|
|
71
47
|
|
|
72
48
|
### `tools/`
|
|
73
49
|
|
|
74
|
-
|
|
50
|
+
Every `.md` file under `tools/`, at any depth, is a tool file, and subfolders are only for organizing. `agentschema tools create` writes any of the three kinds.
|
|
75
51
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
**Pre-built tools** are the tools Claude Managed Agents runs in the container: `bash`, `edit`, `glob`, `grep`, `read`, `web_fetch`, `web_search` and `write`. One file lists the ones the agent gets. By convention it's `tools/agent_toolset_20260401.md`, but the file name isn't used:
|
|
52
|
+
**Pre-built tools** run in the agent's container. One file lists them, with a Permission of `always_allow`, `always_ask` or `auto`:
|
|
79
53
|
|
|
80
54
|
```markdown
|
|
81
55
|
---
|
|
@@ -87,51 +61,19 @@ type: agent_toolset_20260401
|
|
|
87
61
|
| Name | Enabled | Permission |
|
|
88
62
|
|---|---|---|
|
|
89
63
|
| `bash` | `true` | `always_ask` |
|
|
90
|
-
| `read` | `true` | |
|
|
91
|
-
| `web_search` | `false` | |
|
|
64
|
+
| `read` | `true` | `always_allow` |
|
|
92
65
|
```
|
|
93
66
|
|
|
94
|
-
|
|
95
|
-
- **`## Tools`** has a row for each tool you configure. **Enabled** is `true` or `false`. A tool without a row keeps the API's default, which is enabled. With no file at all, the agent gets no pre-built tools.
|
|
96
|
-
- **Permission** is `always_allow`, `always_ask` or `auto`. Leave the cell blank for the API's default (`always_allow`), or leave out the column entirely.
|
|
97
|
-
- There can be only one such file. Other sections are notes for people.
|
|
98
|
-
|
|
99
|
-
**MCP toolsets** give the agent the tools a remote MCP server offers. Declare the server in `agent.md`, with the API's fields:
|
|
100
|
-
|
|
101
|
-
```yaml
|
|
102
|
-
mcp_servers:
|
|
103
|
-
- type: url
|
|
104
|
-
name: calendar
|
|
105
|
-
url: https://calendarmcp.googleapis.com/mcp/v1
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Then give it one file in `tools/`, named after the server:
|
|
67
|
+
**MCP toolsets** give the agent a remote server's tools. Declare the server under `mcp_servers` in `agent.md`, then add a file named after it. The `## Tools` table is optional:
|
|
109
68
|
|
|
110
69
|
```markdown
|
|
111
70
|
---
|
|
112
71
|
type: mcp_toolset
|
|
113
|
-
mcp_server_name:
|
|
114
|
-
default_config:
|
|
115
|
-
enabled: false
|
|
72
|
+
mcp_server_name: linear
|
|
116
73
|
---
|
|
117
|
-
|
|
118
|
-
## Tools
|
|
119
|
-
|
|
120
|
-
| Name | Enabled | Permission |
|
|
121
|
-
|---|---|---|
|
|
122
|
-
| `list_events` | `true` | `always_allow` |
|
|
123
|
-
| `create_event` | `true` | |
|
|
124
74
|
```
|
|
125
75
|
|
|
126
|
-
|
|
127
|
-
- **`default_config`** is optional, and applies to every tool without a row: `enabled` and `permission_policy`, as in the API. Without it, all the server's tools are on, and they ask for approval before each call (`always_ask`). `enabled: false`, as above, turns on only the tools you list.
|
|
128
|
-
- **`## Tools`** is optional, and configures tools by the names the server reports. The server defines its own tools, so `check` can't verify these names.
|
|
129
|
-
- **Sign-in:** a server that needs it gets its credentials from `vaults/`, matched by URL. `agentschema cred create` offers the servers in `agent.md`.
|
|
130
|
-
- **Networking:** with `limited` networking in `env.md`, set `allow_mcp_servers: true` or add the server's host to `allowed_hosts`, or the API won't start sessions. `check` warns about this.
|
|
131
|
-
|
|
132
|
-
An agent can have up to 20 MCP servers.
|
|
133
|
-
|
|
134
|
-
**Custom tools** run on your side: when the agent calls one, `agentschema run` runs its code on your machine and sends back the result.
|
|
76
|
+
**Custom tools** run on your machine when the agent calls them, and the code is never uploaded. `agentschema run` loads settings for them from a `.env` file in the folder:
|
|
135
77
|
|
|
136
78
|
````markdown
|
|
137
79
|
---
|
|
@@ -154,85 +96,48 @@ module.exports = ({ city }) =>
|
|
|
154
96
|
```
|
|
155
97
|
````
|
|
156
98
|
|
|
157
|
-
- **Frontmatter:** `type: custom`, a `name` that matches the file name, and a `description` the model reads to decide when to call the tool. The name can't reuse a pre-built tool's name (so `read_file` works, but not `read`), because the API rejects that.
|
|
158
|
-
- **`## Input Schema`** is a table with the columns Name, Type, Description and Required. Type is `string`, `number`, `integer`, `boolean`, `object` or `array`, or one of those followed by `[]` for a list. Leave the section out for a tool that takes no input.
|
|
159
|
-
- **`## Code`** is required, and must be one JavaScript code block. It's a CommonJS module, and `module.exports` is the function. It's called with the call's input as an object. A string it returns (or resolves to) is sent as the result; anything else is sent as JSON. If it throws, the error message is sent as an error result. `require()` resolves from the tool's file, so packages installed in the agent folder work.
|
|
160
|
-
- Other sections are notes for people.
|
|
161
|
-
|
|
162
|
-
**Compiling.** `deploy` turns `tools/` into the agent's `tools` list, sorted by tool name: one `agent_toolset_20260401` entry with a config for each row of the `## Tools` table (its `enabled`, and its `permission_policy` if it has one), then an `mcp_toolset` entry for each MCP toolset file, then the custom tools. A custom tool sends only its name, description and input schema; the code never leaves your machine.
|
|
163
|
-
|
|
164
99
|
### `skills/`
|
|
165
|
-
Field reference: [Skills](https://platform.claude.com/docs/en/managed-agents/skills).
|
|
166
100
|
|
|
167
|
-
|
|
101
|
+
Each folder is a [skill](https://platform.claude.com/docs/en/managed-agents/skills): a `SKILL.md` plus any files it needs. `name` must match the folder. Everything in the folder is uploaded to Anthropic and attached to the agent:
|
|
168
102
|
|
|
169
103
|
```markdown
|
|
170
104
|
---
|
|
171
105
|
name: code-review
|
|
172
|
-
description: Review code for bugs
|
|
106
|
+
description: Review code for bugs and missing tests. Use when asked to review a change.
|
|
173
107
|
---
|
|
174
108
|
|
|
175
|
-
|
|
109
|
+
Go through the change one file at a time, and report findings by file and line.
|
|
176
110
|
```
|
|
177
111
|
|
|
178
|
-
- **`name`** is required, and must match the folder's name. It may use lowercase letters, digits and hyphens, up to 64 characters, and can't contain `anthropic` or `claude`.
|
|
179
|
-
- **`description`** is required, up to 1,024 characters, with no XML tags. The agent reads it to decide when to load the skill. Other frontmatter fields are left as written.
|
|
180
|
-
- **Files:** hidden files and `node_modules` aren't uploaded. A skill's files can add up to 30 MB.
|
|
181
|
-
- **Everything in the folder is uploaded to Anthropic,** so keep secrets out. `check` scans these files too.
|
|
182
|
-
|
|
183
|
-
Every skill in the folder is attached to the agent. To use Anthropic's pre-built skills, or a skill that already exists in your workspace, list it under `skills` in `agent.md`'s frontmatter, as in the API; `deploy` adds the folder's skills to that list.
|
|
184
|
-
|
|
185
112
|
### `vaults/`
|
|
186
|
-
Field reference: [Vaults](https://platform.claude.com/docs/en/managed-agents/vaults).
|
|
187
|
-
|
|
188
|
-
Vaults hold the credentials the agent's MCP servers and API calls need. Each folder in `vaults/` is one vault, and the folder name is the vault's name. `run` attaches every vault to its session, in folder name order: when two vaults have a credential for the same server, the first one wins.
|
|
189
113
|
|
|
190
|
-
|
|
191
|
-
- **Every other `.md` file is a credential**, and the file name is the credential's name. It's either `mcp_oauth`, for an MCP server's sign-in, or `environment_variable`, for an API key. A vault holds at most 20, one per MCP server or variable.
|
|
192
|
-
|
|
193
|
-
A credential file holds its settings, using the fields of the API's `auth` object, but never its secrets. This is an `mcp_oauth` credential:
|
|
114
|
+
Each folder is a [vault](https://platform.claude.com/docs/en/managed-agents/vaults), and each `.md` file in it is a credential, either `mcp_oauth` or `environment_variable`. Files never hold secrets, so they're safe to commit: `agentschema cred create` signs you in or asks for them, and sends them straight to the vault. For example, `vaults/secrets/creds.md`:
|
|
194
115
|
|
|
195
116
|
```markdown
|
|
196
117
|
---
|
|
197
118
|
auth:
|
|
198
119
|
type: mcp_oauth
|
|
199
|
-
mcp_server_url: https://mcp.
|
|
200
|
-
refresh:
|
|
201
|
-
token_endpoint: https://slack.com/api/oauth.v2.user.access
|
|
202
|
-
client_id: "1234567890.0987654321"
|
|
203
|
-
scope: channels:read chat:write
|
|
204
|
-
token_endpoint_auth:
|
|
205
|
-
type: client_secret_post
|
|
120
|
+
mcp_server_url: https://mcp.linear.app/mcp
|
|
206
121
|
---
|
|
207
|
-
|
|
208
|
-
The ops bot's Slack token.
|
|
209
122
|
```
|
|
210
123
|
|
|
211
|
-
|
|
212
|
-
- **`refresh`** is optional, but without it the credential stops working when the access token expires.
|
|
213
|
-
- **Some fields can't change** once the credential exists: `type`, `mcp_server_url`, whether there's a `refresh` block, and its `token_endpoint`, `client_id`, `resource` and `token_endpoint_auth.type`, or an environment variable's `secret_name`. Changing one is an error at `deploy`; delete the credential with `cred delete` and create it again. Other settings, the metadata and the note can change.
|
|
124
|
+
## Authentication
|
|
214
125
|
|
|
215
|
-
|
|
126
|
+
Commands that call the API use `ANTHROPIC_API_KEY` if it's exported, or otherwise your `ant auth login` profile. Everything is created in that key's workspace.
|
|
216
127
|
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
auth:
|
|
220
|
-
type: environment_variable
|
|
221
|
-
secret_name: STRIPE_API_KEY
|
|
222
|
-
networking:
|
|
223
|
-
type: limited
|
|
224
|
-
allowed_hosts:
|
|
225
|
-
- api.stripe.com
|
|
226
|
-
injection_location:
|
|
227
|
-
header: true
|
|
228
|
-
body: false
|
|
229
|
-
---
|
|
128
|
+
```sh
|
|
129
|
+
ANTHROPIC_API_KEY=sk-ant-…
|
|
230
130
|
```
|
|
231
131
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
132
|
+
## Getting started
|
|
133
|
+
|
|
134
|
+
Create an agent, deploy it, and chat with it:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
agentschema init my-agent --yes
|
|
138
|
+
agentschema deploy my-agent
|
|
139
|
+
agentschema run my-agent
|
|
140
|
+
```
|
|
236
141
|
|
|
237
142
|
## Usage
|
|
238
143
|
|
|
@@ -252,102 +157,7 @@ agentschema cred login <file> # sign in to a credential's server in the
|
|
|
252
157
|
agentschema cred delete <file> # delete a credential
|
|
253
158
|
```
|
|
254
159
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
**`init`** creates the folder `<name>` with an `agent.md` and an `env.md` that pass `check`. It asks for:
|
|
258
|
-
- the agent's name and model
|
|
259
|
-
- its system prompt
|
|
260
|
-
- whether it gets the pre-built tools; if so, `init` writes `tools/agent_toolset_20260401.md` listing all eight
|
|
261
|
-
- the environment's name and networking
|
|
262
|
-
|
|
263
|
-
Press Enter to keep the default shown, or pass `--yes` to skip the questions. `init` won't write into a folder that already has files in it.
|
|
264
|
-
|
|
265
|
-
**`check`** reads every file and reports every problem it finds:
|
|
266
|
-
- a missing file, or a name that isn't lowercase
|
|
267
|
-
- frontmatter that is missing, unclosed, or invalid YAML
|
|
268
|
-
- a missing `name` or `model`, or a `system` or `tools` key in `agent.md`'s frontmatter
|
|
269
|
-
- a pre-built tools table that names an unknown tool or permission, an MCP server without both its entry in `agent.md` and its toolset file, or a custom tool with a missing description, a malformed input table, or code that isn't JavaScript or doesn't parse
|
|
270
|
-
- a skill with no `SKILL.md`, or a `name` or `description` the API would reject
|
|
271
|
-
- a credential file with a secret in it, a missing field, or two credentials for the same server
|
|
272
|
-
- values over the API's limits
|
|
273
|
-
- anything that looks like an API key or token
|
|
274
|
-
|
|
275
|
-
Unknown fields are only warnings, because they're sent to the API as written. `check` exits with status 1 when there are errors.
|
|
276
|
-
|
|
277
|
-
**`deploy`** runs `check` first, then creates or updates the skills, the environment, the agent and the vaults, and records their IDs in `claude-lock.json` in the folder. Commit that file.
|
|
278
|
-
- **Later runs update the same resources.** A file that hasn't changed since the last deploy is skipped. Each change to `agent.md` or `tools/` adds a new version of the agent, and sessions already running keep the version they started on.
|
|
279
|
-
- **The files are the source of truth.** A field you delete from a file is cleared on the next deploy, rather than left at its old value.
|
|
280
|
-
- **Changes made elsewhere aren't overwritten silently.** If the agent was changed outside the folder since the last deploy, `deploy` stops; `--force` overwrites it.
|
|
281
|
-
- **A changed skill gets a new version.** Any change to a skill's files uploads the whole folder as a new version. The agent is pinned to skill versions, so that also adds a new version of the agent, and sessions already running keep what they started on. Deleting a skill's folder detaches it from the agent, but the skill stays in your workspace until you delete it in the Console. Renaming the folder creates a new skill.
|
|
282
|
-
- **Credentials are updated, not created.** Creating a credential needs its secrets, which aren't in the files, so `deploy` lists each credential file that has no credential yet, with the `cred deploy` command to run. It updates the settings of credentials that exist.
|
|
283
|
-
|
|
284
|
-
`claude-lock.json` uses the same layout as `ant apply`'s, so `deploy` updates resources that `ant apply` created. The two tools hash files differently, though, so the first `deploy` after an `ant apply` updates both resources even if nothing changed.
|
|
285
|
-
|
|
286
|
-
**`run`** starts a session on the agent and environment in `claude-lock.json`, then opens a chat in the terminal. Deploy first; if you've edited the files since, `run` warns you and still uses the deployed version.
|
|
287
|
-
- **Messages:** type a message and press Enter. The agent's replies stream in, with a one-line summary of each tool call.
|
|
288
|
-
- **Approvals:** when a tool call needs approval (`always_ask`, or `auto` when the server can't decide), `run` asks you. Answer `y` to allow it, or type a reason to deny it; the agent sees the reason.
|
|
289
|
-
- **Custom tools:** `run` runs the tool's code from `tools/` and sends back the result. The code runs on your machine with your permissions, like any script in the folder. Settings the code needs can go in a `.env` file in the agent folder, as `KEY=VALUE` lines, which `run` loads before it starts. Keep `.env` out of git. A variable already set in your shell wins, and `.env` doesn't change which Anthropic credentials `run` uses. If the folder doesn't pass `check`, or the tool isn't in it (for example, when you resume a session from somewhere else), `run` shows the call's input and asks you to type the result.
|
|
290
|
-
- **Interrupting:** Ctrl+C interrupts the agent mid-turn, and a second Ctrl+C quits. Ctrl+D quits at the prompt.
|
|
291
|
-
- **Vaults:** the session gets every vault in `vaults/` that's been deployed, in folder name order. `run` warns about vaults that haven't been deployed and credentials that haven't been created.
|
|
292
|
-
- **Resuming:** quitting leaves the session in place, and `run` prints a command to resume it: `agentschema run --resume sesn_…`.
|
|
293
|
-
|
|
294
|
-
```sh
|
|
295
|
-
agentschema run --resume sesn_… # resume an existing session
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
To run the agent from your own code, create a session with the agent and environment IDs from the lock file.
|
|
299
|
-
|
|
300
|
-
**`list`** prints every agent in your workspace, with its ID, latest version, model and when it was last updated. It includes agents that weren't deployed with agentschema, and leaves out archived ones.
|
|
301
|
-
|
|
302
|
-
**`tools create`** adds a tool, asking a few questions like `init`. It only writes files; `deploy` sends them to the API.
|
|
303
|
-
- **Pre-built tools:** turn on all eight, or pick them one by one. It writes `tools/agent_toolset_20260401.md`, and stops if the agent already has that file.
|
|
304
|
-
- **Custom tool:** its name, what it does, and each input's name, type, description and whether it's required. It writes `tools/<name>.md` with a code block to fill in, which throws "isn't implemented yet" until you do.
|
|
305
|
-
- **MCP server:** its URL, its name and the permission for its tools. It asks the server for its tools, adds the server to `mcp_servers` in `agent.md`, keeping the rest of that file as written, and writes `tools/<name>.md` with a `## Tools` table listing them all as enabled, with that permission; edit the table to turn tools off. If `agent.md` already declares that server, it only writes the file. A server that won't list its tools without signing in gets no table, so every tool is on with that permission. A tool the server adds later isn't in the table, so it gets the API's defaults.
|
|
306
|
-
|
|
307
|
-
**`sessions list`** prints every session in your workspace, newest first, with its status, the agent and version it runs, and its title. Pass an ID to `run --resume` to pick a session back up.
|
|
308
|
-
|
|
309
|
-
**`delete`** archives an agent. The API can't delete agents outright, so this is as close as it gets. An archived agent drops out of `list`, and the API has no way to unarchive it. If the agent is in a folder's `claude-lock.json`, remove its entry so the next `deploy` creates a new one.
|
|
310
|
-
|
|
311
|
-
**`sessions delete`** permanently deletes a session and its event history. A running session can't be deleted; wait for it to go idle, or interrupt it, first.
|
|
312
|
-
|
|
313
|
-
Both ask for confirmation first, showing the agent's name or the session's title. Pass `--yes` to skip that, for example in scripts; without a terminal to ask in, they refuse unless you pass `--yes`.
|
|
314
|
-
|
|
315
|
-
**`cred create`** adds a credential, asking a few questions like `init`:
|
|
316
|
-
1. Which vault it goes in: one in `vaults/`, or a new one.
|
|
317
|
-
2. Whether it's for an MCP server's sign-in or an environment variable.
|
|
318
|
-
3. For an MCP server: which one (from `agent.md`'s `mcp_servers` where the vault has no credential for it yet, or any URL), its name, and how to get its tokens: sign in with the browser (when the server publishes an OAuth sign-in), paste them, or just write the file for later.
|
|
319
|
-
4. For an environment variable: its name, the hosts it may be sent to, where in a request it can appear, the credential's name, and whether to paste the value now or just write the file. The menu only writes `limited` networking; edit the file for `unrestricted`.
|
|
320
|
-
|
|
321
|
-
It writes `vaults/<vault>/<name>.md`, asking for the OAuth client's details when the file needs them. Then it signs you in as `cred login` does, or asks for the tokens without showing what you type: the access token, when it expires, and with a `refresh` block, the refresh token and client secret. It creates the vault first if it hasn't been deployed. If you chose to just write the file, create the credential later with `cred deploy`.
|
|
322
|
-
|
|
323
|
-
**`cred deploy`** creates the credential an existing file describes in Anthropic, such as one you wrote by hand or one `deploy` lists as missing: `agentschema cred deploy my-agent/vaults/Ops/Slack.md`. It asks whether to sign in with the browser or paste the tokens; for an environment variable, it just asks for the value. A credential that already exists is an error when pasting; to replace its tokens, run `cred login`, or delete it and deploy it again.
|
|
324
|
-
|
|
325
|
-
**`cred login`** creates a credential by signing you in to its MCP server in the browser, for example `agentschema cred login my-agent/vaults/Ops/Linear.md`. The file needs only `type` and `mcp_server_url`:
|
|
326
|
-
1. It finds the server's sign-in from its URL, using the OAuth metadata MCP servers publish.
|
|
327
|
-
2. It needs an OAuth client. With a `refresh` block in the file, it uses that block's `client_id`, and asks for the client secret unless `token_endpoint_auth.type` is `none`. Without one, it registers agentschema as a client, which servers such as Linear and Notion allow, and writes the `refresh` block into the file.
|
|
328
|
-
3. It opens your browser to sign in, and receives the result on `http://127.0.0.1:<port>/callback`. The port is any free one, or `--port`.
|
|
329
|
-
4. It creates the credential with the tokens, creating the vault first if needed. If the credential already exists, it replaces its tokens instead, so signing in again is how you renew a credential whose refresh token stopped working.
|
|
330
|
-
|
|
331
|
-
It stops without creating anything if the server doesn't return a refresh token, since the credential would stop working within the hour.
|
|
332
|
-
|
|
333
|
-
Some servers, such as Google's and Slack's, don't let apps register themselves. For those, create an OAuth client with the provider first, add its details to the file's `refresh` block (`cred login` prints what to add), and allow the redirect URI `http://127.0.0.1:<port>/callback`. A client that needs an exact redirect URI needs a fixed `--port`. For Google, `cred login` also asks for offline access, which Google requires before it issues a refresh token.
|
|
334
|
-
|
|
335
|
-
**`cred delete`** permanently deletes the credential a file describes and removes it from `claude-lock.json`. The file stays, so you can create it again. It asks for confirmation unless you pass `--yes`.
|
|
336
|
-
|
|
337
|
-
### Authentication
|
|
338
|
-
|
|
339
|
-
agentschema has no account setting of its own. Every command except `init` and `check` uses whichever Anthropic credentials are in your shell:
|
|
340
|
-
|
|
341
|
-
1. `ANTHROPIC_API_KEY`, if it's set
|
|
342
|
-
2. otherwise, the profile you signed in to with `ant auth login` (the active one, or the one `ANTHROPIC_PROFILE` names)
|
|
343
|
-
|
|
344
|
-
An API key belongs to one workspace, and the agent and environment are created in that workspace. Each person deploys with their own key, and to deploy somewhere else you switch the key:
|
|
345
|
-
|
|
346
|
-
```sh
|
|
347
|
-
ANTHROPIC_API_KEY=sk-ant-… agentschema deploy my-agent
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
`claude-lock.json` holds the IDs from one workspace. A committed lock works for everyone whose key is in that workspace, and they all update the same agent. If you deploy the folder from a key in a different workspace, `deploy` can't find those IDs and stops. In that case, deploy from a copy of the folder, or don't commit that lock file.
|
|
160
|
+
Use `agentschema --help` for more info.
|
|
351
161
|
|
|
352
162
|
## Development
|
|
353
163
|
|