@ariacompute/agent 0.17.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 +70 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# `@ariacompute/agent`
|
|
2
|
+
|
|
3
|
+
The Aria agent SDK for TypeScript/JavaScript. The API mirrors the
|
|
4
|
+
[OpenAI Agents SDK](https://developers.openai.com/api/docs/guides/agents/quickstart)
|
|
5
|
+
(`Agent`, `run`, `runStreamed`, `tool`, `Session`) and talks to an
|
|
6
|
+
`aria-agent-cloud` deployment through its **beta Agents** REST API.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @ariacompute/agent
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { Agent, run, tool } from "@ariacompute/agent";
|
|
14
|
+
|
|
15
|
+
const historyFunFact = tool({
|
|
16
|
+
name: "history_fun_fact",
|
|
17
|
+
description: "Return a short history fact.",
|
|
18
|
+
parameters: { type: "object", properties: {} },
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const agent = new Agent({
|
|
22
|
+
name: "History tutor",
|
|
23
|
+
instructions: "Answer history questions clearly and concisely.",
|
|
24
|
+
model: "gpt-4o-mini",
|
|
25
|
+
tools: [historyFunFact],
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const result = await run(agent, "When did the Roman Empire fall?");
|
|
29
|
+
console.log(result.finalOutput); // -> "476 AD"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Streaming
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const streamed = await runStreamed(agent, "Tell me something surprising");
|
|
36
|
+
for await (const ev of streamed.events) {
|
|
37
|
+
if (ev.type === "agent.turn.output_text.delta") process.stdout.write(ev.delta);
|
|
38
|
+
}
|
|
39
|
+
const result = await streamed.completed;
|
|
40
|
+
console.log(result.finalOutput);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Frames use the `agent.*` envelope: `agent.turn.created`, `agent.turn.in_progress`,
|
|
44
|
+
`agent.turn.item.added`, `agent.turn.item.done`, `agent.turn.output_text.delta`,
|
|
45
|
+
`agent.turn.output_text.done`, `agent.turn.completed` / `agent.turn.failed`.
|
|
46
|
+
`agent.turn.completed` (or `agent.turn.failed`) is the **only** terminal event —
|
|
47
|
+
there is no `data: [DONE]` sentinel.
|
|
48
|
+
|
|
49
|
+
## Sessions
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
const session = await Session.create(agent);
|
|
53
|
+
await run(agent, "hello", { session });
|
|
54
|
+
await run(agent, "and then?", { session }); // continues the same conversation
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Configuration
|
|
58
|
+
|
|
59
|
+
| Option | Environment variable | Default |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| `baseUrl` | `ARIA_AGENT_BASE_URL` | `http://localhost:3000` |
|
|
62
|
+
| `apiKey` | `ARIA_AGENT_API_KEY` | _(none)_ |
|
|
63
|
+
| `betaHeader` | – | `agents=v1` (`OpenAI-Beta`) |
|
|
64
|
+
|
|
65
|
+
## Tests
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
bun test # or: npm test
|
|
69
|
+
npm run typecheck
|
|
70
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ariacompute/agent",
|
|
3
|
+
"version": "0.17.1",
|
|
4
|
+
"description": "Aria agent SDK — mirrors the OpenAI Agents SDK shape (Agent / run / runStreamed / tool / Session) on top of the aria-agent-cloud beta Agents API.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json",
|
|
22
|
+
"test": "bun test",
|
|
23
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"agent",
|
|
27
|
+
"agents-sdk",
|
|
28
|
+
"aria",
|
|
29
|
+
"ariacompute",
|
|
30
|
+
"openai"
|
|
31
|
+
],
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.10.2",
|
|
34
|
+
"typescript": "^5.6.0"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18"
|
|
38
|
+
}
|
|
39
|
+
}
|