@workser/cli 0.6.13 → 0.6.15
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/dist/index.js +737 -247
- package/package.json +1 -1
- package/skills/workser/SKILL.md +4 -4
- package/skills/workser/reference/agent-cloud.md +130 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workser/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"description": "Workser CLI — give your local AI agent native DevOps & infrastructure on Workser. The agent runs `workser …` to provision, deploy, and manage real apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/skills/workser/SKILL.md
CHANGED
|
@@ -30,6 +30,7 @@ load.
|
|
|
30
30
|
| Build an automation, or use Gmail/Slack/Stripe/Sheets | `workflow …`, `app …` | `workser help automation` |
|
|
31
31
|
| Generate an image | `image …` | `workser help images` |
|
|
32
32
|
| Hand a subtask to another agent | `agent …` | `workser help roles` |
|
|
33
|
+
| Ship an AI agent inside the user's app | `agent-cloud …` | `workser help agent-cloud` |
|
|
33
34
|
| Recall across conversations; leave this task's team a fact | `memory …`, `workser note` | `workser help memory` |
|
|
34
35
|
| Record finished output, or ask the user a question | `artifact …`, `ask` | `workser help deliverables` |
|
|
35
36
|
| Control this machine — files, shell, screen, browser | `tool …` | `workser help computer-use` |
|
|
@@ -52,10 +53,9 @@ workser logout # clear a saved standalone session
|
|
|
52
53
|
|
|
53
54
|
## Scope (read this)
|
|
54
55
|
|
|
55
|
-
You operate on **a project's own infrastructure
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
actions are **gated** (`awaiting_approval`, exit 5) — see rule 5.
|
|
56
|
+
You operate on **a project's own infrastructure**, and you *can* provision and
|
|
57
|
+
use it: database, bucket, auth, deploys, env vars, files. Sensitive actions are
|
|
58
|
+
**gated** (`awaiting_approval`, exit 5) — see rule 5.
|
|
59
59
|
|
|
60
60
|
What you **cannot** do is administer the project set or destroy config:
|
|
61
61
|
`project create` · `project use` · `env rm` · `domain set` return
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
topic: agent-cloud
|
|
3
|
+
title: Ship an agent inside the app
|
|
4
|
+
summary: Create an AI agent that runs on Workser and can be called from this project's apps.
|
|
5
|
+
commands: [agent-cloud]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Ship an agent inside the app
|
|
9
|
+
|
|
10
|
+
`workser agent-cloud` creates an AI agent that runs on **Workser's**
|
|
11
|
+
infrastructure, keeps its own memory and tools, and can be called from the web,
|
|
12
|
+
mobile, API or Python apps in this project.
|
|
13
|
+
|
|
14
|
+
**This is not `workser agent`.** That one hands a subtask to a coding agent on
|
|
15
|
+
this machine — a teammate helping you build. This one is a thing the project
|
|
16
|
+
*ships*: it works for the user after you are gone.
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
workser agent-cloud list
|
|
20
|
+
workser agent-cloud create "Order desk" --instructions "..."
|
|
21
|
+
workser agent-cloud show <agentId>
|
|
22
|
+
workser agent-cloud run <agentId> "<what to do>"
|
|
23
|
+
workser agent-cloud runs <agentId> # recent runs
|
|
24
|
+
workser agent-cloud runs <runId> # one run, with what it cost
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Every call is scoped to the project this folder belongs to.
|
|
28
|
+
|
|
29
|
+
## Creating one is not finishing one
|
|
30
|
+
|
|
31
|
+
An agent created with a name and a sentence knows nothing about the business.
|
|
32
|
+
Teaching it is the actual work, and it is all here:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
workser agent-cloud set <id> system_prompt="..." handle="orderdesk"
|
|
36
|
+
workser agent-cloud add <id> skill name="Refunds" instructions_md="..."
|
|
37
|
+
workser agent-cloud add <id> knowledge name="Price list" content_text="..."
|
|
38
|
+
workser agent-cloud add <id> tool display_name="Send email" provider="gmail" \
|
|
39
|
+
provider_tool_id="GMAIL_SEND_EMAIL"
|
|
40
|
+
workser agent-cloud add <id> secret key="STRIPE_KEY" value="..."
|
|
41
|
+
workser agent-cloud add <id> subagent subagent_id=<otherId> name="researcher"
|
|
42
|
+
workser agent-cloud get <id> skill # what it has
|
|
43
|
+
workser agent-cloud remove <id> skill <itemId>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`add` takes `key=value` pairs and REFUSES a field it does not know, rather than
|
|
47
|
+
sending it. That matters: the API silently drops unknown fields, so a typo
|
|
48
|
+
would otherwise be accepted, dropped, and reported as success — leaving an
|
|
49
|
+
agent that had been told nothing.
|
|
50
|
+
|
|
51
|
+
## Nothing takes effect until you publish
|
|
52
|
+
|
|
53
|
+
**This is the step to not forget.** The runtime resolves the PUBLISHED version
|
|
54
|
+
of an agent and never the draft, so every `set` and `add` above is inert until:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
workser agent-cloud publish <id> --note "taught it refunds"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Before publishing, try the setup without putting it live:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
workser agent-cloud try <id> "a customer wants a refund on order 1042"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
A `try` runs the draft, costs the same as a real run, and changes nothing that
|
|
67
|
+
customers can reach.
|
|
68
|
+
|
|
69
|
+
## Choosing how it thinks and what it runs on
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
workser agent-cloud models # cheapest first, on Workser credit
|
|
73
|
+
workser agent-cloud models --all # includes ones needing your own key
|
|
74
|
+
workser agent-cloud set <id> default_provider=openrouter default_model=...
|
|
75
|
+
|
|
76
|
+
workser agent-cloud machines # video, data analysis, design, ...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
A model marked "needs your own key" will make `publish` FAIL unless a matching
|
|
80
|
+
secret is stored first. Add the key with `add <id> secret` before setting it.
|
|
81
|
+
|
|
82
|
+
## When to reach for this
|
|
83
|
+
|
|
84
|
+
When the user describes a job that **keeps happening** and needs judgement:
|
|
85
|
+
"check every order for stock and email me the problems", "read the LINE
|
|
86
|
+
messages and file them", "reconcile these invoices". That is an agent.
|
|
87
|
+
|
|
88
|
+
A one-off transformation is not an agent — write the code. A fixed sequence of
|
|
89
|
+
steps with no judgement in it is not an agent either — that is `workser
|
|
90
|
+
workflow`.
|
|
91
|
+
|
|
92
|
+
## Calling it from the app you are building
|
|
93
|
+
|
|
94
|
+
Do NOT shell out to the CLI from app code. Use the SDK, which streams:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import { workser } from '@workser/app';
|
|
98
|
+
|
|
99
|
+
const run = await workser.agents.run(agentId, { message }, {
|
|
100
|
+
referenceUserId: user.id, // who it is acting for
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
for await (const event of workser.agents.stream(run.id)) {
|
|
104
|
+
// event.type, event.data — forward these to the browser
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`stream()` reconnects itself through dropped connections, so the person
|
|
109
|
+
watching sees the agent think. See the `workser-sdk` skill, `reference/agents.md`.
|
|
110
|
+
|
|
111
|
+
## Things that will bite you
|
|
112
|
+
|
|
113
|
+
1. **A run costs money by the minute.** It is metered — runtime, workspace, and
|
|
114
|
+
a per-run fee — so a loop that starts agents is a loop that spends. Cancel
|
|
115
|
+
what you abandon: `workser agent-cloud runs <runId>` shows the cost.
|
|
116
|
+
|
|
117
|
+
2. **Instructions are the product.** The agent does what its instructions say,
|
|
118
|
+
in the user's own words. Write them the way you would brief a new colleague:
|
|
119
|
+
what to do, what to leave alone, when to ask. Vague instructions are the
|
|
120
|
+
single biggest cause of an agent that "doesn't work".
|
|
121
|
+
|
|
122
|
+
3. **Free plans cannot run agents at all**, and a trial has a small allowance.
|
|
123
|
+
A `402` with `spend_limit_reached` is not a bug — tell the user what it says
|
|
124
|
+
and point them at their plan.
|
|
125
|
+
|
|
126
|
+
4. **Say who it is for.** An agent acting for one of the app's customers needs
|
|
127
|
+
`referenceUserId`, or its memory and audit trail belong to nobody.
|
|
128
|
+
|
|
129
|
+
5. **Do not invent an agent the user did not ask for.** Creating one is cheap;
|
|
130
|
+
an agent nobody wanted, quietly costing money per run, is not.
|