@empyria/restate 0.4.23 → 0.4.24
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 +0 -37
- package/package.json +1 -1
- package/test/Admin.test.js +2 -2
package/README.md
CHANGED
|
@@ -61,43 +61,6 @@ point, so the root import never loads the AI SDK. It needs the optional peer dep
|
|
|
61
61
|
bun add ai @ai-sdk/openai-compatible @ai-sdk/provider
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
```js
|
|
65
|
-
import { defineAgent } from '@empyria/restate/agent'
|
|
66
|
-
|
|
67
|
-
export const triage = defineAgent({
|
|
68
|
-
name: 'CorporateActionTriage',
|
|
69
|
-
env: { LLM_BASE_URL: '', MODEL_ID: '' },
|
|
70
|
-
system: 'You triage corporate action notices.',
|
|
71
|
-
tools: {
|
|
72
|
-
// a Restate call to another building block
|
|
73
|
-
lookupIssuer: {
|
|
74
|
-
description: 'Look up an issuer by ISIN',
|
|
75
|
-
inputSchema: {
|
|
76
|
-
type: 'object',
|
|
77
|
-
properties: { isin: { type: 'string' } },
|
|
78
|
-
required: ['isin'],
|
|
79
|
-
},
|
|
80
|
-
block: 'IssuerService',
|
|
81
|
-
handler: 'get',
|
|
82
|
-
},
|
|
83
|
-
// a direct side effect in its own bounded ctx.run, gated by approval
|
|
84
|
-
notifyDesk: {
|
|
85
|
-
description: 'Notify the operations desk',
|
|
86
|
-
inputSchema: { type: 'object', properties: { message: { type: 'string' } } },
|
|
87
|
-
execute: async ({ message }, { idempotencyKey }) => sendToDesk(message, idempotencyKey),
|
|
88
|
-
approval: {
|
|
89
|
-
timeout: 4 * 3600_000,
|
|
90
|
-
notify: { block: 'ApprovalInbox', handler: 'request' },
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
output: TriageResultSchema, // the model answers through a final_answer tool
|
|
95
|
-
memory: 'none', // or 'session': a virtual object keyed by session, plus a reset handler
|
|
96
|
-
limits: { maxSteps: 8, maxTokens: 50_000 },
|
|
97
|
-
})
|
|
98
|
-
// register `triage` on your endpoint, then: POST /CorporateActionTriage/ask {"prompt": "…"}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
64
|
| Module | Purpose |
|
|
102
65
|
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
103
66
|
| [lib/agent/Agent.js](./lib/agent/Agent.js) | `defineAgent` — builds the service/object and its `ask` handler: validated I/O, `loadContext` that journals only the skill index, session memory (object state or an external `historyStore`), step/token budgets, invocation retry policy. `createAgentService` is the deprecated `AgentService` shortcut. |
|
package/package.json
CHANGED
package/test/Admin.test.js
CHANGED
|
@@ -180,10 +180,10 @@ describe('startSubWorkflow / callSubWorkflow', () => {
|
|
|
180
180
|
let sentArgs
|
|
181
181
|
/** @type {import('@restatedev/restate-sdk').Context} */
|
|
182
182
|
const plainServiceCtx = { genericSend: (args) => (sentArgs = args) ?? 'handle' }
|
|
183
|
-
startSubWorkflow(plainServiceCtx, '
|
|
183
|
+
startSubWorkflow(plainServiceCtx, 'DemoWorkflow', 'CA08841DVCA26', {
|
|
184
184
|
triggeredBy: 'swift-upstream-sort',
|
|
185
185
|
})
|
|
186
|
-
expect(sentArgs.service).toBe('
|
|
186
|
+
expect(sentArgs.service).toBe('DemoWorkflow')
|
|
187
187
|
expect(sentArgs.method).toBe('run')
|
|
188
188
|
expect(sentArgs.key).toBe('CA08841DVCA26')
|
|
189
189
|
})
|