| Name | Type | Description |
|---|---|---|
thread_id* | str | The ID of the thread to update. |
values* | dict[str, Any] | Sequence[dict] | None | The values to update the state with. |
as_node | str | None | Default: None |
checkpoint | Checkpoint | None | Default: None |
checkpoint_id | str | None | Default: None |
headers | Mapping[str, str] | None | Default: None |
params | QueryParamTypes | None | Default: None |
Update the state of a thread.
client = get_client(url="http://localhost:2024)
response = await client.threads.update_state(
thread_id="my_thread_id",
values={"messages":[{"role": "user", "content": "hello!"}]},
as_node="my_node",
)
print(response)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
{
'checkpoint': {
'thread_id': 'e2496803-ecd5-4e0c-a779-3226296181c2',
'checkpoint_ns': '',
'checkpoint_id': '1ef4a9b8-e6fb-67b1-8001-abd5184439d1',
'checkpoint_map': {}
}
}Update the state as if this node had just executed.
The checkpoint to update the state of.
(deprecated) The checkpoint ID to update the state of.
Optional custom headers to include with the request.
Optional query parameters to include with the request.