Skip to content

Commit

Permalink
Fix subtask before/after run methods running twice (#1343)
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter authored Nov 13, 2024
1 parent f9c0918 commit 171b468
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed

- `ActionsSubtask.before_run` and `ActionsSubtask.after_run` being called twice in `ToolkitTask` and `Tooltask`.

## \[0.34.2\] - 2024-11-07

### Fixed

- Restore human-friendly default `ImageArtifact` and `AudioArtifact` names with file type extension.
- Restore human-friendly default `ImageArtifact` and `AudioArtifact` names with file type extension.

## \[0.34.1\] - 2024-11-05

Expand Down
2 changes: 0 additions & 2 deletions griptape/tasks/tool_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ def try_run(self) -> BaseArtifact:
try:
subtask = self.add_subtask(ActionsSubtask(subtask_input))

subtask.before_run()
subtask.run()
subtask.after_run()

if isinstance(subtask.output, ListArtifact):
first_artifact = subtask.output[0]
Expand Down
2 changes: 0 additions & 2 deletions griptape/tasks/toolkit_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ def try_run(self) -> BaseArtifact:
if len(self.subtasks) >= self.max_subtasks:
subtask.output = ErrorArtifact(f"Exceeded tool limit of {self.max_subtasks} subtasks per task")
else:
subtask.before_run()
subtask.run()
subtask.after_run()

result = self.prompt_driver.run(prompt_stack=self.prompt_stack)
subtask = self.add_subtask(ActionsSubtask(result.to_artifact()))
Expand Down

0 comments on commit 171b468

Please sign in to comment.