Spaces:
Configuration error
Configuration error
File size: 1,562 Bytes
76501b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | import { Agent } from '../agent/agent.js';
import { serverProxy } from '../agent/mindserver_proxy.js';
import yargs from 'yargs';
const args = process.argv.slice(2);
if (args.length < 1) {
console.log('Usage: node init_agent.js -n <agent_name> -p <port> -l <load_memory> -m <init_message> -c <count_id>');
process.exit(1);
}
const argv = yargs(args)
.option('name', {
alias: 'n',
type: 'string',
description: 'name of agent'
})
.option('load_memory', {
alias: 'l',
type: 'boolean',
description: 'load agent memory from file on startup'
})
.option('init_message', {
alias: 'm',
type: 'string',
description: 'automatically prompt the agent on startup'
})
.option('count_id', {
alias: 'c',
type: 'number',
default: 0,
description: 'identifying count for multi-agent scenarios',
})
.option('port', {
alias: 'p',
type: 'number',
description: 'port of mindserver'
})
.argv;
(async () => {
try {
console.log('Connecting to MindServer');
await serverProxy.connect(argv.name, argv.port);
console.log('Starting agent');
const agent = new Agent();
serverProxy.setAgent(agent);
await agent.start(argv.load_memory, argv.init_message, argv.count_id);
} catch (error) {
console.error('Failed to start agent process:');
console.error(error.message);
console.error(error.stack);
process.exit(1);
}
})();
|