Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding state management example #56

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jxx016
Copy link
Contributor

@jxx016 jxx016 commented Feb 17, 2025

This is an example for state management article

@jxx016 jxx016 requested a review from celesteanglm February 17, 2025 22:14
args: [
{name: "currentBudget", description: "The current budget of the kitchen"},
{name: "ingredient", description: "The ingredient to buy"},
{name: "price", description: "The price of the ingredient"}
Copy link
Contributor

@Ang-dot Ang-dot Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we're not getting the price from your defined record from worker.ts, the agent is estimating its own ingredient price if we don't provide the price list for it^

HeadChef
] ,
getAgentState: getAgentState
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some nit to add a newline at end of file to comply with POSIX standard

JSON.stringify(restaurantBudget)
)
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same regarding the posix standard

}
}

main();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same regarding the posix standard

inventory: restaurantInventory
}
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same regarding the posix standard

Comment on lines +71 to +78
// export const updateInventory = new GameFunction({
// name: "update_inventory",
// description: "Update the inventory",
// args: [] as const,
// executable: async (args, logger) => {
// return new ExecutableGameFunctionResponse
// }
// })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is not used I think we could remove these lines?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

description: `You are a responsible kitchen manager that maximizes the efficiency of the workers under you and the kitchen.
You are a great problem solver and also nice to work with.
You are also in charge of making sure the kitchen produces as much high quality food in the moves_left constraint,
keep in mind that the moves_left constraint is the number of moves you have left to make, and each call to a worker reduces the moves_left constraint by 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I don't think you should use this kind of language- "each call to a worker ..."; it's not that agentic - perhaps use more "natural language"?

Comment on lines +71 to +78
// export const updateInventory = new GameFunction({
// name: "update_inventory",
// description: "Update the inventory",
// args: [] as const,
// executable: async (args, logger) => {
// return new ExecutableGameFunctionResponse
// }
// })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1


export const getBudget = new GameFunction({
name: "get_budget",
description: "Get the budget",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you be a bit more detailed with the prompt - just for the sake of making this a "good" example? :)
e.g. "Get the budget required to prepare the food..." or with more context

export const HeadChef = new GameWorker({
id: "head_chef",
name: "HeadChef",
description: `The head chef of the kitchen, your goal is to utilize the available inventory to make the best food. Available inventory is based on the amount behind the inventory object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit confused because I thought

  • the ingredient manager buys ingredients based on budget
  • and head chef just cooks based on available ingredients (i.e. doesn't care about amounts (i.e. ingredient prices) at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants