@orkestrel/agent 0.0.34 → 0.0.36

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 CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  Build an agent with the `createAgent` function over a `ProviderInterface` implementation,
10
10
  seed the conversation through `agent.context.messages`, then run the turn as a one-shot
11
- `generate` or a live `stream`. Extend the `AgentProvider` class to reach a new wire, or
11
+ `generate` or a live `stream`. Extend the `AgentProvider` class to reach another wire, or
12
12
  compose the `createRelayProvider` and `createRelay` functions to reach a model through your
13
13
  own server. Callable tools come from `@orkestrel/tool` and documents from
14
14
  `@orkestrel/workspace`. Part of the `@orkestrel` line.
@@ -25,7 +25,8 @@ npm install @orkestrel/agent
25
25
 
26
26
  The package targets the following runtime and module formats:
27
27
 
28
- - Node.js >= 22.12.0
28
+ - Node.js >= 22.18.0
29
+ - A browser that provides the APIs the Agent guide's inlet table note names, in a secure context
29
30
  - Dual ESM + CommonJS builds (`import` and `require` both supported)
30
31
 
31
32
  ## Usage
@@ -33,7 +34,8 @@ The package targets the following runtime and module formats:
33
34
  The following example builds an agent with one tool and streams a turn:
34
35
 
35
36
  ```ts
36
- import { createAgent } from '@orkestrel/agent'
37
+ import { createAgent, createAuthority } from '@orkestrel/agent'
38
+ import { numberShape, objectShape } from '@orkestrel/contract'
37
39
  import { createTool, createToolManager } from '@orkestrel/tool'
38
40
 
39
41
  const tools = createToolManager()
@@ -41,12 +43,18 @@ tools.add(
41
43
  createTool({
42
44
  name: 'add',
43
45
  description: 'Add two numbers',
46
+ contract: objectShape({ a: numberShape(), b: numberShape() }),
44
47
  execute: (args) => Number(args.a) + Number(args.b),
45
48
  }),
46
49
  )
47
50
 
48
51
  // `provider` is your ProviderInterface implementation (see the guide)
49
- const agent = createAgent(provider, { system: 'You are concise.', tools })
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
+ })
50
58
  agent.context.messages.add({ role: 'user', content: 'Say hi.' })
51
59
 
52
60
  const stream = agent.stream()