@simple-ai-lab/sdk 0.1.0 → 0.3.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
@@ -38,6 +38,59 @@ const { records, total } = await client.data.query({
38
38
 
39
39
  `client.data` covers custom data end to end: `query`, `facets`, `list`, `get`, `create`, `update`, `delete`, `deleteAll`, `batchUpsert`, and `getBatch`. Errors throw `SimpleAIError` with the HTTP `status`, machine-readable `code`, and parsed `body`.
40
40
 
41
+ ## Define an agent
42
+
43
+ Agent authoring is action-first: integrations are immutable Actions, and Agent commits pin exact Action versions. New source does not create legacy tools or HTTP graph nodes.
44
+
45
+ ```typescript
46
+ import { action, defineAgent, node, prompt } from '@simple-ai-lab/sdk';
47
+ import { z } from 'zod';
48
+
49
+ const lookup = action.http({
50
+ key: 'lookup-account',
51
+ name: 'Lookup account',
52
+ description: 'Fetch an account',
53
+ input: z.object({
54
+ account_id: z.string().describe('The account identifier from the caller'),
55
+ }),
56
+ output: z.object({ account_name: z.string() }),
57
+ outputMappings: { account_name: '{{ httpResponse.body.name }}' },
58
+ request: {
59
+ method: 'GET',
60
+ url: 'https://example.com/accounts/{{ inputs.account_id }}',
61
+ },
62
+ });
63
+
64
+ export default defineAgent({
65
+ key: 'support',
66
+ name: 'Support',
67
+ branch: 'main',
68
+ nodes: [
69
+ node.prompt({
70
+ key: 'root',
71
+ name: 'Root',
72
+ root: true,
73
+ prompt: prompt.inline('Help the caller.'),
74
+ actions: [
75
+ action.callable({
76
+ key: 'lookup-action',
77
+ action: lookup,
78
+ name: 'lookup_account',
79
+ description: 'Look up an account',
80
+ inputs: {
81
+ account_id: action.fromAgent('The account identifier'),
82
+ },
83
+ // Action output name -> Agent parameter name
84
+ outputParameters: { account_name: 'customer_account_name' },
85
+ }),
86
+ ],
87
+ }),
88
+ ],
89
+ });
90
+ ```
91
+
92
+ Install `@simple-ai-lab/cli` for `simple init`, `pull`, `typecheck`, `diff`, and `publish`.
93
+
41
94
  ## Documentation
42
95
 
43
96
  Full docs: https://docs.usesimple.ai — see the SDK Quickstart and Code Actions guides.