@workser/cli 0.6.13 → 0.6.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workser/cli",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
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",
@@ -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 | `cloud-agent …` | `workser help cloud-agents` |
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**. You *can* provision and use it:
56
- create the Neon database, read its connection string, browse its tables / rows / run
57
- SQL, provision the bucket + auth, deploy, set env vars, manage files. Sensitive
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,77 @@
1
+ ---
2
+ topic: cloud-agents
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: [cloud-agent]
6
+ ---
7
+
8
+ # Ship an agent inside the app
9
+
10
+ `workser cloud-agent` 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 cloud-agent list
20
+ workser cloud-agent create "Order desk" --instructions "..."
21
+ workser cloud-agent show <agentId>
22
+ workser cloud-agent run <agentId> "<what to do>"
23
+ workser cloud-agent runs <agentId> # recent runs
24
+ workser cloud-agent runs <runId> # one run, with what it cost
25
+ ```
26
+
27
+ Every call is scoped to the project this folder belongs to.
28
+
29
+ ## When to reach for this
30
+
31
+ When the user describes a job that **keeps happening** and needs judgement:
32
+ "check every order for stock and email me the problems", "read the LINE
33
+ messages and file them", "reconcile these invoices". That is an agent.
34
+
35
+ A one-off transformation is not an agent — write the code. A fixed sequence of
36
+ steps with no judgement in it is not an agent either — that is `workser
37
+ workflow`.
38
+
39
+ ## Calling it from the app you are building
40
+
41
+ Do NOT shell out to the CLI from app code. Use the SDK, which streams:
42
+
43
+ ```ts
44
+ import { workser } from '@workser/app';
45
+
46
+ const run = await workser.agents.run(agentId, { message }, {
47
+ referenceUserId: user.id, // who it is acting for
48
+ });
49
+
50
+ for await (const event of workser.agents.stream(run.id)) {
51
+ // event.type, event.data — forward these to the browser
52
+ }
53
+ ```
54
+
55
+ `stream()` reconnects itself through dropped connections, so the person
56
+ watching sees the agent think. See the `workser-sdk` skill, `reference/agents.md`.
57
+
58
+ ## Things that will bite you
59
+
60
+ 1. **A run costs money by the minute.** It is metered — runtime, workspace, and
61
+ a per-run fee — so a loop that starts agents is a loop that spends. Cancel
62
+ what you abandon: `workser cloud-agent runs <runId>` shows the cost.
63
+
64
+ 2. **Instructions are the product.** The agent does what its instructions say,
65
+ in the user's own words. Write them the way you would brief a new colleague:
66
+ what to do, what to leave alone, when to ask. Vague instructions are the
67
+ single biggest cause of an agent that "doesn't work".
68
+
69
+ 3. **Free plans cannot run agents at all**, and a trial has a small allowance.
70
+ A `402` with `spend_limit_reached` is not a bug — tell the user what it says
71
+ and point them at their plan.
72
+
73
+ 4. **Say who it is for.** An agent acting for one of the app's customers needs
74
+ `referenceUserId`, or its memory and audit trail belong to nobody.
75
+
76
+ 5. **Do not invent an agent the user did not ask for.** Creating one is cheap;
77
+ an agent nobody wanted, quietly costing money per run, is not.