autonomous-agents 0.1.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.
Files changed (2) hide show
  1. package/README.md +144 -0
  2. package/package.json +43 -0
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # autonomous-agents
2
+
3
+ [![npm version](https://img.shields.io/npm/v/autonomous-agents.svg)](https://www.npmjs.com/package/autonomous-agents)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A function-based Agent API for inherently autonomous agents. This package provides a simple, elegant way to create and manage autonomous agents that can perform actions, respond to events, and integrate with external services.
7
+
8
+ ## Purpose
9
+
10
+ The `autonomous-agents` package embodies the definition of agents as "inherently autonomous" by providing a function-based API that:
11
+
12
+ - Simplifies agent creation and configuration
13
+ - Enables autonomous execution of actions based on triggers
14
+ - Facilitates integration with external services
15
+ - Monitors key performance indicators
16
+ - Handles errors gracefully in an autonomous context
17
+
18
+ ## How It Differs from agents.do SDK
19
+
20
+ The `autonomous-agents` package represents a transition from the class-based approach used in the existing agents.do SDK to a more modern, function-based API. Key differences include:
21
+
22
+ - **Function-based API**: Uses a functional approach instead of classes, aligning with modern JavaScript/TypeScript practices
23
+ - **Simplified Configuration**: Provides a more intuitive configuration interface
24
+ - **Enhanced Autonomy**: Built with autonomy as a core principle rather than an add-on feature
25
+ - **Improved Error Handling**: Designed with robust error handling for autonomous operations
26
+ - **Performance Monitoring**: Integrated tracking of key results and performance metrics
27
+
28
+ ## Installation
29
+
30
+ ```bash
31
+ # Using npm
32
+ npm install autonomous-agents
33
+
34
+ # Using yarn
35
+ yarn add autonomous-agents
36
+
37
+ # Using pnpm
38
+ pnpm add autonomous-agents
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ### Basic Usage
44
+
45
+ ```typescript
46
+ import { Agent } from 'autonomous-agents'
47
+
48
+ // Create a customer support agent
49
+ const amy = Agent({
50
+ name: 'Amy',
51
+ url: 'https://amy.do',
52
+ role: 'Customer Support Agent',
53
+ objective: 'Handles customer inquiries and resolves common issues',
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'],
59
+ })
60
+ ```
61
+
62
+ ### Executing Actions
63
+
64
+ ```typescript
65
+ // Execute an action using the 'do' proxy
66
+ const result = await amy.do('sendMessage', {
67
+ recipient: 'customer@example.com',
68
+ subject: 'Order Status Update',
69
+ body: 'Your order has been shipped and will arrive in 2-3 business days.'
70
+ })
71
+
72
+ // Execute a custom operation
73
+ const customResult = await amy.execute({
74
+ operation: 'processRefund',
75
+ orderId: '12345',
76
+ amount: 99.99,
77
+ reason: 'Customer request'
78
+ })
79
+ ```
80
+
81
+ ### Handling Events
82
+
83
+ ```typescript
84
+ // Set up an event handler for a trigger
85
+ amy.onTicketCreated(async (ticket) => {
86
+ console.log(`New ticket created: ${ticket.id}`)
87
+
88
+ // Automatically respond to the ticket
89
+ await amy.do('sendMessage', {
90
+ ticketId: ticket.id,
91
+ message: 'Thank you for your inquiry. We will respond shortly.'
92
+ })
93
+ })
94
+ ```
95
+
96
+ ## API Reference
97
+
98
+ ### Agent(config)
99
+
100
+ Creates a new autonomous agent with the provided configuration.
101
+
102
+ **Parameters:**
103
+
104
+ - `config` (AgentConfig): The configuration for the agent
105
+
106
+ **Returns:**
107
+
108
+ - (AutonomousAgent): An autonomous agent instance
109
+
110
+ ### AgentConfig
111
+
112
+ The configuration object for creating an agent.
113
+
114
+ | Property | Type | Description |
115
+ |----------|------|-------------|
116
+ | name | string | The name of the agent |
117
+ | url | string | The URL associated with the agent |
118
+ | role | string | The role or purpose of the agent |
119
+ | objective | string | The main objective or goal of the agent |
120
+ | keyResults | string[] | Key performance indicators for the agent |
121
+ | integrations | string[] | External services the agent can integrate with |
122
+ | triggers | string[] | Events that the agent can respond to |
123
+ | searches | string[] | Types of searches the agent can perform |
124
+ | actions | string[] | Actions that the agent can perform |
125
+
126
+ ### AutonomousAgent
127
+
128
+ The agent instance returned by the Agent function.
129
+
130
+ | Property/Method | Type | Description |
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 |
136
+
137
+ ## Dependencies
138
+
139
+ - TypeScript: For type safety and developer experience
140
+ - No external runtime dependencies, ensuring a lightweight package
141
+
142
+ ## License
143
+
144
+ MIT
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "autonomous-agents",
3
+ "version": "0.1.0",
4
+ "description": "Function-based Agent API for inherently autonomous agents",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "keywords": [
12
+ "agent",
13
+ "autonomous",
14
+ "ai"
15
+ ],
16
+ "author": "Drivly",
17
+ "license": "MIT",
18
+ "devDependencies": {
19
+ "tsup": "^8.0.0",
20
+ "typescript": "^5.0.0",
21
+ "vitest": "^3.1.3"
22
+ },
23
+ "tsup": {
24
+ "entry": [
25
+ "src/index.ts"
26
+ ],
27
+ "format": [
28
+ "cjs",
29
+ "esm"
30
+ ],
31
+ "dts": true,
32
+ "splitting": false,
33
+ "sourcemap": true,
34
+ "clean": true
35
+ },
36
+ "scripts": {
37
+ "build": "tsup",
38
+ "dev": "tsup --watch",
39
+ "lint": "eslint src/**/*.ts",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest"
42
+ }
43
+ }