@orkestrel/agent 0.0.35 → 0.0.37
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 +9 -2
- package/dist/src/core/index.cjs +2115 -609
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +2059 -255
- package/dist/src/core/index.d.ts +2059 -255
- package/dist/src/core/index.js +2066 -611
- package/dist/src/core/index.js.map +1 -1
- package/package.json +23 -23
package/README.md
CHANGED
|
@@ -34,7 +34,8 @@ The package targets the following runtime and module formats:
|
|
|
34
34
|
The following example builds an agent with one tool and streams a turn:
|
|
35
35
|
|
|
36
36
|
```ts
|
|
37
|
-
import { createAgent } from '@orkestrel/agent'
|
|
37
|
+
import { createAgent, createAuthority } from '@orkestrel/agent'
|
|
38
|
+
import { numberShape, objectShape } from '@orkestrel/contract'
|
|
38
39
|
import { createTool, createToolManager } from '@orkestrel/tool'
|
|
39
40
|
|
|
40
41
|
const tools = createToolManager()
|
|
@@ -42,12 +43,18 @@ tools.add(
|
|
|
42
43
|
createTool({
|
|
43
44
|
name: 'add',
|
|
44
45
|
description: 'Add two numbers',
|
|
46
|
+
contract: objectShape({ a: numberShape(), b: numberShape() }),
|
|
45
47
|
execute: (args) => Number(args.a) + Number(args.b),
|
|
46
48
|
}),
|
|
47
49
|
)
|
|
48
50
|
|
|
49
51
|
// `provider` is your ProviderInterface implementation (see the guide)
|
|
50
|
-
|
|
52
|
+
// Tools need an authority: this one allows every call; rules with a deny fallback make an allowlist.
|
|
53
|
+
const agent = createAgent(provider, {
|
|
54
|
+
system: 'You are concise.',
|
|
55
|
+
tools,
|
|
56
|
+
authority: createAuthority({ fallback: { zone: 'default', verdict: 'allow' } }),
|
|
57
|
+
})
|
|
51
58
|
agent.context.messages.add({ role: 'user', content: 'Say hi.' })
|
|
52
59
|
|
|
53
60
|
const stream = agent.stream()
|