From e2fdb11436fd23a7bd9daad58306fb55e201cedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B8rn?= Date: Tue, 18 Nov 2025 12:43:06 +0100 Subject: [PATCH] Add delete_agent_run method --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- src/cradl/client.py | 21 ++++++++++++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index baad92f..578c14c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Version 0.4.9 - 2025-11-18 + +- Add delete_agent_run method + ## Version 0.4.8 - 2025-11-17 - Add delete_validation method diff --git a/pyproject.toml b/pyproject.toml index 3c253e2..eb6d6a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cradl" -version = "0.4.8" +version = "0.4.9" description = "Python SDK for Cradl" authors = [{ name = "Cradl", email = "hello@cradl.ai" }] readme = "README.md" diff --git a/src/cradl/client.py b/src/cradl/client.py index 58a954a..6856eea 100644 --- a/src/cradl/client.py +++ b/src/cradl/client.py @@ -2881,7 +2881,7 @@ def list_agents(self, *, max_results: Optional[int] = None, next_token: Optional return self._make_request(requests.get, '/agents', params=params) def create_agent_run(self, agent_id: str, *, variables: dict = None) -> Dict: - """Get agent, calls the POST /agents/{agentId}/runs endpoint. + """Create agent run, calls the POST /agents/{agentId}/runs endpoint. :param agent_id: Id of the agent :type agent_id: str @@ -2905,7 +2905,7 @@ def list_agent_runs( max_results: Optional[int] = None, next_token: Optional[str] = None, ) -> Dict: - """List agents available, calls the GET /agents/{agentId}/runs endpoint. + """List agent runs available, calls the GET /agents/{agentId}/runs endpoint. :param agent_id: Id of the agent :type agent_id: str @@ -2927,7 +2927,7 @@ def list_agent_runs( return self._make_request(requests.get, f'/agents/{agent_id}/runs', params=params) def get_agent_run(self, agent_id: str, run_id: str, *, get_variables: bool = False) -> Dict: - """Get agent, calls the GET /agents/{agentId}/runs/{runId} endpoint. + """Get agent run, calls the GET /agents/{agentId}/runs/{runId} endpoint. :param agent_id: Id of the agent :type agent_id: str @@ -2948,6 +2948,21 @@ def get_agent_run(self, agent_id: str, run_id: str, *, get_variables: bool = Fal ).decode()) return agent_run + def delete_agent_run(self, agent_id: str, run_id: str) -> Dict: + """Delete agent run, calls the DELETE /agents/{agentId}/runs/{runId} endpoint. + + :param agent_id: Id of the agent + :type agent_id: str + :param run_id: Id of the run + :type run_id: str + :return: Agent response from REST API + :rtype: dict + + :raises: :py:class:`~cradl.InvalidCredentialsException`, :py:class:`~cradl.TooManyRequestsException`,\ + :py:class:`~cradl.LimitExceededException`, :py:class:`requests.exception.RequestException` + """ + return self._make_request(requests.delete, f'/agents/{agent_id}/runs/{run_id}') + def list_hooks(self, *, max_results: Optional[int] = None, next_token: Optional[str] = None) -> Dict: """List hooks available, calls the GET /hooks endpoint.