@elqnt/agents 3.0.0 → 3.0.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.
Files changed (2) hide show
  1. package/README.md +240 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,240 @@
1
+ # @elqnt/agents
2
+
3
+ Agent management SDK for the Eloquent platform. Provides TypeScript types, browser and server APIs, and React hooks for working with AI agents, skills, tool definitions, and jobs.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @elqnt/agents
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### Browser (React)
14
+
15
+ ```tsx
16
+ import { useAgents, useSkills, useToolDefinitions } from "@elqnt/agents/hooks";
17
+
18
+ function AgentManager() {
19
+ const { listAgents, createAgent, loading, error } = useAgents({
20
+ baseUrl: process.env.NEXT_PUBLIC_API_GATEWAY_URL!,
21
+ orgId: currentOrgId,
22
+ });
23
+
24
+ const { listSkills } = useSkills({
25
+ baseUrl: process.env.NEXT_PUBLIC_API_GATEWAY_URL!,
26
+ orgId: currentOrgId,
27
+ });
28
+
29
+ // List all agents
30
+ const agents = await listAgents();
31
+
32
+ // Create a new agent
33
+ const newAgent = await createAgent({
34
+ name: "Customer Support",
35
+ description: "Handles customer inquiries",
36
+ model: "claude-3-sonnet",
37
+ });
38
+ }
39
+ ```
40
+
41
+ ### Server Actions
42
+
43
+ ```ts
44
+ // In a Next.js server action
45
+ "use server";
46
+
47
+ import { listAgentsServer, createAgentServer } from "@elqnt/agents/api/server";
48
+
49
+ export async function getAgents(orgId: string) {
50
+ const response = await listAgentsServer({
51
+ gatewayUrl: process.env.API_GATEWAY_URL!,
52
+ jwtSecret: process.env.JWT_SECRET!,
53
+ orgId,
54
+ });
55
+ return response.data?.agents || [];
56
+ }
57
+
58
+ export async function createNewAgent(orgId: string, name: string) {
59
+ const response = await createAgentServer(
60
+ { name, model: "claude-3-sonnet" },
61
+ {
62
+ gatewayUrl: process.env.API_GATEWAY_URL!,
63
+ jwtSecret: process.env.JWT_SECRET!,
64
+ orgId,
65
+ }
66
+ );
67
+ return response.data?.agent;
68
+ }
69
+ ```
70
+
71
+ ## Exports
72
+
73
+ | Import Path | Description |
74
+ |-------------|-------------|
75
+ | `@elqnt/agents` | All exports (types, API, hooks) |
76
+ | `@elqnt/agents/api` | Browser API functions |
77
+ | `@elqnt/agents/api/server` | Server API functions |
78
+ | `@elqnt/agents/hooks` | React hooks |
79
+ | `@elqnt/agents/models` | TypeScript types |
80
+
81
+ ## API Reference
82
+
83
+ ### Browser API (`@elqnt/agents/api`)
84
+
85
+ #### Agents
86
+ | Function | Description |
87
+ |----------|-------------|
88
+ | `listAgentsApi(options)` | List all agents |
89
+ | `getAgentApi(agentId, options)` | Get agent by ID |
90
+ | `createAgentApi(agent, options)` | Create a new agent |
91
+ | `updateAgentApi(agentId, agent, options)` | Update an agent |
92
+ | `deleteAgentApi(agentId, options)` | Delete an agent |
93
+ | `getDefaultAgentApi(options)` | Get the default agent |
94
+
95
+ #### Skills
96
+ | Function | Description |
97
+ |----------|-------------|
98
+ | `listSkillsApi(options)` | List all skills |
99
+ | `getSkillApi(skillId, options)` | Get skill by ID |
100
+ | `createSkillApi(skill, options)` | Create a new skill |
101
+ | `updateSkillApi(skillId, skill, options)` | Update a skill |
102
+ | `deleteSkillApi(skillId, options)` | Delete a skill |
103
+ | `getSkillCategoriesApi(options)` | Get skill categories |
104
+
105
+ #### Tool Definitions
106
+ | Function | Description |
107
+ |----------|-------------|
108
+ | `listToolDefinitionsApi(options)` | List tool definitions |
109
+ | `getToolDefinitionApi(id, options)` | Get tool definition by ID |
110
+ | `createToolDefinitionApi(toolDef, options)` | Create tool definition |
111
+ | `updateToolDefinitionApi(id, toolDef, options)` | Update tool definition |
112
+ | `deleteToolDefinitionApi(id, options)` | Delete tool definition |
113
+
114
+ #### Agent Jobs
115
+ | Function | Description |
116
+ |----------|-------------|
117
+ | `listAgentJobsApi(options)` | List agent jobs |
118
+ | `getAgentJobApi(jobId, options)` | Get job by ID |
119
+ | `createAgentJobApi(job, options)` | Create a job |
120
+ | `updateAgentJobApi(jobId, job, options)` | Update a job |
121
+ | `deleteAgentJobApi(jobId, options)` | Delete a job |
122
+ | `pauseAgentJobApi(jobId, options)` | Pause a job |
123
+ | `resumeAgentJobApi(jobId, options)` | Resume a job |
124
+
125
+ ### Server API (`@elqnt/agents/api/server`)
126
+
127
+ All browser API functions have server equivalents with `Server` suffix:
128
+ - `listAgentsServer`, `getAgentServer`, `createAgentServer`, etc.
129
+ - `listSkillsServer`, `getSkillServer`, `createSkillServer`, etc.
130
+ - `listToolDefinitionsServer`, `getToolDefinitionServer`, etc.
131
+ - `listAgentJobsServer`, `pauseAgentJobServer`, `resumeAgentJobServer`, etc.
132
+
133
+ ### React Hooks (`@elqnt/agents/hooks`)
134
+
135
+ #### `useAgents(options)`
136
+ ```tsx
137
+ const {
138
+ loading,
139
+ error,
140
+ listAgents, // () => Promise<Agent[]>
141
+ listAgentSummaries,// () => Promise<AgentSummary[]>
142
+ getAgent, // (id) => Promise<Agent | null>
143
+ createAgent, // (agent) => Promise<Agent | null>
144
+ updateAgent, // (id, agent) => Promise<Agent | null>
145
+ deleteAgent, // (id) => Promise<boolean>
146
+ getDefaultAgent, // () => Promise<Agent | null>
147
+ } = useAgents(options);
148
+ ```
149
+
150
+ #### `useSkills(options)`
151
+ ```tsx
152
+ const {
153
+ loading,
154
+ error,
155
+ listSkills, // () => Promise<Skill[]>
156
+ getSkill, // (id) => Promise<Skill | null>
157
+ createSkill, // (skill) => Promise<Skill | null>
158
+ updateSkill, // (id, skill) => Promise<Skill | null>
159
+ deleteSkill, // (id) => Promise<boolean>
160
+ getCategories, // () => Promise<string[]>
161
+ } = useSkills(options);
162
+ ```
163
+
164
+ #### `useToolDefinitions(options)`
165
+ ```tsx
166
+ const {
167
+ loading,
168
+ error,
169
+ listToolDefinitions, // () => Promise<ToolDefinition[]>
170
+ getToolDefinition, // (id) => Promise<ToolDefinition | null>
171
+ getToolDefinitionsByIds, // (ids) => Promise<ToolDefinition[]>
172
+ createToolDefinition, // (def) => Promise<ToolDefinition | null>
173
+ updateToolDefinition, // (id, def) => Promise<ToolDefinition | null>
174
+ deleteToolDefinition, // (id) => Promise<boolean>
175
+ } = useToolDefinitions(options);
176
+ ```
177
+
178
+ #### `useAgentJobs(options)`
179
+ ```tsx
180
+ const {
181
+ loading,
182
+ error,
183
+ listAgentJobs, // () => Promise<AgentJob[]>
184
+ getAgentJob, // (id) => Promise<AgentJob | null>
185
+ createAgentJob, // (job) => Promise<AgentJob | null>
186
+ updateAgentJob, // (id, job) => Promise<AgentJob | null>
187
+ deleteAgentJob, // (id) => Promise<boolean>
188
+ pauseAgentJob, // (id) => Promise<AgentJob | null>
189
+ resumeAgentJob, // (id) => Promise<AgentJob | null>
190
+ } = useAgentJobs(options);
191
+ ```
192
+
193
+ #### `useWidgets(options)`
194
+ ```tsx
195
+ const {
196
+ loading,
197
+ error,
198
+ listWidgets, // () => Promise<AgentWidget[]>
199
+ getWidget, // (id) => Promise<AgentWidget | null>
200
+ getDefaultWidget, // () => Promise<AgentWidget | null>
201
+ createWidget, // (widget) => Promise<AgentWidget | null>
202
+ updateWidget, // (id, widget) => Promise<AgentWidget | null>
203
+ deleteWidget, // (id) => Promise<boolean>
204
+ setDefaultWidget, // (id) => Promise<boolean>
205
+ } = useWidgets({ ...options, agentId });
206
+ ```
207
+
208
+ ### Hook Utilities
209
+
210
+ For advanced usage, the package exports hook factory utilities:
211
+
212
+ ```tsx
213
+ import { useApiAsync, useOptionsRef } from "@elqnt/agents/hooks";
214
+
215
+ // useApiAsync - Generic async hook with loading/error handling
216
+ const { execute, loading, error } = useApiAsync(
217
+ (id: string) => getAgentApi(id, options),
218
+ (data) => data.agent,
219
+ null
220
+ );
221
+
222
+ // useOptionsRef - Keeps options in sync without stale closures
223
+ const optionsRef = useOptionsRef(options);
224
+ ```
225
+
226
+ ## Types (`@elqnt/agents/models`)
227
+
228
+ ```typescript
229
+ // Core types
230
+ interface Agent { id, name, description, model, skills, ... }
231
+ interface Skill { id, name, description, category, ... }
232
+ interface ToolDefinition { id, name, description, schema, ... }
233
+ interface AgentJob { id, agentId, status, frequency, ... }
234
+ interface AgentWidget { id, agentId, name, config, ... }
235
+ interface SubAgent { id, name, description, ... }
236
+ ```
237
+
238
+ ## License
239
+
240
+ Private - Eloquent Platform
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elqnt/agents",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
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",