A Policy is essentially a function that takes the history of previous steps and decides what action to take next. Note that whenever a user enters input, this is ingested as a "UserInputStep".
As an example, consider the DefaultPolicyhere. It does the following:
If there is not history, show the welcome message.
If the previous step is not a UserInputStep, stop and wait for the next one
Parse the user input for slash commands or custom commands and either
Run the slash/custom command
Run EditHighlightedCodeStep if input starts with '/edit'
Otherwise, run SimpleChatStep
Policy ideas:
Whenever the last step was an EditHighlightedCode, run a "review" step that looks over the code, either just by passing to an LLM, or by linting, running the code, or checking for certain properties (ideally configurable by the user)
Generate code from scratch: Define a goal at the beginning of the policy, and then run steps that repeatedly write code, add features, and check in with the current status of the goal
A Policy is essentially a function that takes the history of previous steps and decides what action to take next. Note that whenever a user enters input, this is ingested as a "UserInputStep".
As an example, consider the
DefaultPolicy
here. It does the following:EditHighlightedCodeStep
if input starts with '/edit'SimpleChatStep
Policy ideas:
EditHighlightedCode
, run a "review" step that looks over the code, either just by passing to an LLM, or by linting, running the code, or checking for certain properties (ideally configurable by the user)