@@ -867,7 +867,7 @@ def execute(
867867 id : str ,
868868 * ,
869869 command : str ,
870- command_id : str = str ( uuid7 ()) ,
870+ command_id : str | None = None ,
871871 last_n : str | Omit = omit ,
872872 optimistic_timeout : Optional [int ] | Omit = omit ,
873873 shell_name : Optional [str ] | Omit = omit ,
@@ -892,7 +892,8 @@ def execute(
892892 specified the command is run from the directory based on the recent state of the
893893 persistent shell.
894894
895- command_id: The command ID in UUIDv7 string format for idempotency and tracking
895+ command_id: The command ID in UUIDv7 string format for idempotency and tracking.
896+ A fresh UUID is generated per call if not provided.
896897
897898 last_n: Last n lines of standard error / standard out to return (default: 100)
898899
@@ -915,6 +916,8 @@ def execute(
915916 """
916917 if not id :
917918 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
919+ if command_id is None :
920+ command_id = str (uuid7 ())
918921 if not is_given (timeout ) and self ._client .timeout == DEFAULT_TIMEOUT :
919922 timeout = 600
920923 return self ._post (
@@ -944,7 +947,7 @@ def execute_and_await_completion(
944947 devbox_id : str ,
945948 * ,
946949 command : str ,
947- command_id : str = str ( uuid7 ()) ,
950+ command_id : str | None = None ,
948951 last_n : str | Omit = omit ,
949952 optimistic_timeout : Optional [int ] | Omit = omit ,
950953 shell_name : Optional [str ] | Omit = omit ,
@@ -963,9 +966,11 @@ def execute_and_await_completion(
963966 return the result within the initial request's timeout. If the execution is not yet
964967 complete, it switches to using wait_for_command to minimize latency while waiting.
965968
966- A command_id (UUIDv7) is automatically generated for idempotency and tracking.
969+ A command_id (UUIDv7) is automatically generated per call for idempotency and tracking.
967970 You can provide your own command_id to enable custom retry logic or external tracking.
968971 """
972+ if command_id is None :
973+ command_id = str (uuid7 ())
969974 execution = self .execute (
970975 devbox_id ,
971976 command = command ,
@@ -2543,7 +2548,7 @@ async def execute(
25432548 id : str ,
25442549 * ,
25452550 command : str ,
2546- command_id : str = str ( uuid7 ()) ,
2551+ command_id : str | None = None ,
25472552 last_n : str | Omit = omit ,
25482553 optimistic_timeout : Optional [int ] | Omit = omit ,
25492554 shell_name : Optional [str ] | Omit = omit ,
@@ -2568,7 +2573,8 @@ async def execute(
25682573 specified the command is run from the directory based on the recent state of the
25692574 persistent shell.
25702575
2571- command_id: The command ID in UUIDv7 string format for idempotency and tracking
2576+ command_id: The command ID in UUIDv7 string format for idempotency and tracking.
2577+ A fresh UUID is generated per call if not provided.
25722578
25732579 last_n: Last n lines of standard error / standard out to return (default: 100)
25742580
@@ -2591,6 +2597,8 @@ async def execute(
25912597 """
25922598 if not id :
25932599 raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
2600+ if command_id is None :
2601+ command_id = str (uuid7 ())
25942602 if not is_given (timeout ) and self ._client .timeout == DEFAULT_TIMEOUT :
25952603 timeout = 600
25962604 return await self ._post (
@@ -2620,7 +2628,7 @@ async def execute_and_await_completion(
26202628 devbox_id : str ,
26212629 * ,
26222630 command : str ,
2623- command_id : str = str ( uuid7 ()) ,
2631+ command_id : str | None = None ,
26242632 last_n : str | Omit = omit ,
26252633 optimistic_timeout : Optional [int ] | Omit = omit ,
26262634 shell_name : Optional [str ] | Omit = omit ,
@@ -2639,7 +2647,7 @@ async def execute_and_await_completion(
26392647 return the result within the initial request's timeout. If the execution is not yet
26402648 complete, it switches to using wait_for_command to minimize latency while waiting.
26412649
2642- A command_id (UUIDv7) is automatically generated for idempotency and tracking.
2650+ A command_id (UUIDv7) is automatically generated per call for idempotency and tracking.
26432651 You can provide your own command_id to enable custom retry logic or external tracking.
26442652 """
26452653
0 commit comments