@elqnt/agents 3.0.3 → 3.0.4
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 +196 -0
- package/package.json +4 -4
package/README.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# @elqnt/agents
|
|
2
|
+
|
|
3
|
+
AI agent management for Eloquent platform - models, API, hooks, and utilities.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @elqnt/agents
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### Provisioning Agents (Admin)
|
|
14
|
+
|
|
15
|
+
Use `provisionAgentsApi` to set up default agents for an organization:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { provisionAgentsApi } from "@elqnt/agents/api";
|
|
19
|
+
import type { DefaultDefinitions } from "@elqnt/agents/models";
|
|
20
|
+
|
|
21
|
+
const definitions: DefaultDefinitions = {
|
|
22
|
+
agents: [{
|
|
23
|
+
orgId: "org-uuid",
|
|
24
|
+
name: "support-agent",
|
|
25
|
+
title: "Support Agent",
|
|
26
|
+
description: "Customer support AI assistant",
|
|
27
|
+
provider: "azure-openai",
|
|
28
|
+
model: "gpt-4.1-mini",
|
|
29
|
+
type: "chat",
|
|
30
|
+
status: "active",
|
|
31
|
+
systemPrompt: "You are a helpful support agent...",
|
|
32
|
+
isDefault: true,
|
|
33
|
+
}],
|
|
34
|
+
toolDefinitions: [],
|
|
35
|
+
subAgents: [],
|
|
36
|
+
skills: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const result = await provisionAgentsApi([definitions], {
|
|
40
|
+
baseUrl: "https://api.elqnt.ai",
|
|
41
|
+
orgId: "org-uuid",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (result.data?.success) {
|
|
45
|
+
console.log(`Created ${result.data.agentsCreated} agents`);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Using Agents Hook
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { useAgents } from "@elqnt/agents/hooks";
|
|
53
|
+
|
|
54
|
+
function AgentList() {
|
|
55
|
+
const { agents, loading, error, createAgent, updateAgent } = useAgents({
|
|
56
|
+
baseUrl: config.apiGatewayUrl,
|
|
57
|
+
orgId: config.orgId,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (loading) return <Spinner />;
|
|
61
|
+
if (error) return <Error message={error} />;
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<ul>
|
|
65
|
+
{agents.map(agent => (
|
|
66
|
+
<li key={agent.id}>{agent.title}</li>
|
|
67
|
+
))}
|
|
68
|
+
</ul>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Exports
|
|
74
|
+
|
|
75
|
+
### `/api` - API Functions
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import {
|
|
79
|
+
// Agents
|
|
80
|
+
listAgentsApi,
|
|
81
|
+
getAgentApi,
|
|
82
|
+
createAgentApi,
|
|
83
|
+
updateAgentApi,
|
|
84
|
+
deleteAgentApi,
|
|
85
|
+
getDefaultAgentApi,
|
|
86
|
+
|
|
87
|
+
// Skills
|
|
88
|
+
listSkillsApi,
|
|
89
|
+
getSkillApi,
|
|
90
|
+
createSkillApi,
|
|
91
|
+
updateSkillApi,
|
|
92
|
+
deleteSkillApi,
|
|
93
|
+
|
|
94
|
+
// Sub-agents
|
|
95
|
+
listSubAgentsApi,
|
|
96
|
+
getSubAgentApi,
|
|
97
|
+
createSubAgentApi,
|
|
98
|
+
|
|
99
|
+
// Tool Definitions
|
|
100
|
+
listToolDefinitionsApi,
|
|
101
|
+
getToolDefinitionApi,
|
|
102
|
+
createToolDefinitionApi,
|
|
103
|
+
|
|
104
|
+
// Widgets
|
|
105
|
+
listWidgetsApi,
|
|
106
|
+
createWidgetApi,
|
|
107
|
+
updateWidgetApi,
|
|
108
|
+
|
|
109
|
+
// Provisioning
|
|
110
|
+
provisionAgentsApi,
|
|
111
|
+
} from "@elqnt/agents/api";
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### `/hooks` - React Hooks
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { useAgents, useSkills } from "@elqnt/agents/hooks";
|
|
118
|
+
|
|
119
|
+
const { agents, loading, error, createAgent } = useAgents(options);
|
|
120
|
+
const { skills, loading, error } = useSkills(options);
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### `/models` - TypeScript Types
|
|
124
|
+
|
|
125
|
+
Types generated from Go via tygo.
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
import type {
|
|
129
|
+
Agent,
|
|
130
|
+
AgentSummary,
|
|
131
|
+
Skill,
|
|
132
|
+
SubAgent,
|
|
133
|
+
ToolDefinition,
|
|
134
|
+
AgentWidget,
|
|
135
|
+
DefaultDefinitions,
|
|
136
|
+
AgentProvisionDefinition,
|
|
137
|
+
} from "@elqnt/agents/models";
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### `/utils` - Utilities
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import { toDefaultDefinitions } from "@elqnt/agents/utils";
|
|
144
|
+
|
|
145
|
+
// Convert single agent provision to DefaultDefinitions format
|
|
146
|
+
const provision: AgentProvisionDefinition = {
|
|
147
|
+
agent: { ... },
|
|
148
|
+
tools: [...],
|
|
149
|
+
subAgents: [...],
|
|
150
|
+
skills: [...],
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const definitions = toDefaultDefinitions(provision);
|
|
154
|
+
// { agents: [...], toolDefinitions: [...], subAgents: [...], skills: [...] }
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Type Reference
|
|
158
|
+
|
|
159
|
+
### DefaultDefinitions
|
|
160
|
+
|
|
161
|
+
The format expected by the provisioning API:
|
|
162
|
+
|
|
163
|
+
```typescript
|
|
164
|
+
interface DefaultDefinitions {
|
|
165
|
+
agents: Agent[];
|
|
166
|
+
toolDefinitions: ToolDefinition[];
|
|
167
|
+
subAgents: SubAgent[];
|
|
168
|
+
skills: Skill[];
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### AgentProvisionDefinition
|
|
173
|
+
|
|
174
|
+
Convenience type for single-agent provisioning:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
interface AgentProvisionDefinition {
|
|
178
|
+
agent: Agent;
|
|
179
|
+
tools?: ToolDefinition[];
|
|
180
|
+
subAgents?: SubAgent[];
|
|
181
|
+
skills?: Skill[];
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Use `toDefaultDefinitions()` to convert to API format.
|
|
186
|
+
|
|
187
|
+
## API Options
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
interface ApiClientOptions {
|
|
191
|
+
baseUrl: string; // API Gateway URL
|
|
192
|
+
orgId: string; // Organization ID
|
|
193
|
+
userId?: string; // Optional user ID
|
|
194
|
+
userEmail?: string; // Optional user email
|
|
195
|
+
}
|
|
196
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elqnt/agents",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "Agent management and orchestration for Eloquent platform - models, browser & server APIs, React hooks, and utilities",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"directory": "packages/agents"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@elqnt/types": "2.0.
|
|
50
|
-
"@elqnt/api-client": "1.0.
|
|
49
|
+
"@elqnt/types": "2.0.10",
|
|
50
|
+
"@elqnt/api-client": "1.0.4",
|
|
51
51
|
"@elqnt/kg": "3.0.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react": "^19.0.0",
|
|
59
59
|
"tsup": "^8.0.0",
|
|
60
60
|
"typescript": "^5.0.0",
|
|
61
|
-
"@elqnt/api-client": "1.0.
|
|
61
|
+
"@elqnt/api-client": "1.0.4"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"build": "tsup",
|