@argentic-ai/client 0.9.0 → 0.10.0

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
@@ -63,15 +63,19 @@ You always name the model; there is no default. `model` is `{ provider, id, pric
63
63
 
64
64
  A tool can declare `once_per`, a key such as `refund:{order_id}` filled in from the call's arguments. Argentic then refuses a second call with the same key, in this wake or any later one. Set it on a `Tool` directly, or pass `{ oncePer: { refund_order: 'refund:{order_id}' } }` as the second argument to `fromAiSdkTools` or `fromMastraTools`. The template is checked before the request is sent. See [TOOLS.md](TOOLS.md#declaring-a-tool-once_per). 0.1.6 and earlier dropped the field.
65
65
 
66
- ## Tools, context and deferred loading (0.1.10)
66
+ ## Tools, state and deferred loading (0.1.10)
67
67
 
68
- Declare an agent's tools once with `client.putTools(agent, tools)` and leave `tools` out of later wakes; `client.tools(agent)` reads them back. A wake can also carry `context` (facts for that call only, such as the signed-in user's plan; it is not written to the journal) and `tool_choice` (`'auto'`, `'required'` or `{ type: 'tool', name }`). On a tool, `defer_loading: true` keeps its schema out of the prompt until the agent looks it up, which pays off from about ten tools.
68
+ Declare an agent's tools once with `client.putTools(agent, tools)` and leave `tools` out of later wakes; `client.tools(agent)` reads them back. A wake can also carry `state` (keys and JSON values your app holds, such as the signed-in user's plan; a value the agent already has costs nothing to send again, a changed one is journaled and the agent keeps it, and `null` removes a key) and `tool_choice` (`'auto'`, `'required'` or `{ type: 'tool', name }`). On a tool, `defer_loading: true` keeps its schema out of the prompt until the agent looks it up, which pays off from about ten tools.
69
69
 
70
70
  ```ts
71
71
  await client.putTools('support-bot', [{ name: 'book_slot', description: 'Book a slot.', parameters: { type: 'object', properties: { day: { type: 'string' } }, required: ['day'] } }])
72
- const out = await client.wake('support-bot', { message: 'Book Tuesday.', model: modelFromEnv(), context: 'Plan: pro' }, 'book-1')
72
+ const out = await client.wake('support-bot', { message: 'Book Tuesday.', model: modelFromEnv(), state: { 'account.plan': 'Pro' } }, 'book-1')
73
73
  ```
74
74
 
75
+ ## `state` replaces `context` (0.10.0)
76
+
77
+ `context` is gone from `WakeBody`: the API now answers 400 and names `state` when a wake still sends it. Move what you sent as one string into keys (`context: 'Plan: pro'` becomes `state: { 'account.plan': 'Pro' }`) and send them on every wake, or only when they change; an unchanged key costs nothing. Unlike `context`, a value you send is journaled, so the agent still has it on later wakes and can find it by search. Text that came from outside your app (a web page, an email) goes in `outside`, not `state`.
78
+
75
79
  ## Structured tool results (0.1.11)
76
80
 
77
81
  `run` answers the tools an agent asked for with a text message the model reads, and now also sends the same results as the `results` field of the wake: `[{ seq, result }]`, where `seq` is the action's `seq` and `result` is exactly what the tool returned (or the `{ error }` object when it threw). The API journals each as the real result of that call. The first wake of a run has none, and a result the ledger already held is sent again like the others. Pass `structuredResults: false` to send the text only. If the API you talk to does not know the field yet, it answers 400 and names `results`; the client sends that wake again once without it, under the same key, and leaves it out from then on. Calling `client.wake()` yourself, add `results` to the body next to the `message`, never with `fire_due`, at most 100 entries.
@@ -68,8 +68,8 @@ export interface WakeBody {
68
68
  schedule?: boolean;
69
69
  model: ModelSpec;
70
70
  system?: string;
71
- /** Facts for this call only (opening hours, the signed-in user's plan), up to 16,000 characters. Not written to the journal or memory; send it again on the next call if the agent still needs it. */
72
- context?: string;
71
+ /** Keys and JSON values your app holds that the agent should know (the signed-in user's plan, what is in their cart), up to 64 keys a call, a key up to 120 characters on one line, a value up to 2,000 characters as JSON. A value the agent already has costs nothing to send again; a changed one is journaled with this call, so the agent keeps it and can search for it later. `null` removes a key; a key you leave out stays as it is. Replaces `context`, which the API no longer takes. */
72
+ state?: Record<string, unknown>;
73
73
  tools?: ToolDecl[];
74
74
  /** Whether this call must end with a call to one of your tools. `auto` (default), `required`, or `{ type: 'tool', name }`. */
75
75
  tool_choice?: 'auto' | 'required' | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@argentic-ai/client",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Argentic client for TypeScript. Argentic is an engine that keeps AI agents right for hours while prompt size is bounded. Adapters for the Vercel AI SDK and Mastra.",
5
5
  "license": "MIT",
6
6
  "type": "module",