Repository: griptape-ai/griptape

Issue:
Task Input Lost On Multiple Runs With TextArtifact Input
```python
from griptape.artifacts import TextArtifact
from griptape.structures import Agent
from griptape.tasks.prompt_task import PromptTask

agent = Agent(
    tasks=[
        PromptTask(
            input=[
                TextArtifact("{{ args[0] }}"),
            ],
        )
    ],
)

agent.run("Hi my name is collin")
agent.run("What is my name")
```

```
[02/13/25 13:54:31] INFO     PromptTask 501480ad380f4bae84653b5a51db7048
                             Input: Hi my name is collin
                    INFO     PromptTask 501480ad380f4bae84653b5a51db7048
                             Output: Hello Collin! How can I assist you today?
                    INFO     PromptTask 501480ad380f4bae84653b5a51db7048
                             Input: Hi my name is collin
[02/13/25 13:54:32] INFO     PromptTask 501480ad380f4bae84653b5a51db7048
                             Output: Hello again, Collin! How can I help you today?
```

Hints from issue comments:

Solution patch:
diff --git a/griptape/tasks/prompt_task.py b/griptape/tasks/prompt_task.py
index e555647f..6dea29e3 100644
--- a/griptape/tasks/prompt_task.py
+++ b/griptape/tasks/prompt_task.py
@@ -305,9 +305,7 @@ class PromptTask(
         task_input: str | tuple | list | BaseArtifact | Callable[[BaseTask], BaseArtifact],
     ) -> BaseArtifact:
         if isinstance(task_input, TextArtifact):
-            task_input.value = J2().render_from_string(task_input.value, **self.full_context)
-
-            return task_input
+            return TextArtifact(J2().render_from_string(task_input.value, **self.full_context), meta=task_input.meta)
         elif isinstance(task_input, Callable):
             return self._process_task_input(task_input(self))
         elif isinstance(task_input, ListArtifact):


Test patch:
diff --git a/tests/unit/tasks/test_prompt_task.py b/tests/unit/tasks/test_prompt_task.py
index 5d6a8c95..04177f7c 100644
--- a/tests/unit/tasks/test_prompt_task.py
+++ b/tests/unit/tasks/test_prompt_task.py
@@ -10,7 +10,7 @@ from griptape.memory.structure.run import Run
 from griptape.rules import Rule
 from griptape.rules.json_schema_rule import JsonSchemaRule
 from griptape.rules.ruleset import Ruleset
-from griptape.structures import Pipeline
+from griptape.structures import Agent, Pipeline
 from griptape.tasks import PromptTask
 from tests.mocks.mock_prompt_driver import MockPromptDriver
 from tests.mocks.mock_tool.tool import MockTool
@@ -134,6 +134,19 @@ class TestPromptTask:
 
         assert task.input.value == str({"default": "test"})
 
+    def test_input_run(self):
+        agent = Agent(tasks=[PromptTask(TextArtifact("{{ args[0] }}", meta={"foo": "bar"}))])
+
+        agent.run("1")
+
+        assert agent.task.input.value == "1"
+        assert agent.task.input.meta["foo"] == "bar"
+
+        agent.run("2")
+
+        assert agent.task.input.value == "2"
+        assert agent.task.input.meta["foo"] == "bar"
+
     def test_input_context(self):
         pipeline = Pipeline(
             tasks=[