@inkeep/agents-manage-api 0.0.0-chat-to-edit-20251119071712
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/LICENSE.md +56 -0
- package/README.md +174 -0
- package/SUPPLEMENTAL_TERMS.md +40 -0
- package/dist/index.cjs +6229 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +6223 -0
- package/package.json +76 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
|
|
3
|
+
Source: ./LICENSE.md
|
|
4
|
+
This file is automatically copied from the root LICENSE.md during build.
|
|
5
|
+
Any changes should be made to the root LICENSE.md file.
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Inkeep SDK – Elastic License 2.0 with Supplemental Terms
|
|
9
|
+
|
|
10
|
+
NOTE: The Inkeep SDK is licensed under the Elastic License 2.0 (ELv2), subject to Supplemental Terms included in [SUPPLEMENTAL_TERMS.md](SUPPLEMENTAL_TERMS.md). In the event of conflict, the Supplemental Terms control.
|
|
11
|
+
|
|
12
|
+
# Elastic License 2.0
|
|
13
|
+
|
|
14
|
+
## Acceptance
|
|
15
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
16
|
+
|
|
17
|
+
## Copyright License
|
|
18
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below.
|
|
19
|
+
|
|
20
|
+
## Limitations
|
|
21
|
+
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
|
22
|
+
|
|
23
|
+
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
|
24
|
+
|
|
25
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
26
|
+
|
|
27
|
+
## Patents
|
|
28
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
29
|
+
|
|
30
|
+
## Notices
|
|
31
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
32
|
+
|
|
33
|
+
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
34
|
+
|
|
35
|
+
## No Other Rights
|
|
36
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
37
|
+
|
|
38
|
+
## Termination
|
|
39
|
+
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
40
|
+
|
|
41
|
+
## No Liability
|
|
42
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
43
|
+
|
|
44
|
+
## Definitions
|
|
45
|
+
The **licensor** is the entity offering these terms, and the **software** is the software the licensor makes available under these terms, including any portion of it.
|
|
46
|
+
|
|
47
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
48
|
+
|
|
49
|
+
**your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
50
|
+
|
|
51
|
+
**your licenses** are all the licenses granted to you for the software under these terms.
|
|
52
|
+
|
|
53
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
54
|
+
|
|
55
|
+
**trademark** means trademarks, service marks, and similar rights.
|
|
56
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Inkeep Agents Manage API
|
|
2
|
+
|
|
3
|
+
The Agents Manage API is responsible for entity management and CRUD operations for the Inkeep Agent Framework. It provides the administrative layer for creating, configuring, and managing agents, graphs, tools, and projects.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This API handles the configuration and management layer:
|
|
8
|
+
- **Entity Management**: CRUD operations for all framework entities
|
|
9
|
+
- **Agent Configuration**: Agent creation, updates, and relationship management
|
|
10
|
+
- **Graph Management**: Agent graph definitions and topology
|
|
11
|
+
- **Tool Management**: MCP tool registration and configuration
|
|
12
|
+
- **Project Management**: Multi-tenant project organization
|
|
13
|
+
|
|
14
|
+
## Architecture
|
|
15
|
+
|
|
16
|
+
### Core Entities
|
|
17
|
+
|
|
18
|
+
- **Projects**: Top-level organizational units with tenant scoping
|
|
19
|
+
- **Agents**: Individual AI agents with instructions and capabilities
|
|
20
|
+
- **Agent Graphs**: Collections of agents with defined relationships
|
|
21
|
+
- **Agent Relations**: Transfer and delegation relationships between agents
|
|
22
|
+
- **Tools**: MCP servers and hosted tool configurations
|
|
23
|
+
- **Tasks**: Work units with hierarchical parent-child relationships
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
### Setup
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cd agents-run-api
|
|
31
|
+
pnpm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If you do not have the database setup, run migrations from the monorepo root:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm db:migrate
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Environment Variables
|
|
41
|
+
```env
|
|
42
|
+
ENVIRONMENT=development|production|test
|
|
43
|
+
PORT=3002
|
|
44
|
+
DATABASE_URL=pg_db_url
|
|
45
|
+
LOG_LEVEL=debug|info|warn|error
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Development Commands
|
|
49
|
+
```bash
|
|
50
|
+
pnpm dev # Start development server
|
|
51
|
+
pnpm test # Run test suite
|
|
52
|
+
pnpm test:coverage # Run tests with coverage
|
|
53
|
+
pnpm build # Build for production
|
|
54
|
+
pnpm lint # Run linting
|
|
55
|
+
pnpm format # Format code
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Database Operations
|
|
59
|
+
```bash
|
|
60
|
+
pnpm db:generate # Generate migration files from schema changes
|
|
61
|
+
pnpm db:migrate # Apply migration files to database
|
|
62
|
+
pnpm db:studio # Open Drizzle Studio for inspection
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Builder Patterns
|
|
66
|
+
|
|
67
|
+
The API provides builder patterns for programmatic entity creation:
|
|
68
|
+
|
|
69
|
+
### Agent Builder
|
|
70
|
+
```typescript
|
|
71
|
+
import { agent } from '@inkeep/agents-manage-api';
|
|
72
|
+
|
|
73
|
+
const qaAgent = agent({
|
|
74
|
+
id: 'qa-agent',
|
|
75
|
+
name: 'QA Agent',
|
|
76
|
+
instructions: 'Answer questions about our product',
|
|
77
|
+
canTransferTo: () => [routerAgent],
|
|
78
|
+
canDelegateTo: () => [searchAgent],
|
|
79
|
+
tools: { search: searchTool }
|
|
80
|
+
});
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Agent Builder
|
|
84
|
+
```typescript
|
|
85
|
+
import { agent } from '@inkeep/agents-sdk';
|
|
86
|
+
|
|
87
|
+
const myAgent = agent({
|
|
88
|
+
id: 'customer-support',
|
|
89
|
+
name: 'Customer Support Agent',
|
|
90
|
+
defaultSubAgent: routerAgent,
|
|
91
|
+
subAgents: () => [routerAgent, qaAgent, orderAgent]
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
await myAgent.init(); // Persist to database
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Tool Builder
|
|
98
|
+
```typescript
|
|
99
|
+
import { tool } from '@inkeep/agents-manage-api';
|
|
100
|
+
|
|
101
|
+
const searchTool = tool({
|
|
102
|
+
id: 'search-tool',
|
|
103
|
+
name: 'Product Search',
|
|
104
|
+
type: 'mcp',
|
|
105
|
+
config: {
|
|
106
|
+
command: 'search-server',
|
|
107
|
+
args: ['--index', 'products']
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Database Schema
|
|
113
|
+
|
|
114
|
+
The API uses SQLite with Drizzle ORM:
|
|
115
|
+
|
|
116
|
+
### Core Tables
|
|
117
|
+
- `projects` - Multi-tenant project organization
|
|
118
|
+
- `agents` - Agent definitions and instructions
|
|
119
|
+
- `agent_graphs` - Graph collections with default agents
|
|
120
|
+
- `agent_relations` - Transfer/delegation relationships
|
|
121
|
+
- `tools` - MCP tool configurations
|
|
122
|
+
- `tasks` - Execution history and hierarchy
|
|
123
|
+
|
|
124
|
+
### Key Patterns
|
|
125
|
+
- **Multi-tenancy**: All entities scoped by `tenant_id`
|
|
126
|
+
- **Relationships**: Foreign keys with cascade deletes
|
|
127
|
+
- **Timestamps**: `created_at`/`updated_at` on all entities
|
|
128
|
+
- **JSON Columns**: Complex configurations stored as JSON
|
|
129
|
+
|
|
130
|
+
## Validation
|
|
131
|
+
|
|
132
|
+
All API endpoints use Zod schemas for request/response validation:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
const createAgentSchema = z.object({
|
|
136
|
+
id: z.string().min(1),
|
|
137
|
+
name: z.string().min(1),
|
|
138
|
+
instructions: z.string().min(1),
|
|
139
|
+
tenantId: z.string(),
|
|
140
|
+
projectId: z.string()
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Integration
|
|
145
|
+
|
|
146
|
+
### With Agents Run API
|
|
147
|
+
The Agents Manage API provides the configuration that the Agents Run API reads during runtime. Changes to agents, graphs, or tools are immediately available to the execution layer.
|
|
148
|
+
|
|
149
|
+
### With Agents CLI
|
|
150
|
+
The Agents CLI uses the Agents Manage API for all `push` operations, creating and updating entities from configuration files.
|
|
151
|
+
|
|
152
|
+
### With Agents Manage UI
|
|
153
|
+
The Agents Manage UI provides a web interface for all Agents Manage API operations, offering visual agent and graph creation.
|
|
154
|
+
|
|
155
|
+
## Error Handling
|
|
156
|
+
|
|
157
|
+
- **Validation Errors**: Schema validation with detailed field errors
|
|
158
|
+
- **Constraint Errors**: Database constraint violations with helpful messages
|
|
159
|
+
- **Not Found Errors**: Resource-specific 404 responses
|
|
160
|
+
- **Conflict Errors**: Duplicate key and relationship conflicts
|
|
161
|
+
|
|
162
|
+
## Security
|
|
163
|
+
|
|
164
|
+
- **Multi-tenant Isolation**: All queries scoped by tenant ID
|
|
165
|
+
- **Input Validation**: Comprehensive request sanitization
|
|
166
|
+
- **SQL Injection Prevention**: Parameterized queries via Drizzle ORM
|
|
167
|
+
- **Authorization**: Configurable API key authentication
|
|
168
|
+
|
|
169
|
+
## Performance
|
|
170
|
+
|
|
171
|
+
- **Database Indexing**: Optimized indexes on frequently queried fields
|
|
172
|
+
- **Connection Pooling**: Efficient database connection management
|
|
173
|
+
- **Caching**: In-memory caching for frequently accessed entities
|
|
174
|
+
- **Parallel Operations**: Concurrent database operations where safe
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
|
|
3
|
+
Source: ./SUPPLEMENTAL_TERMS.md
|
|
4
|
+
This file is automatically copied from the root SUPPLEMENTAL_TERMS.md during build.
|
|
5
|
+
Any changes should be made to the root SUPPLEMENTAL_TERMS.md file.
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
# Inkeep SDK – Elastic License 2.0 with Supplemental Terms
|
|
9
|
+
|
|
10
|
+
The Inkeep [SDK] (the "Software") is licensed under the Elastic License 2.0 ("ELv2"), available at [https://www.elastic.co/licensing/elastic-license](https://www.elastic.co/licensing/elastic-license), subject to the supplemental terms below. By using the Software, you, your company, and your licensees agree to both ELv2 and these Supplemental Terms – for purposes of these Supplemental Terms, references to "you" have the same meaning as in ELv2 and include your company and contractors acting on your behalf. In the event of conflict, these Supplemental Terms control.
|
|
11
|
+
|
|
12
|
+
Any copy or redistribution of the Software must include both the ELv2 license reference and these Supplemental Terms.
|
|
13
|
+
|
|
14
|
+
## 1. Restrictions
|
|
15
|
+
|
|
16
|
+
### 1.1
|
|
17
|
+
You may not use the Software, directly or indirectly, to offer, enable, operate, or provide any Agent Builder.
|
|
18
|
+
|
|
19
|
+
### 1.2
|
|
20
|
+
You may not repackage, rebrand, or otherwise expose the Software's agent-creation or orchestration functionality for third-party use, including in specialized or verticalized offerings that present substantially similar functionality to the Software.
|
|
21
|
+
|
|
22
|
+
### 1.3
|
|
23
|
+
For clarity, the foregoing restrictions do not prohibit your use of the Software as Embedded Assistants or Professional Services, provided neither allow third parties to create, configure, train, orchestrate, deploy, or manage their own agents or agent workflows.
|
|
24
|
+
|
|
25
|
+
## 2. Definitions
|
|
26
|
+
|
|
27
|
+
### 2.1 Inkeep
|
|
28
|
+
**"Inkeep"** means Inkeep, Inc., a Delaware corporation with principal offices at 169 Madison Ave, Ste 2544, New York, NY, 10016, the licensor (as defined in ELv2) of the Software.
|
|
29
|
+
|
|
30
|
+
### 2.2 Agent Builder
|
|
31
|
+
**"Agent Builder"** means any hosted or on-premise product, platform, UI or API that allows third parties (e.g., customers, developers, or community users other than your personnel) to create, configure, compose, train, orchestrate, deploy, or manage their own Agents using the Software, or that otherwise exposes a substantial set of the Agent-creation and orchestration functionality of the Software.
|
|
32
|
+
|
|
33
|
+
### 2.3 Agents
|
|
34
|
+
**"Agents"** means autonomous, semi-autonomous, or automated systems — including assistants, copilots, workflows, orchestrations, or other systems powered by or incorporating artificial intelligence, machine learning, large language models, or related technologies.
|
|
35
|
+
|
|
36
|
+
### 2.4 Embedded Assistant
|
|
37
|
+
**"Embedded Assistant"** means embedding the Software in your own products or services to power a specific assistant/copilot/agent experience for you or your end users (e.g., a support bot in your app or an internal helpdesk agent), where end users do not receive access to any substantial set of the Software's agent-creation or orchestration features.
|
|
38
|
+
|
|
39
|
+
### 2.5 Professional Services
|
|
40
|
+
**"Professional Services"** means using the Software to deliver a bespoke solution to a single client where only your personnel operate the Software, the client receives access solely to the resulting assistant within the client's environment and not to the agent-creation/orchestration features of the Software, and no multi-tenant or self-service builder is provided.
|