Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 0.4.7 - 2025-11-14

- Add create_action_run method

## Version 0.4.6 - 2025-10-17

- Add documentRetentionInDays to update_organization
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cradl"
version = "0.4.6"
version = "0.4.7"
description = "Python SDK for Cradl"
authors = [{ name = "Cradl", email = "[email protected]" }]
readme = "README.md"
Expand Down
36 changes: 34 additions & 2 deletions src/cradl/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3169,7 +3169,7 @@ def create_action(
secret_id: Optional[str] = None,
) -> Dict:

"""Get action, calls the POST /actions endpoint.
"""Create action, calls the POST /actions endpoint.

:param function_id: Id of the function to run
:type function_id: str
Expand Down Expand Up @@ -3293,7 +3293,7 @@ def list_action_runs(
return self._make_request(requests.get, f'/actions/{action_id}/runs', params=dictstrip(params))

def get_action_run(self, action_id: str, run_id: str) -> Dict:
"""Get action, calls the GET /actions/{actionId}/runs/{runId} endpoint.
"""Get action run, calls the GET /actions/{actionId}/runs/{runId} endpoint.

:param action_id: Id of the action
:type action_id: str
Expand All @@ -3306,3 +3306,35 @@ def get_action_run(self, action_id: str, run_id: str) -> Dict:
:py:class:`~cradl.LimitExceededException`, :py:class:`requests.exception.RequestException`
"""
return self._make_request(requests.get, f'/actions/{action_id}/runs/{run_id}')

def create_action_run(
self,
action_id: str,
input: dict,
*,
agent_run_id: Optional[str] = None,
metadata: Optional[dict] = None,
) -> Dict:
"""Create action run, calls the POST /actions/{actionId}/runs endpoint.

:param action_id: Id of the action
:type action_id: str
:param input: Dictionary with input to the run
:type input: dict
:param agent_run_id: Id of an agent run to associate with the action run
:type agent_run_id: str, optional
:param metadata: Dictionary that can be used to store additional information
:type metadata: dict, optional
:return: Action response from REST API
:rtype: dict

:raises: :py:class:`~cradl.InvalidCredentialsException`, :py:class:`~cradl.TooManyRequestsException`,\
:py:class:`~cradl.LimitExceededException`, :py:class:`requests.exception.RequestException`
"""
body = dictstrip({
'agentRunId': agent_run_id,
'input': input,
'metadata': metadata,
})
return self._make_request(requests.post, f'/actions/{action_id}/runs', body=body)

Loading