@agentuity/skills 3.1.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.
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: agentuity-services
3
+ description: >-
4
+ Use when selecting or using Agentuity service clients from app code. Covers
5
+ standalone clients for key-value, vector, object storage, durable streams,
6
+ queues, email, schedules, tasks, webhooks, sandbox, Coder, telemetry, direct
7
+ clients versus Hono middleware, and service environment configuration.
8
+ license: Apache-2.0
9
+ metadata:
10
+ author: agentuity
11
+ version: "1.0.0"
12
+ ---
13
+
14
+ # Agentuity Service Clients
15
+
16
+ Use standalone packages when Agentuity services belong inside framework routes,
17
+ server functions, workers, scripts, or CLIs. Construct clients in server-side
18
+ modules, then call them from the handler that owns the request or job.
19
+
20
+ ## Basic Pattern
21
+
22
+ ```bash
23
+ npm install @agentuity/keyvalue
24
+ ```
25
+
26
+ ```typescript
27
+ import { KeyValueClient } from '@agentuity/keyvalue';
28
+
29
+ interface Preference {
30
+ readonly theme: 'light' | 'dark';
31
+ }
32
+
33
+ const kv = new KeyValueClient();
34
+
35
+ export async function savePreference(
36
+ userId: string,
37
+ preference: Preference
38
+ ): Promise<void> {
39
+ await kv.set('preferences', userId, preference, {
40
+ ttl: 60 * 60 * 24 * 30,
41
+ });
42
+ }
43
+
44
+ export async function getPreference(userId: string): Promise<Preference | undefined> {
45
+ const result = await kv.get<Preference>('preferences', userId);
46
+ return result.exists ? result.data : undefined;
47
+ }
48
+ ```
49
+
50
+ Most clients read `AGENTUITY_SDK_KEY` automatically. Framework dev commands are
51
+ fine when that environment is already present; use `agentuity dev` when you want
52
+ the CLI to inject linked Agentuity project credentials for the local process.
53
+
54
+ ## Choose the Right Service
55
+
56
+ | Need | Package |
57
+ |---|---|
58
+ | Exact-key JSON, TTL cache, preferences, counters | `@agentuity/keyvalue` |
59
+ | Semantic search, retrieval, document embeddings | `@agentuity/vector` |
60
+ | S3-compatible files and binary data | `@agentuity/storage` |
61
+ | Durable generated output or resumable streams | `@agentuity/stream` |
62
+ | Model catalog and routed model requests | `@agentuity/aigateway` |
63
+ | Async message handoff | `@agentuity/queue` |
64
+ | Managed outbound or inbound email | `@agentuity/email` |
65
+ | Cron schedules and delivery tracking | `@agentuity/schedule` |
66
+ | Work items, comments, tags, attachments | `@agentuity/task` |
67
+ | Managed webhook ingest URLs and receipts | `@agentuity/webhook` |
68
+ | Isolated command execution | `@agentuity/sandbox` |
69
+ | Cloud coding sessions and workspaces | `@agentuity/coder` |
70
+ | Logger, tracer, and meter setup | `@agentuity/telemetry` |
71
+
72
+ Use `agentuity-database` for relational data. Use `agentuity-cloud` when managing resources from the terminal.
73
+
74
+ ## Direct Clients vs Hono Middleware
75
+
76
+ | Code location | Use |
77
+ |---|---|
78
+ | Framework routes, scripts, and workers | Direct clients such as `new QueueClient()` |
79
+ | Hono routes that should share clients through context | `@agentuity/hono` middleware |
80
+ | Browser components | Your server route, not service clients directly |
81
+ | Non-TypeScript systems | REST API |
82
+
83
+ Hono example:
84
+
85
+ ```typescript
86
+ import { Hono } from 'hono';
87
+ import { agentuity } from '@agentuity/hono';
88
+ import type { Services } from '@agentuity/hono';
89
+
90
+ const app = new Hono<{ Variables: Pick<Services, 'kv' | 'queue'> }>();
91
+
92
+ app.use('*', agentuity());
93
+
94
+ app.post('/api/jobs', async (c) => {
95
+ const message = await c.var.queue.publish('jobs', { requestedAt: new Date().toISOString() });
96
+ await c.var.kv.set('job-status', message.id, { status: 'queued' });
97
+ return c.json({ messageId: message.id }, 202);
98
+ });
99
+ ```
100
+
101
+ The Hono middleware injects common clients such as KV, vector, stream, queue,
102
+ email, schedule, task, sandbox, logger, tracer, and meter. AI Gateway, database,
103
+ object storage, webhooks, and Coder are direct clients.
104
+
105
+ ## Configuration
106
+
107
+ Most API-backed clients accept constructor options:
108
+
109
+ | Option | Use |
110
+ |---|---|
111
+ | `apiKey` | Override `AGENTUITY_SDK_KEY` or `AGENTUITY_CLI_KEY` |
112
+ | `orgId` | Target an organization explicitly for org-scoped APIs |
113
+ | `url` | Override service URL for local or custom endpoints |
114
+ | `logger` | Provide a logger implementation |
115
+
116
+ Object storage uses S3-style bucket env values:
117
+
118
+ | Variable | Purpose |
119
+ |---|---|
120
+ | `AWS_ENDPOINT` | S3 endpoint written by project linking |
121
+ | `AWS_BUCKET` | Bucket name |
122
+ | `AWS_ACCESS_KEY_ID` | Bucket access key |
123
+ | `AWS_SECRET_ACCESS_KEY` | Bucket secret |
124
+ | `AWS_REGION` | Optional region |
125
+
126
+ Read bucket config with:
127
+
128
+ ```typescript
129
+ import { bucketConfigFromEnv, createS3Client } from '@agentuity/storage';
130
+
131
+ const storage = createS3Client(bucketConfigFromEnv());
132
+ ```
133
+
134
+ ## Service Examples
135
+
136
+ Vector search:
137
+
138
+ ```typescript
139
+ import { VectorClient } from '@agentuity/vector';
140
+
141
+ const vector = new VectorClient();
142
+
143
+ await vector.upsert('docs', {
144
+ key: 'service-clients',
145
+ document: 'Agentuity services are available through standalone packages.',
146
+ metadata: { source: 'docs' },
147
+ });
148
+
149
+ const results = await vector.search('docs', {
150
+ query: 'How do I use services from app code?',
151
+ limit: 3,
152
+ });
153
+ ```
154
+
155
+ Queue handoff:
156
+
157
+ ```typescript
158
+ import { QueueClient } from '@agentuity/queue';
159
+
160
+ const queue = new QueueClient();
161
+
162
+ const message = await queue.publish(
163
+ 'report-jobs',
164
+ { accountId: 'acct_123', month: '2026-06' },
165
+ { idempotencyKey: 'report-acct_123-2026-06' }
166
+ );
167
+ ```
168
+
169
+ Task tracking:
170
+
171
+ ```typescript
172
+ import { TaskClient } from '@agentuity/task';
173
+
174
+ const tasks = new TaskClient();
175
+
176
+ await tasks.create({
177
+ title: 'Review generated report',
178
+ description: 'Validate report output before sending it to the customer.',
179
+ });
180
+ ```
181
+
182
+ ## Common Mistakes
183
+
184
+ | Mistake | Better approach |
185
+ |---|---|
186
+ | Choosing a service by package name alone | Start with the job: cache, search, files, queue, schedule, email |
187
+ | Putting service clients in browser code | Keep clients server-side and expose a route |
188
+ | Using KV for relational data | Use a database for relational queries and joins |
189
+ | Using sandbox as a general worker queue | Use queues/schedules/tasks for workflow; sandbox for bounded execution |
190
+ | Forgetting resource setup | Use `agentuity-cloud` to create/link resources and inspect them |
191
+
192
+ ## Useful Docs
193
+
194
+ - Standalone packages: https://agentuity.dev/reference/standalone-packages
195
+ - Services: https://agentuity.dev/services
196
+ - Key-Value Storage: https://agentuity.dev/services/storage/key-value
197
+ - Vector Storage: https://agentuity.dev/services/storage/vector
198
+ - Object Storage: https://agentuity.dev/services/storage/object
199
+ - Hono: https://agentuity.dev/frameworks/hono