@agent-native/core 0.66.0 → 0.66.2

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.
@@ -1,12 +1,13 @@
1
1
  ---
2
2
  title: "Getting Started"
3
- description: "Create an agent app with a chat UI or headless — add an action, and watch the agent call it."
3
+ description: "Create an agent app, understand instructions, skills, and actions, then watch the agent call its first action."
4
4
  ---
5
5
 
6
6
  # Getting Started
7
7
 
8
8
  Agent-Native apps give an AI agent and your UI the same actions, data, and
9
- state. The smallest useful app is a single action.
9
+ state. A basic agent is made from instructions that guide it, skills that teach
10
+ repeatable behavior, and actions that let it do real work.
10
11
 
11
12
  **Want a complete app to start from?** Clone one of our rich templates —
12
13
  [Chat](/docs/template-chat), [Mail](/docs/template-mail),
@@ -15,15 +16,23 @@ state. The smallest useful app is a single action.
15
16
  each a full-featured app you customize.
16
17
 
17
18
  Building from scratch? The only choice up front is whether you want a UI —
18
- everything after (defining actions, running the agent) is the same either way.
19
+ everything after (writing instructions, adding skills, defining actions, running
20
+ the agent) is the same either way.
19
21
 
20
- ```an-diagram title="The three-step on-ramp" summary="Create an app, add one action, run it. The action is then reachable from every surface."
22
+ ```an-file-tree title="A basic Agent-Native agent"
21
23
  {
22
- "html": "<div class=\"diagram-flow\"><div class=\"diagram-card\"><span class=\"diagram-pill\">1</span><strong>Create</strong><small class=\"diagram-muted\">chat template or headless</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">&rarr;</div><div class=\"diagram-card\"><span class=\"diagram-pill\">2</span><strong>Add an action</strong><small class=\"diagram-muted\">one defineAction file</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">&rarr;</div><div class=\"diagram-card\"><span class=\"diagram-pill accent\">3</span><strong>Run it</strong><small class=\"diagram-muted\">CLI, agent, or browser</small></div></div>",
23
- "css": ".diagram-flow{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.diagram-flow .diagram-card{display:flex;flex-direction:column;gap:6px;padding:14px 16px;min-width:140px}.diagram-flow .diagram-arrow{font-size:22px;line-height:1}"
24
+ "entries": [
25
+ { "path": "AGENTS.md", "note": "always-on instructions: purpose, rules, tone, and the map of what the agent can do" },
26
+ { "path": ".agents/skills/customer-research/SKILL.md", "note": "a reusable playbook the agent loads when the task matches" },
27
+ { "path": "actions/summarize-week.ts", "note": "typed code the agent, UI, CLI, HTTP, MCP, A2A, jobs, and webhooks can run" }
28
+ ]
24
29
  }
25
30
  ```
26
31
 
32
+ This is true whether you start with a chat UI, a headless agent, or a full app.
33
+ The UI changes the surface; instructions, skills, and actions give the agent its
34
+ guidance and behavior.
35
+
27
36
  ## 1. Create your app
28
37
 
29
38
  You'll need [Node.js 22+](https://nodejs.org) and [pnpm](https://pnpm.io).
@@ -51,10 +60,10 @@ loop, no UI shell:
51
60
  npx @agent-native/core@latest create my-agent --headless
52
61
  ```
53
62
 
54
- Then install:
63
+ Then install from the folder you created:
55
64
 
56
65
  ```bash
57
- cd my-app
66
+ cd my-agent # or my-app if you chose the Chat template
58
67
  pnpm install
59
68
  ```
60
69
 
@@ -80,8 +89,13 @@ ship with this example:
80
89
  }
81
90
  ```
82
91
 
83
- Replace `hello` with the smallest real operation in your domain. You define it
84
- once; every surface picks it up.
92
+ Replace `hello` with the first real operation in your domain. You define it once;
93
+ every surface picks it up.
94
+
95
+ Use `AGENTS.md` for guidance that should apply every turn. Use a skill when the
96
+ agent needs a reusable workflow or domain procedure. Use an action when the
97
+ agent needs a typed, testable way to read data, write data, call an API, or
98
+ perform an approval.
85
99
 
86
100
  ## 3. Run it
87
101
 
@@ -182,7 +196,8 @@ my-app/
182
196
  actions/ # Agent-callable actions
183
197
  app/ # React frontend (UI templates only; omitted when headless)
184
198
  server/ # Nitro API server (routes, plugins)
185
- .agents/ # Agent instructions and skills
199
+ AGENTS.md # Always-on agent instructions
200
+ .agents/ # Skills the agent can pull in when relevant
186
201
  data/app.db # Local SQLite state when DATABASE_URL is unset
187
202
  ```
188
203
 
@@ -26,6 +26,33 @@ Every agent-native app is three things working together:
26
26
 
27
27
  Headless apps can run the same production app-agent loop from the folder with `pnpm agent`, while UI apps mount the embedded agent panel and run locally with `pnpm dev`. In the cloud, Builder.io provides a managed frame — the environment that hosts the agent next to your app — with collaboration, visual editing, and managed infrastructure for teams.
28
28
 
29
+ ## Agent building blocks {#agent-building-blocks}
30
+
31
+ Every agent-native app has the same agent building blocks, regardless of whether
32
+ the product surface is headless, chat-first, or a full UI:
33
+
34
+ ```an-file-tree title="Guidance and behavior"
35
+ {
36
+ "entries": [
37
+ { "path": "AGENTS.md", "note": "always-on instructions: purpose, core rules, state keys, action index, skills index" },
38
+ { "path": ".agents/skills/<name>/SKILL.md", "note": "reusable behavior: workflow steps, policies, examples, references, and do/don't lists" },
39
+ { "path": "actions/<name>.ts", "note": "executable capability: typed operation exposed to the agent, UI, CLI, HTTP, MCP, A2A, jobs, and webhooks" }
40
+ ]
41
+ }
42
+ ```
43
+
44
+ | Building block | Use it for | Loaded when |
45
+ | ---------------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
46
+ | **Instructions** | Stable guidance the agent should carry into every task: what the app is, invariants, tone, indexes | Every turn |
47
+ | **Skills** | Reusable behavior: how to follow a workflow, apply a policy, inspect evidence, or verify an output | On demand when the skill description matches the task |
48
+ | **Actions** | Real operations: read or write data, call APIs, send messages, run approvals, produce typed results | Listed as tools every turn; executed only when called |
49
+
50
+ Skills and actions work together. A skill teaches the agent how to do a class of
51
+ work; an action is the code path it can call while doing that work. For example,
52
+ a `customer-research` skill might tell the agent which sources to inspect and
53
+ how to summarize evidence, while `search-crm` and `create-brief` actions fetch
54
+ and write the actual data.
55
+
29
56
  Six rules govern the architecture:
30
57
 
31
58
  1. **Data lives in SQL** — all app state lives in the database via Drizzle ORM
@@ -114,6 +114,26 @@ defineAction({
114
114
  });
115
115
  ```
116
116
 
117
+ ## Skills vs actions {#skills-vs-actions}
118
+
119
+ Skills and actions are complementary. A skill is guidance the agent reads; an
120
+ action is code the agent can run.
121
+
122
+ | Need | Use |
123
+ | ---------------------------------------------------------------------- | ---------------------------------- |
124
+ | The agent needs to follow a workflow, policy, checklist, or rubric | **Skill** |
125
+ | The agent needs examples, reference material, or domain-specific rules | **Skill** |
126
+ | The agent needs to read or write app data | **Action** |
127
+ | The agent needs to call an external API or perform an approval | **Action** |
128
+ | The agent calls the right operation but in the wrong way | Improve the **skill** |
129
+ | The agent cannot reliably invoke the operation | Improve the **action** |
130
+ | The agent chooses the wrong tool | Improve the **action description** |
131
+
132
+ Most real features use both: the skill explains how to approach the task, and
133
+ the action provides the typed operation. For example, an `invoice-review` skill
134
+ can explain the review policy and escalation rules, while `list-invoices`,
135
+ `flag-invoice`, and `approve-invoice` actions do the actual reads and writes.
136
+
117
137
  ## Bake in anti-fabrication and verify-before-done {#anti-fabrication}
118
138
 
119
139
  App instructions should make honesty and verification the default behavior:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.66.0",
3
+ "version": "0.66.2",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -61,9 +61,20 @@ Organizations are **framework-managed**, not handled by Better Auth's organizati
61
61
 
62
62
  The active org flows automatically: `session.orgId` — resolved by `getOrgContext` from `org_members` plus the user's `active-org-id` setting (_not_ from a Better Auth session field) — → `AGENT_ORG_ID` → SQL scoping (see `security` skill).
63
63
 
64
- **If your template requires an org to function** (data is scoped by `organization_id`, core features can't run without one), set `AUTO_CREATE_DEFAULT_ORG=1` in your `.env`. The framework will auto-create a default org (named after the user) on first login when no memberships exist. This happens inside `getOrgContext` — no template integration needed.
65
-
66
- As a safety net, also wrap your app shell in `<RequireActiveOrg>` from `@agent-native/core/client/org`. It blocks the wrapped area with a "Create your organization" pane (and accept-invite CTAs for pending invitations) if auto-create failed or the account predates it. Place it **inside** the agent sidebar so the setup checklist, chat, and CLI stay usable during setup.
64
+ If your template requires an org to function because data is scoped by
65
+ `organization_id`, set `AUTO_CREATE_DEFAULT_ORG=1` in that template's runtime
66
+ environment. The framework will auto-create a default org (named after the
67
+ user) on first login when no memberships exist. The auto-create path skips users
68
+ with pending invites or a matching `allowed_domain` org so they can join the
69
+ intended team instead. Leave the flag unset for deployments that intentionally
70
+ support solo `orgId === null` data.
71
+
72
+ As a safety net, wrap org-scoped app shells or org-scoped routes in
73
+ `<RequireActiveOrg>` from `@agent-native/core/client/org`. It blocks the wrapped
74
+ area with a "Create your organization" pane plus accept-invite/domain-join CTAs
75
+ when no active org exists, preventing org-scoped queries or mutations from
76
+ failing later in the workflow. Place it inside the agent sidebar so the setup
77
+ checklist, chat, and CLI stay usable during setup.
67
78
 
68
79
  ## A2A Identity
69
80