From 160e8b915da1c4701ccbe461353c8133cd60744f Mon Sep 17 00:00:00 2001 From: nlathia Date: Thu, 16 Oct 2025 17:07:35 +0100 Subject: [PATCH] python-client: add resources to start and resume --- pyproject.toml | 2 +- src/gradient_labs/_conversation_resume.py | 8 +++++++- src/gradient_labs/_conversation_start.py | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c03f7b9..85b3328 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gradient-labs" -version = "0.11.2" +version = "0.11.3" description = "Python bindings for the Gradient Labs API" readme = "README.md" requires-python = ">=3.9,<4.0" diff --git a/src/gradient_labs/_conversation_resume.py b/src/gradient_labs/_conversation_resume.py index 9a1b8c1..c7016b8 100644 --- a/src/gradient_labs/_conversation_resume.py +++ b/src/gradient_labs/_conversation_resume.py @@ -1,4 +1,4 @@ -from typing import Optional +from typing import Optional, Dict, Any from datetime import datetime from dataclasses import dataclass @@ -27,6 +27,10 @@ class ResumeParams: # reason optionally allows you to describe why this assignment is happening. reason: Optional[str] = None + # resources is an arbitrary object attached to the conversation and available to the AI agent + # during the conversation. You can also use resources as parameters for your tools. + resources: Optional[Dict[str, Any]] = None + def resume_conversation( *, client: HttpClient, conversation_id: str, params: ResumeParams @@ -37,6 +41,8 @@ def resume_conversation( body["assignee_id"] = params.assignee_id if params.timestamp: body["timestamp"] = HttpClient.localize(params.timestamp) + if params.resources is not None: + body["resources"] = params.resources _ = client.put( path=f"conversations/{conversation_id}/resume", diff --git a/src/gradient_labs/_conversation_start.py b/src/gradient_labs/_conversation_start.py index 4805b61..97d2c94 100644 --- a/src/gradient_labs/_conversation_start.py +++ b/src/gradient_labs/_conversation_start.py @@ -1,4 +1,4 @@ -from typing import Optional, Any +from typing import Optional, Dict, Any from datetime import datetime from dataclasses import dataclass @@ -43,6 +43,10 @@ class StartConversationParams: # If not given, this will default to the current time. created: Optional[datetime] = None + # resources is an arbitrary object attached to the conversation and available to the AI agent + # during the conversation. You can also use resources as parameters for your tools. + resources: Optional[Dict[str, Any]] = None + def start_conversation( *, client: HttpClient, params: StartConversationParams @@ -56,6 +60,8 @@ def start_conversation( body["metadata"] = params.metadata if params.created is not None: body["created"] = HttpClient.localize(params.created) + if params.resources is not None: + body["resources"] = params.resources rsp = client.post( path="conversations",