@engini/sdk 0.5.0 → 0.5.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.
- package/README.md +60 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,64 @@
|
|
|
1
1
|
# @engini/sdk
|
|
2
2
|
|
|
3
|
-
Agent-first TypeScript SDK for the [Engini](https://engini.io) Public API
|
|
3
|
+
Agent-first TypeScript SDK for the [Engini](https://engini.io) Public API — discover tools,
|
|
4
|
+
execute them against your connected apps, and wrap them as LLM tool definitions.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
```bash
|
|
7
|
+
npm install @engini/sdk
|
|
8
|
+
```
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## Quickstart
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { Engini } from "@engini/sdk";
|
|
14
|
+
|
|
15
|
+
const client = new Engini({ apiKey: "eng_…" }); // or set ENGINI_API_KEY
|
|
16
|
+
|
|
17
|
+
// Discover canonical tool schemas
|
|
18
|
+
const tools = await client.tools.get({ applications: ["salesforce"], search: "accounts", limit: 5 });
|
|
19
|
+
|
|
20
|
+
// Execute a tool against a connection
|
|
21
|
+
const [{ connectionId }] = await client.connections.list("salesforce");
|
|
22
|
+
const result = await client.tools.execute(
|
|
23
|
+
"salesforce_getrecords",
|
|
24
|
+
{ sobject: "Account" },
|
|
25
|
+
{ connectionId },
|
|
26
|
+
);
|
|
27
|
+
console.log(result.output);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
JWT auth is the fallback: `new Engini({ token: "<jwt>", companyToken: "<id>" })`, or set
|
|
31
|
+
`ENGINI_API_TOKEN` / `ENGINI_COMPANY_TOKEN`. With an API key the company is bound to the key,
|
|
32
|
+
so no company token is needed. Point at another host with `new Engini({ …, baseUrl })`.
|
|
33
|
+
|
|
34
|
+
## Use with an LLM
|
|
35
|
+
|
|
36
|
+
`Provider` adapters wrap canonical schemas into vendor tool definitions **client-side, with no
|
|
37
|
+
vendor SDK dependency**. OpenAI is the default; Anthropic is also available.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
// Bind applications → connections once, then drive a tool-calling loop
|
|
41
|
+
const toolset = client.toolset({
|
|
42
|
+
tools: ["salesforce_getrecords"],
|
|
43
|
+
connections: { salesforce: "Prod" },
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const openaiTools = client.provider.wrapTools(await toolset.tools()); // plain OpenAI tool-JSON
|
|
47
|
+
// … send openaiTools to the model, get a response …
|
|
48
|
+
const results = await toolset.handleToolCalls(llmResponse); // runs the calls, returns results
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`client.toolset(...)` builds a local toolset (no I/O until used) or loads a server one via
|
|
52
|
+
`client.toolset({ toolsetId })`.
|
|
53
|
+
|
|
54
|
+
## What this adds over the raw REST client
|
|
55
|
+
|
|
56
|
+
Built on the autogenerated [`@engini/client`](https://www.npmjs.com/package/@engini/client), the
|
|
57
|
+
SDK adds what the generated client deliberately lacks: typed errors (the `EnginiError` family),
|
|
58
|
+
retry/backoff, auto-pagination, pluggable auth (`ApiKeyAuth` / `BearerAuth`), `Provider`
|
|
59
|
+
adapters for OpenAI/Anthropic, and the ergonomic `Toolset` object.
|
|
60
|
+
|
|
61
|
+
There's also a machine-first CLI, [`@engini/cli`](https://www.npmjs.com/package/@engini/cli),
|
|
62
|
+
built on this SDK.
|
|
63
|
+
|
|
64
|
+
Source & docs: <https://github.com/engini/engini-sdk>
|