autonomous-agents 0.1.0 → 2.0.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.
- package/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +17 -0
- package/README.md +260 -96
- package/dist/actions.d.ts +136 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +303 -0
- package/dist/actions.js.map +1 -0
- package/dist/agent.d.ts +49 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +452 -0
- package/dist/agent.js.map +1 -0
- package/dist/goals.d.ts +138 -0
- package/dist/goals.d.ts.map +1 -0
- package/dist/goals.js +342 -0
- package/dist/goals.js.map +1 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/metrics.d.ts +245 -0
- package/dist/metrics.d.ts.map +1 -0
- package/dist/metrics.js +436 -0
- package/dist/metrics.js.map +1 -0
- package/dist/role.d.ts +122 -0
- package/dist/role.d.ts.map +1 -0
- package/dist/role.js +393 -0
- package/dist/role.js.map +1 -0
- package/dist/team.d.ts +152 -0
- package/dist/team.d.ts.map +1 -0
- package/dist/team.js +347 -0
- package/dist/team.js.map +1 -0
- package/dist/types.d.ts +327 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +27 -36
- package/src/actions.ts +366 -0
- package/src/agent.ts +548 -0
- package/src/goals.ts +435 -0
- package/src/index.ts +135 -0
- package/src/metrics.ts +591 -0
- package/src/role.ts +422 -0
- package/src/team.ts +466 -0
- package/src/types.ts +356 -0
- package/test/actions.test.ts +522 -0
- package/test/agent.test.ts +490 -0
- package/test/goals.test.ts +570 -0
- package/test/metrics.test.ts +707 -0
- package/test/role.test.ts +423 -0
- package/test/team.test.ts +708 -0
- package/tsconfig.json +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# autonomous-agents
|
|
2
|
+
|
|
3
|
+
## 2.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- ai-functions@2.0.2
|
|
9
|
+
- digital-workers@2.0.2
|
|
10
|
+
|
|
11
|
+
## 2.0.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
- ai-functions@2.0.1
|
|
17
|
+
- digital-workers@2.0.1
|
package/README.md
CHANGED
|
@@ -1,144 +1,308 @@
|
|
|
1
1
|
# autonomous-agents
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
3
|
+
Primitives for building and orchestrating autonomous AI agents. Implements the `digital-workers` interface for AI agents operating within a company boundary.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
## Overview
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
Autonomous agents are AI Workers that can:
|
|
8
|
+
- Execute tasks and make decisions autonomously
|
|
9
|
+
- Work in teams with other agents and humans
|
|
10
|
+
- Track goals and metrics (KPIs, OKRs)
|
|
11
|
+
- Request approvals and interact with human oversight
|
|
12
|
+
- Operate within defined roles and responsibilities
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
## Installation
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- Monitors key performance indicators
|
|
16
|
-
- Handles errors gracefully in an autonomous context
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add autonomous-agents
|
|
18
|
+
```
|
|
17
19
|
|
|
18
|
-
##
|
|
20
|
+
## Integration with digital-workers
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
Autonomous agents implement the `Worker` interface from `digital-workers`, enabling them to:
|
|
23
|
+
- Receive notifications, questions, and approval requests
|
|
24
|
+
- Be targeted by Worker Actions in workflows
|
|
25
|
+
- Communicate through configured contact channels
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
```typescript
|
|
28
|
+
import { Agent } from 'autonomous-agents'
|
|
29
|
+
import { registerWorkerActions, withWorkers } from 'digital-workers'
|
|
30
|
+
import { Workflow } from 'ai-workflows'
|
|
31
|
+
|
|
32
|
+
// Create an autonomous agent
|
|
33
|
+
const codeReviewer = Agent({
|
|
34
|
+
name: 'Code Reviewer',
|
|
35
|
+
role: Role({
|
|
36
|
+
name: 'Senior Engineer',
|
|
37
|
+
description: 'Reviews code for quality and security',
|
|
38
|
+
skills: ['code review', 'security analysis'],
|
|
39
|
+
}),
|
|
40
|
+
mode: 'autonomous',
|
|
41
|
+
contacts: {
|
|
42
|
+
api: { endpoint: 'https://api.internal/reviewer', auth: 'bearer' },
|
|
43
|
+
webhook: { url: 'https://hooks.internal/code-review' },
|
|
44
|
+
},
|
|
45
|
+
})
|
|
27
46
|
|
|
28
|
-
|
|
47
|
+
// Use in workflows
|
|
48
|
+
const workflow = Workflow($ => {
|
|
49
|
+
registerWorkerActions($)
|
|
50
|
+
const worker$ = withWorkers($)
|
|
51
|
+
|
|
52
|
+
$.on.PR.opened(async (pr) => {
|
|
53
|
+
// Ask the AI agent to review
|
|
54
|
+
const review = await worker$.ask(
|
|
55
|
+
codeReviewer,
|
|
56
|
+
`Review PR #${pr.number}: ${pr.title}`,
|
|
57
|
+
{ schema: { approved: 'boolean', comments: ['string'] } }
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
if (!review.approved) {
|
|
61
|
+
await worker$.notify(pr.author, `Code review needs changes: ${review.comments.join(', ')}`)
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
```
|
|
29
66
|
|
|
30
|
-
|
|
31
|
-
# Using npm
|
|
32
|
-
npm install autonomous-agents
|
|
67
|
+
## Creating Agents
|
|
33
68
|
|
|
34
|
-
|
|
35
|
-
yarn add autonomous-agents
|
|
69
|
+
### Basic Agent
|
|
36
70
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
71
|
+
```typescript
|
|
72
|
+
import { Agent, Role } from 'autonomous-agents'
|
|
73
|
+
|
|
74
|
+
const productManager = Role({
|
|
75
|
+
name: 'Product Manager',
|
|
76
|
+
description: 'Manages product strategy and roadmap',
|
|
77
|
+
skills: ['product strategy', 'user research', 'roadmap planning'],
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
const agent = Agent({
|
|
81
|
+
name: 'ProductAgent',
|
|
82
|
+
role: productManager,
|
|
83
|
+
mode: 'autonomous',
|
|
84
|
+
goals: [
|
|
85
|
+
{ id: 'g1', description: 'Define Q1 roadmap', target: '100%' }
|
|
86
|
+
],
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// Execute tasks
|
|
90
|
+
const result = await agent.do('Create product brief for feature X')
|
|
91
|
+
|
|
92
|
+
// Make decisions
|
|
93
|
+
const choice = await agent.decide(['A', 'B', 'C'], 'Which feature to prioritize?')
|
|
40
94
|
|
|
41
|
-
|
|
95
|
+
// Ask questions
|
|
96
|
+
const answer = await agent.ask('What are the top user complaints?')
|
|
97
|
+
```
|
|
42
98
|
|
|
43
|
-
###
|
|
99
|
+
### Supervised Agent
|
|
44
100
|
|
|
45
101
|
```typescript
|
|
46
|
-
|
|
102
|
+
const supervisedAgent = Agent({
|
|
103
|
+
name: 'DeployBot',
|
|
104
|
+
role: Role({
|
|
105
|
+
name: 'DevOps Engineer',
|
|
106
|
+
description: 'Manages deployments',
|
|
107
|
+
skills: ['deployment', 'infrastructure'],
|
|
108
|
+
}),
|
|
109
|
+
mode: 'supervised',
|
|
110
|
+
supervisor: 'alice@company.com', // Human supervisor
|
|
111
|
+
requiresApproval: true,
|
|
112
|
+
contacts: {
|
|
113
|
+
slack: { workspace: 'company', channel: '#deployments' },
|
|
114
|
+
},
|
|
115
|
+
})
|
|
47
116
|
|
|
48
|
-
//
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
keyResults: ['ticketResponseTime', 'ticketResolutionTime', 'customerSatisfaction'],
|
|
55
|
-
integrations: ['chat', 'slack', 'email', 'zendesk', 'shopify'],
|
|
56
|
-
triggers: ['onTicketCreated', 'onMessageReceived'],
|
|
57
|
-
searches: ['FAQs', 'Tickets', 'Orders', 'Products', 'Customers'],
|
|
58
|
-
actions: ['sendMessage', 'updateOrder', 'refundOrder', 'resolveTicket', 'escalateTicket'],
|
|
117
|
+
// This will request approval before executing
|
|
118
|
+
const approval = await supervisedAgent.approve({
|
|
119
|
+
title: 'Production Deployment',
|
|
120
|
+
description: 'Deploy v2.0.0 to production',
|
|
121
|
+
data: { version: '2.0.0', environment: 'production' },
|
|
122
|
+
priority: 'high',
|
|
59
123
|
})
|
|
124
|
+
|
|
125
|
+
if (approval.status === 'approved') {
|
|
126
|
+
await supervisedAgent.do('Deploy application', { version: '2.0.0' })
|
|
127
|
+
}
|
|
60
128
|
```
|
|
61
129
|
|
|
62
|
-
|
|
130
|
+
## Teams
|
|
131
|
+
|
|
132
|
+
Create teams of agents and humans:
|
|
63
133
|
|
|
64
134
|
```typescript
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
135
|
+
import { Team, Agent, Role } from 'autonomous-agents'
|
|
136
|
+
|
|
137
|
+
const engineeringTeam = Team({
|
|
138
|
+
name: 'Engineering',
|
|
139
|
+
description: 'Product engineering team',
|
|
140
|
+
members: [
|
|
141
|
+
{
|
|
142
|
+
id: 'alice',
|
|
143
|
+
name: 'Alice',
|
|
144
|
+
role: Role({ name: 'Tech Lead', description: 'Leads technical decisions', skills: [] }),
|
|
145
|
+
type: 'human',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: 'code-reviewer',
|
|
149
|
+
name: 'Code Reviewer Bot',
|
|
150
|
+
role: Role({ name: 'Reviewer', description: 'Reviews code', skills: ['code review'] }),
|
|
151
|
+
type: 'agent',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
goals: [
|
|
155
|
+
{ id: 'velocity', description: 'Increase velocity by 20%', target: '20%' },
|
|
156
|
+
],
|
|
157
|
+
channels: [
|
|
158
|
+
{ id: 'slack', type: 'slack', config: { channel: '#engineering' } },
|
|
159
|
+
],
|
|
70
160
|
})
|
|
71
161
|
|
|
72
|
-
//
|
|
73
|
-
const
|
|
74
|
-
operation: 'processRefund',
|
|
75
|
-
orderId: '12345',
|
|
76
|
-
amount: 99.99,
|
|
77
|
-
reason: 'Customer request'
|
|
78
|
-
})
|
|
162
|
+
// Find best team member for a task
|
|
163
|
+
const reviewer = findBestMemberForTask(engineeringTeam, 'code review')
|
|
79
164
|
```
|
|
80
165
|
|
|
81
|
-
|
|
166
|
+
## Goals and OKRs
|
|
167
|
+
|
|
168
|
+
Track agent goals with KPIs and OKRs:
|
|
82
169
|
|
|
83
170
|
```typescript
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
171
|
+
import { Goals, kpis, okrs } from 'autonomous-agents'
|
|
172
|
+
|
|
173
|
+
const agentGoals = Goals({
|
|
174
|
+
goals: [
|
|
175
|
+
{
|
|
176
|
+
id: 'response-time',
|
|
177
|
+
description: 'Maintain sub-5s response time',
|
|
178
|
+
target: '5s',
|
|
179
|
+
priority: 'high',
|
|
180
|
+
successCriteria: ['95th percentile < 5s', 'No timeouts'],
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
strategy: 'Focus on performance optimization',
|
|
93
184
|
})
|
|
185
|
+
|
|
186
|
+
// Define KPIs
|
|
187
|
+
const performanceKPIs = kpis([
|
|
188
|
+
{
|
|
189
|
+
id: 'response-time',
|
|
190
|
+
name: 'Response Time',
|
|
191
|
+
value: 3.2,
|
|
192
|
+
target: 5,
|
|
193
|
+
unit: 'seconds',
|
|
194
|
+
trend: 'down', // lower is better
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
id: 'success-rate',
|
|
198
|
+
name: 'Success Rate',
|
|
199
|
+
value: 98.5,
|
|
200
|
+
target: 99,
|
|
201
|
+
unit: '%',
|
|
202
|
+
trend: 'up',
|
|
203
|
+
},
|
|
204
|
+
])
|
|
205
|
+
|
|
206
|
+
// Define OKRs
|
|
207
|
+
const quarterlyOKRs = okrs([
|
|
208
|
+
{
|
|
209
|
+
id: 'okr-1',
|
|
210
|
+
objective: 'Improve agent reliability',
|
|
211
|
+
keyResults: [
|
|
212
|
+
{ id: 'kr-1', description: 'Reduce error rate', current: 2, target: 0.5, unit: '%' },
|
|
213
|
+
{ id: 'kr-2', description: 'Increase uptime', current: 99.5, target: 99.9, unit: '%' },
|
|
214
|
+
],
|
|
215
|
+
period: 'Q1 2024',
|
|
216
|
+
status: 'active',
|
|
217
|
+
},
|
|
218
|
+
])
|
|
94
219
|
```
|
|
95
220
|
|
|
96
|
-
##
|
|
221
|
+
## Action Primitives
|
|
97
222
|
|
|
98
|
-
|
|
223
|
+
Standalone action functions:
|
|
99
224
|
|
|
100
|
-
|
|
225
|
+
```typescript
|
|
226
|
+
import { do as doTask, ask, decide, approve, generate, is, notify } from 'autonomous-agents'
|
|
101
227
|
|
|
102
|
-
|
|
228
|
+
// Execute a task
|
|
229
|
+
const result = await doTask('Analyze customer feedback', {
|
|
230
|
+
feedback: ['Great!', 'Needs work', 'Love it'],
|
|
231
|
+
})
|
|
103
232
|
|
|
104
|
-
|
|
233
|
+
// Ask a question
|
|
234
|
+
const answer = await ask('What are the key benefits?', { product: 'AI Assistant' })
|
|
105
235
|
|
|
106
|
-
|
|
236
|
+
// Make a decision
|
|
237
|
+
const choice = await decide(['React', 'Vue', 'Svelte'], 'Best framework for this project')
|
|
107
238
|
|
|
108
|
-
|
|
239
|
+
// Request approval
|
|
240
|
+
const approval = await approve({
|
|
241
|
+
title: 'Budget Request',
|
|
242
|
+
description: 'Request $50k for research',
|
|
243
|
+
data: { amount: 50000 },
|
|
244
|
+
approver: 'manager@company.com',
|
|
245
|
+
channel: 'slack',
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
// Generate content
|
|
249
|
+
const content = await generate({
|
|
250
|
+
schema: { title: 'string', body: 'string' },
|
|
251
|
+
prompt: 'Write a blog post about AI',
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
// Type validation
|
|
255
|
+
const isValid = await is({ email: 'test@example.com' }, 'valid email address')
|
|
256
|
+
|
|
257
|
+
// Send notification
|
|
258
|
+
await notify({
|
|
259
|
+
message: 'Task completed!',
|
|
260
|
+
channel: 'slack',
|
|
261
|
+
recipients: ['#general'],
|
|
262
|
+
})
|
|
263
|
+
```
|
|
109
264
|
|
|
110
|
-
|
|
265
|
+
## Role Definitions
|
|
111
266
|
|
|
112
|
-
|
|
267
|
+
Define agent capabilities through roles:
|
|
113
268
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
| actions | string[] | Actions that the agent can perform |
|
|
269
|
+
```typescript
|
|
270
|
+
import { Role, Roles, hasSkill, getPermissions } from 'autonomous-agents'
|
|
271
|
+
|
|
272
|
+
// Create a role
|
|
273
|
+
const securityAnalyst = Role({
|
|
274
|
+
name: 'Security Analyst',
|
|
275
|
+
description: 'Analyzes code for security vulnerabilities',
|
|
276
|
+
skills: ['security analysis', 'code review', 'vulnerability assessment'],
|
|
277
|
+
permissions: ['read-code', 'create-issues', 'request-changes'],
|
|
278
|
+
})
|
|
125
279
|
|
|
126
|
-
|
|
280
|
+
// Check capabilities
|
|
281
|
+
if (hasSkill(securityAnalyst, 'security analysis')) {
|
|
282
|
+
// Assign security review
|
|
283
|
+
}
|
|
127
284
|
|
|
128
|
-
|
|
285
|
+
// Common roles
|
|
286
|
+
const { ProductManager, SoftwareEngineer, DataAnalyst } = Roles
|
|
287
|
+
```
|
|
129
288
|
|
|
130
|
-
|
|
131
|
-
|-----------------|------|-------------|
|
|
132
|
-
| config | AgentConfig | The configuration of the agent |
|
|
133
|
-
| execute | (input: Record<string, any>, options?: any) => Promise<any> | Executes a custom operation |
|
|
134
|
-
| do | Proxy | A proxy for executing actions defined in the agent's configuration |
|
|
135
|
-
| [triggerName] | Function | Dynamic event handlers for each trigger defined in the agent's configuration |
|
|
289
|
+
## Type Reference
|
|
136
290
|
|
|
137
|
-
|
|
291
|
+
Key types exported:
|
|
138
292
|
|
|
139
|
-
-
|
|
140
|
-
-
|
|
293
|
+
- `Agent` / `AgentType` - Agent interface and configuration
|
|
294
|
+
- `AgentConfig` - Agent configuration options
|
|
295
|
+
- `AgentMode` - 'autonomous' | 'supervised' | 'manual'
|
|
296
|
+
- `Role` / `RoleType` - Role definitions
|
|
297
|
+
- `Team` / `TeamType` - Team composition
|
|
298
|
+
- `Goal` - Goal definitions
|
|
299
|
+
- `KPI` - Key Performance Indicators
|
|
300
|
+
- `OKR` - Objectives and Key Results
|
|
301
|
+
- `ApprovalRequest` / `ApprovalResult` - Approval workflow types
|
|
141
302
|
|
|
142
|
-
##
|
|
303
|
+
## Related Packages
|
|
143
304
|
|
|
144
|
-
|
|
305
|
+
- `digital-workers` - Common Worker interface for agents and humans
|
|
306
|
+
- `ai-workflows` - Event-driven workflow engine
|
|
307
|
+
- `human-in-the-loop` - Human oversight patterns
|
|
308
|
+
- `ai-functions` - AI function primitives
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actions - Core action functions for autonomous agents
|
|
3
|
+
*
|
|
4
|
+
* These are standalone functions that can be used independently
|
|
5
|
+
* or as part of an agent's capabilities.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { type AIGenerateOptions, type SimpleSchema } from 'ai-functions';
|
|
10
|
+
import type { ApprovalRequest, ApprovalResult, NotificationOptions } from './types.js';
|
|
11
|
+
/**
|
|
12
|
+
* Execute a task using AI
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { do as doTask } from 'autonomous-agents'
|
|
17
|
+
*
|
|
18
|
+
* const result = await doTask('Analyze customer feedback and provide insights', {
|
|
19
|
+
* feedback: ['Great product!', 'Needs improvement', 'Love the features'],
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function doAction<TResult = unknown>(task: string, context?: unknown, options?: AIGenerateOptions): Promise<TResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Ask a question and get an answer
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { ask } from 'autonomous-agents'
|
|
30
|
+
*
|
|
31
|
+
* const answer = await ask('What are the key benefits of our product?', {
|
|
32
|
+
* product: 'AI Assistant',
|
|
33
|
+
* features: ['smart automation', 'natural language', 'context awareness'],
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function ask<TResult = unknown>(question: string, context?: unknown, options?: AIGenerateOptions): Promise<TResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Make a decision between options
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { decide } from 'autonomous-agents'
|
|
44
|
+
*
|
|
45
|
+
* const choice = await decide(
|
|
46
|
+
* ['option A', 'option B', 'option C'],
|
|
47
|
+
* 'Which option has the highest ROI?'
|
|
48
|
+
* )
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function decide<T extends string>(options: T[], context?: string, settings?: AIGenerateOptions): Promise<T>;
|
|
52
|
+
/**
|
|
53
|
+
* Request approval for an action or decision
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { approve } from 'autonomous-agents'
|
|
58
|
+
*
|
|
59
|
+
* const approval = await approve({
|
|
60
|
+
* title: 'Budget Request',
|
|
61
|
+
* description: 'Request $50k for marketing campaign',
|
|
62
|
+
* data: { amount: 50000, campaign: 'Q1 Launch' },
|
|
63
|
+
* approver: 'manager@company.com',
|
|
64
|
+
* priority: 'high',
|
|
65
|
+
* })
|
|
66
|
+
*
|
|
67
|
+
* if (approval.status === 'approved') {
|
|
68
|
+
* // Proceed with the action
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function approve<TResult = unknown>(request: ApprovalRequest): Promise<ApprovalResult<TResult>>;
|
|
73
|
+
/**
|
|
74
|
+
* Execute approval request (internal implementation)
|
|
75
|
+
*/
|
|
76
|
+
export declare function executeApproval<TResult = unknown>(request: ApprovalRequest): Promise<ApprovalResult<TResult>>;
|
|
77
|
+
/**
|
|
78
|
+
* Generate content using AI
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { generate } from 'autonomous-agents'
|
|
83
|
+
*
|
|
84
|
+
* const content = await generate({
|
|
85
|
+
* model: 'sonnet',
|
|
86
|
+
* schema: {
|
|
87
|
+
* title: 'Blog post title',
|
|
88
|
+
* content: 'Blog post content',
|
|
89
|
+
* tags: ['List of tags'],
|
|
90
|
+
* },
|
|
91
|
+
* prompt: 'Write a blog post about AI automation',
|
|
92
|
+
* })
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare function generate<TResult = unknown>(options: AIGenerateOptions): Promise<TResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Type checking and validation
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { is } from 'autonomous-agents'
|
|
102
|
+
*
|
|
103
|
+
* const isValid = await is(
|
|
104
|
+
* { email: 'test@example.com' },
|
|
105
|
+
* 'valid email address'
|
|
106
|
+
* )
|
|
107
|
+
*
|
|
108
|
+
* const matchesSchema = await is(
|
|
109
|
+
* { name: 'John', age: 30 },
|
|
110
|
+
* { name: 'string', age: 'number' }
|
|
111
|
+
* )
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare function is(value: unknown, type: string | SimpleSchema): Promise<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* Send a notification
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { notify } from 'autonomous-agents'
|
|
121
|
+
*
|
|
122
|
+
* await notify({
|
|
123
|
+
* message: 'Task completed successfully!',
|
|
124
|
+
* channel: 'slack',
|
|
125
|
+
* recipients: ['#general'],
|
|
126
|
+
* priority: 'high',
|
|
127
|
+
* data: { taskId: '123', duration: '5 minutes' },
|
|
128
|
+
* })
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export declare function notify(options: NotificationOptions): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Export the 'do' function with an alias to avoid keyword conflict
|
|
134
|
+
*/
|
|
135
|
+
export { doAction as do };
|
|
136
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAkB,KAAK,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AACxF,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEd,mBAAmB,EACpB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;GAWG;AACH,wBAAsB,QAAQ,CAAC,OAAO,GAAG,OAAO,EAC9C,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,GAAG,CAAC,OAAO,GAAG,OAAO,EACzC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,OAAO,EACjB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,OAAO,CAAC,CAclB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,MAAM,EAC3C,OAAO,EAAE,CAAC,EAAE,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAoBZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,OAAO,CAAC,OAAO,GAAG,OAAO,EAC7C,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAElC;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,GAAG,OAAO,EACrD,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAkClC;AAiCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,QAAQ,CAAC,OAAO,GAAG,OAAO,EAC9C,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,EAAE,CACtB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,GAAG,YAAY,GAC1B,OAAO,CAAC,OAAO,CAAC,CAclB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BxE;AAiCD;;GAEG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,CAAA"}
|