tdfs4ds.agentops.client¶
tdfs4ds.agentops.client
¶
Thin REST client for the AgentOps Core API.
Deliberately no orchestration: one method per endpoint, so the pipeline in
:mod:tdfs4ds.agentops.deploy can be tested against a stub without a cluster.
Three details cost a real deployment cycle each to discover, and are encoded here rather than left to the caller:
- the multipart upload must not set
Content-Type—requestsderives the boundary, and supplying the header without one produces a request the API cannot parse; - the payload is rejected outright for any field the schema does not define
(
422 extra_forbidden), so nothing decorative may be added to it; - deployment progress is reported as
status+current_step+steps_remaining, which is what to poll — a fixed sleep either returns before the pod is up or wastes minutes after it is.
The token is used and never logged, echoed, or returned.
_DEFAULT_BASE_URL
module-attribute
¶
_UUID_RE
module-attribute
¶
AgentOpsError
¶
Bases: RuntimeError
An AgentOps API call failed. Carries the response body, which is where the useful detail lives — a 422 names the offending field.
AgentOpsClient
¶
Minimal client for the endpoints a deployment needs.
Parameters¶
base_url : str, optional
Defaults to TD_AGENTOPS_BASE_URL, then the in-cluster service URL.
token : str, optional
JWT bearer token. Defaults to TDFS4DS_AGENTOPS_TOKEN. In an AI
Studio notebook this is the user_token produced by %gen_token.
register_definition
¶
Upload the zip and register an agent definition. Returns its id.
wait_definition_published
¶
Poll until the definition leaves creating. Returns its status.
create_deployment
¶
POST the deployment payload. Returns the full response body.
The payload is sent verbatim; see the module docstring on
extra_forbidden.
wait_deployment_active
¶
Poll the deployment until it settles. Returns the last body.
Emits current_step transitions rather than every poll, so a long
build reads as building -> pushing -> deploying instead of forty
identical lines.
delete_agent
¶
DELETE /agents/{id}: removes the deployment (pod, route, service).
delete_definition
¶
DELETE /agent_definitions/{id}: removes the registry entry.
get_logs
¶
Pod logs. Never raises — a missing log must not mask the real error.