I have a web app which receives user input request in the controller endpoint. It then constructs and sends the message to the deepagent:
async for step in current_app.agent.astream(
{"messages": [{"role": "user", "content": message}], "timestamp": datetime.now()},
stream_mode="values", # Use this to stream all values in the state after each step.
config = config, # This is needed by Checkpointer
):
result.append(step["messages"][-1])
The problem I am facing is that since the edit_file is so unreliable ( `edit_file` crashes · Issue #728 · langchain-ai/deepagents · GitHub ), I am thinking of creating a new file with the path name ending with the request current timestamp for the app to work. How should I structure my prompt so that the agent is able to get the timestamp? Is this even possible? For example, I am thinking about the following prompt:
WORKFLOW_INSTRUCTIONS = """You are a helpful question-answering assistant. For context, The current timestamp is {timestamp}.
**Save the request**: Use write_file() to save the user's question to `/user_questions_{timestamp:%d-%m-%Y_%H-%M-%S}.md`
**Write Report**: Write final report to `/final_answer_{timestamp:%d-%m-%Y_%H-%M-%S}.md`
The timestamp has to be consistent in the full turn of the request as the agent might decide to edit the file later in the logic and the corresponding `/final_answers_{timestamp:%d-%m-%Y_%H-%M-%S}.md` has to match the timestamp.