agentnet 0.1.16 → 0.1.17

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.
@@ -5,6 +5,8 @@ metadata:
5
5
  name: entrypoint
6
6
  namespace: smartexample
7
7
  spec:
8
+ runner:
9
+ maxConversationLength: 100
8
10
  io:
9
11
  - type: NatsIO
10
12
  bindings:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentnet",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "type": "module",
5
5
  "description": "Agent library used by Smartness",
6
6
  "main": "src/index.js",
@@ -287,6 +287,10 @@ function configureRunner(agentBuilder, runnerSpec) {
287
287
  agentBuilder._config.runner.maxRuns = runnerSpec.maxRuns;
288
288
  }
289
289
 
290
+ if (runnerSpec.maxConversationLength !== undefined) {
291
+ agentBuilder._config.runner.maxConversationLength = runnerSpec.maxConversationLength;
292
+ }
293
+
290
294
  return agentBuilder;
291
295
  }
292
296
 
@@ -27,7 +27,8 @@ const DEFAULT_CONFIG = {
27
27
  apiVersion: "agentnet/v1alpha1" // Default API version
28
28
  },
29
29
  runner: {
30
- maxRuns: 10
30
+ maxRuns: 10,
31
+ maxConversationLength: 10
31
32
  }
32
33
  }
33
34
 
@@ -75,7 +76,8 @@ const AGENT_CONFIG_SCHEMA = {
75
76
  runner: {
76
77
  type: 'object',
77
78
  properties: {
78
- maxRuns: { type: 'number' }
79
+ maxRuns: { type: 'number' },
80
+ maxConversationLength: { type: 'number' }
79
81
  }
80
82
  },
81
83
  on: { type: 'object' }
@@ -214,6 +216,13 @@ export function Agent() {
214
216
  });
215
217
  }
216
218
 
219
+ validateType(config.runner.maxConversationLength, 'number', 'runner.maxConversationLength', 'agent_config');
220
+ if (config.runner.maxConversationLength <= 0) {
221
+ throw new ConfigurationError("runner.maxConversationLength must be greater than 0", {
222
+ maxConversationLength: config.runner.maxConversationLength
223
+ });
224
+ }
225
+
217
226
  logger.debug(`Agent ${config.metadata.name} configuration validated successfully`);
218
227
 
219
228
  } catch (error) {
@@ -108,7 +108,7 @@ export async function AgentRuntime(agentConfig) {
108
108
  await store.instance.connect()
109
109
  sessionStore.setConversation(storeState.conversation)
110
110
  sessionStore.setState(storeState.state)
111
- sessionStore.trimConversation(10)
111
+ sessionStore.trimConversation(runner?.maxConversationLength || 10)
112
112
  await sessionStore.dump(store.instance)
113
113
  logger.info(`Dumped session state for agent ${agentName} with session id ${storeStateSessionId}, current conversation length ${storeState.conversation.getRawConversation().length}`);
114
114
  }