Skip to content

Commit d423689

Browse files
committed
Ensure that agent knows how to terminate
1 parent ca505b4 commit d423689

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

docs/index.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,14 @@ In fact, reducing the amount of hidden state and forcing the agent to work with
360360

361361
We still need to tell the LM a bit more about how to behave:
362362

363+
```python
364+
messages = [{
365+
"role": "system",
366+
"content": "You are a helpful assistant. When you want to run a command, wrap it in ```bash-action\n<command>\n```. To finish, run the exit command."
367+
}
368+
]
369+
```
370+
363371
### Let's put it together & run it!
364372

365373
You should now have code that looks something like this (this example uses litellm + triple backticks):
@@ -404,7 +412,7 @@ def execute_action(command: str) -> str:
404412
# Main agent loop
405413
messages = [{
406414
"role": "system",
407-
"content": "You are a helpful assistant. When you want to run a command, wrap it in ```bash-action\n<command>\n```"
415+
"content": "You are a helpful assistant. When you want to run a command, wrap it in ```bash-action\n<command>\n```. To finish, run the exit command."
408416
}, {
409417
"role": "user",
410418
"content": "List the files in the current directory"

0 commit comments

Comments
 (0)