Skip to content

Commit 422e5ea

Browse files
authored
Add delete_agent_run method (#162)
1 parent 0093271 commit 422e5ea

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## Version 0.4.9 - 2025-11-18
4+
5+
- Add delete_agent_run method
6+
37
## Version 0.4.8 - 2025-11-17
48

59
- Add delete_validation method

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cradl"
3-
version = "0.4.8"
3+
version = "0.4.9"
44
description = "Python SDK for Cradl"
55
authors = [{ name = "Cradl", email = "[email protected]" }]
66
readme = "README.md"

src/cradl/client.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2881,7 +2881,7 @@ def list_agents(self, *, max_results: Optional[int] = None, next_token: Optional
28812881
return self._make_request(requests.get, '/agents', params=params)
28822882

28832883
def create_agent_run(self, agent_id: str, *, variables: dict = None) -> Dict:
2884-
"""Get agent, calls the POST /agents/{agentId}/runs endpoint.
2884+
"""Create agent run, calls the POST /agents/{agentId}/runs endpoint.
28852885
28862886
:param agent_id: Id of the agent
28872887
:type agent_id: str
@@ -2905,7 +2905,7 @@ def list_agent_runs(
29052905
max_results: Optional[int] = None,
29062906
next_token: Optional[str] = None,
29072907
) -> Dict:
2908-
"""List agents available, calls the GET /agents/{agentId}/runs endpoint.
2908+
"""List agent runs available, calls the GET /agents/{agentId}/runs endpoint.
29092909
29102910
:param agent_id: Id of the agent
29112911
:type agent_id: str
@@ -2927,7 +2927,7 @@ def list_agent_runs(
29272927
return self._make_request(requests.get, f'/agents/{agent_id}/runs', params=params)
29282928

29292929
def get_agent_run(self, agent_id: str, run_id: str, *, get_variables: bool = False) -> Dict:
2930-
"""Get agent, calls the GET /agents/{agentId}/runs/{runId} endpoint.
2930+
"""Get agent run, calls the GET /agents/{agentId}/runs/{runId} endpoint.
29312931
29322932
:param agent_id: Id of the agent
29332933
:type agent_id: str
@@ -2948,6 +2948,21 @@ def get_agent_run(self, agent_id: str, run_id: str, *, get_variables: bool = Fal
29482948
).decode())
29492949
return agent_run
29502950

2951+
def delete_agent_run(self, agent_id: str, run_id: str) -> Dict:
2952+
"""Delete agent run, calls the DELETE /agents/{agentId}/runs/{runId} endpoint.
2953+
2954+
:param agent_id: Id of the agent
2955+
:type agent_id: str
2956+
:param run_id: Id of the run
2957+
:type run_id: str
2958+
:return: Agent response from REST API
2959+
:rtype: dict
2960+
2961+
:raises: :py:class:`~cradl.InvalidCredentialsException`, :py:class:`~cradl.TooManyRequestsException`,\
2962+
:py:class:`~cradl.LimitExceededException`, :py:class:`requests.exception.RequestException`
2963+
"""
2964+
return self._make_request(requests.delete, f'/agents/{agent_id}/runs/{run_id}')
2965+
29512966
def list_hooks(self, *, max_results: Optional[int] = None, next_token: Optional[str] = None) -> Dict:
29522967
"""List hooks available, calls the GET /hooks endpoint.
29532968

0 commit comments

Comments
 (0)