Skip to content

Commit

Permalink
Bring back the automated run with character with command
Browse files Browse the repository at this point in the history
  • Loading branch information
Xm0onh committed Jan 18, 2025
1 parent d407eb2 commit e51ac5d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,26 @@ engagement_criteria:

Run the agent with a specific character:

You can run the agent with a specific character by providing the character name as an argument.

```bash
# Use default character (configured in config.yaml)
yarn dev # for development with auto-reload
yarn dev # for development with auto-reload - select from list of characters
# or
yarn start # for production build and run - select from list of characters
# Use a specific character (omit .yaml extension)
yarn dev my-agent # for development with auto-reload
# or
yarn start # for production build and run
yarn start my-agent # for production build and run
# Examples:
# If your character file is named 'techie.yaml':
yarn dev techie
# If your character file is named 'my-agent.yaml':
yarn dev my-agent
```
Then, choose a character from the list of available characters.

Note: When specifying a character file, omit the `.yaml` extension. The system will automatically look for the YAML file in the `config/characters/` directory.

Expand Down Expand Up @@ -236,8 +249,11 @@ The KOL workflow enables agents to:
Start the agent with:

```bash
# Use example character
# Use example character or select from list of characters
yarn dev
# Use specific character
yarn dev my-agent
```

Monitor the agent's activity in the console and configured log files.
Expand Down
11 changes: 10 additions & 1 deletion src/cli/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ interface UserAnswers {
character: string;
}

export const onboarding = async (): Promise<UserAnswers> => {
export const onboarding = async (preselectedCharacter?: string): Promise<UserAnswers> => {
const characters = await listAvailableCharacters();

if (preselectedCharacter) {
const character = characters.find(char => char.id === preselectedCharacter);
if (character) {
logger.info(`Using preselected character: ${character.id}`);
return { character: character.id };
}
throw new Error(`Character "${preselectedCharacter}" not found`);
}

const answers: UserAnswers = await inquirer.prompt([
{
type: 'list',
Expand Down
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ process.on('SIGTERM', () => {
process.exit(0);
});

const characterId = process.argv[2];
if (!characterId) {
logger.error('Please provide a character name as an argument (e.g., yarn dev argumint)');
process.exit(1);
}

const startWorkflowPolling = async () => {
try {
const character = await onboarding();
const character = await onboarding(characterId);
const _result = await runWorkflow(character.character);
logger.info('Workflow execution completed successfully for character:', character.character);
} catch (error) {
Expand All @@ -26,6 +32,7 @@ const startWorkflowPolling = async () => {
process.exit(0);
}
logger.error('Error running workflow:', error);
process.exit(1);
}
};

Expand Down

0 comments on commit e51ac5d

Please sign in to comment.