LangChain Support
Back to SDKs and APIs

Can I reopen a run after calling patch() to write additional data?

SDKs and APIs·2 min read·Nov 23, 2025··

Context

When working with the RunTree API, you may want to understand whether you can continue writing to a run after it has been finalized. This question often comes up when deciding between keeping runs open for multiple writes versus closing them after each write operation.

Answer

No, you cannot reopen a run after calling patch() (or patchRun() in JavaScript). Once you call patch(), the run becomes immutable and no further updates can be sent.

Here's how the RunTree lifecycle works:

  1. end() - This method only sets fields locally (like end_time) and does not send any network requests. You can call end() multiple times without issue.

  2. post() - This sends the initial network request to create the run. This is not idempotent and should only be called once.

  3. patch() - This is the final network request that sends updates to the run. After this call, the run cannot be modified further.

Best Practice: If you need to write to a run multiple times, keep the run open (don't call patch()) until you're completely finished with all updates. Only call patch() when you're ready to finalize the run permanently.

Example workflow:

  1. Create a child run with sessionRun.createChild()

  2. Write data to the run multiple times as needed

  3. Call end() to set final fields

  4. Call patch() only when completely finished