waft.agent_deployment.agent_client module

Client for interacting with WAFT agent API endpoints.

class waft.agent_deployment.agent_client.AgentClient(agent_url: str, api_token: str, timeout: int = 30, verify_ssl: bool = True)

Bases: object

Client for interacting with WAFT agent API.

Provides methods to interact with agent endpoints including health checks, metrics collection, and schedule management.

Example

>>> client = AgentClient(
...     agent_url='http://localhost:8000',
...     api_token='your_token'
... )
>>> health = client.health_check()
>>> metrics = client.get_metrics()
>>> schedules = client.list_schedules()
create_schedule(name: str, interval: str, delivery_url: str | None = None, delivery_headers: dict[str, str] | None = None, enabled: bool = True, wshim_token: str | None = None) dict[str, Any]

Create a new metrics collection schedule.

Parameters:
  • name – Human-readable schedule name

  • interval – Collection interval (e.g., “30s”, “1m”, “5m”, “1h”)

  • delivery_url – URL to send metrics to (optional)

  • delivery_headers – Optional headers to include in delivery requests

  • enabled – Whether to enable the schedule immediately

  • wshim_token – Optional WShim token for metrics authentication

Returns:

Response with created schedule details

Raises:

httpx.HTTPError – If the request fails

delete_schedule(schedule_id: UUID | str) None

Delete a schedule.

Parameters:

schedule_id – Schedule UUID

Raises:

httpx.HTTPError – If the request fails or schedule not found

get_logs(lines: int | None = 100) dict[str, Any]

Get agent logs.

Parameters:

lines – Number of log lines to retrieve. If None, returns all logs.

Returns:

Response with logs, line count, and platform info

Raises:

httpx.HTTPError – If the request fails

get_metrics() dict[str, Any]

Get current system and WARP metrics from the agent.

Returns:

Metrics snapshot with system and WARP metrics

Raises:

httpx.HTTPError – If the request fails

get_schedule(schedule_id: UUID | str) dict[str, Any]

Get a specific schedule by ID.

Parameters:

schedule_id – Schedule UUID

Returns:

Response with schedule details

Raises:

httpx.HTTPError – If the request fails or schedule not found

health_check() dict[str, Any]

Check the health of the agent.

Returns:

Health status response with version and status

Raises:

httpx.HTTPError – If the health check fails

list_schedules() dict[str, Any]

List all metrics collection schedules.

Returns:

Response with list of schedules and total count

Raises:

httpx.HTTPError – If the request fails

update_schedule(schedule_id: UUID | str, name: str | None = None, interval: str | None = None, delivery_url: str | None = None, delivery_headers: dict[str, str] | None = None, enabled: bool | None = None, wshim_token: str | None = None) dict[str, Any]

Update an existing schedule.

Parameters:
  • schedule_id – Schedule UUID

  • name – New schedule name

  • interval – New collection interval

  • delivery_url – New delivery URL

  • delivery_headers – New delivery headers

  • enabled – New enabled status

  • wshim_token – New WShim token

Returns:

Response with updated schedule details

Raises:

httpx.HTTPError – If the request fails or schedule not found