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.10 - 2025-11-24

- Add get_agent_statistics method

## Version 0.4.9 - 2025-11-18

- Add delete_agent_run method
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.9"
version = "0.4.10"
description = "Python SDK for Cradl"
authors = [{ name = "Cradl", email = "[email protected]" }]
readme = "README.md"
Expand Down
23 changes: 23 additions & 0 deletions src/cradl/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2963,6 +2963,29 @@ def delete_agent_run(self, agent_id: str, run_id: str) -> Dict:
"""
return self._make_request(requests.delete, f'/agents/{agent_id}/runs/{run_id}')

def get_agent_statistics(self, agent_id: str, *, after: Union[str, datetime], before: Union[str, datetime]) -> Dict:
"""Get agent statistics, calls the GET /agents/{agentId}/statistics endpoint.

:param agent_id: Id of the agent
:type agent_id: str
:param after: Start time for statistics interval
:type after: str or datetime, optional
:param before: End time for statistics interval
:type before: str or datetime, optional
:return: Agent statistics response from REST API
:rtype: dict

:raises: :py:class:`~cradl.InvalidCredentialsException`, :py:class:`~cradl.TooManyRequestsException`,\
:py:class:`~cradl.LimitExceededException`, :py:class:`requests.exception.RequestException`
"""
params = {
'after': datetimestr(after),
'before': datetimestr(before),
}

agent_statistics = self._make_request(requests.get, f'/agents/{agent_id}/statistics', params=params)
return agent_statistics

def list_hooks(self, *, max_results: Optional[int] = None, next_token: Optional[str] = None) -> Dict:
"""List hooks available, calls the GET /hooks endpoint.

Expand Down
Loading