KitaruClient
Kitaru client.
Attributes
attributeapiKitaruAPIClientAPI client with one method per endpoint.
Functions
func__init__(self, api_client=None) -> NoneInitialize the client.
paramselfparamapi_clientKitaruAPIClient | None= NoneAPI client used to send requests.
Returns
Nonefuncclose(self) -> NoneClose the underlying API client.
paramselfReturns
Nonefuncget_agent(self, agent) -> AgentResponseGet an agent by id or name.
paramselfparamagentuuid.UUID | strId or name of the agent.
Returns
kitaru.api_models.v1.agent.AgentResponseStored agent.
funclist_agents(self) -> AsyncIterator[AgentResponse]Iterate over all agents.
paramselfReturns
collections.abc.AsyncIteratorAsync iterator over every agent.
funcget_session(self, session_id) -> SessionDetailResponseGet a session by id.
paramselfparamsession_iduuid.UUIDId of the session.
Returns
kitaru.api_models.v1.session.SessionDetailResponseStored session.
funclist_sessions(self, agent=None) -> AsyncIterator[SessionResponse]Iterate over sessions, optionally scoped to one agent.
paramselfparamagentuuid.UUID | str | None= NoneId or name of the agent to scope to.
Returns
collections.abc.AsyncIteratorAsync iterator over every matching session.
funclist_session_nodes(self, session_id) -> AsyncIterator[SessionNodeResponse]Iterate over the nodes of a session in index order.
paramselfparamsession_iduuid.UUIDId of the session.
Returns
collections.abc.AsyncIteratorAsync iterator over every node.
funcreplay(self, session_id, evaluators, agent_version_id=None, override=None, tool_policy=None, baseline_evaluation_mode=BaselineEvaluationMode.IF_MISSING, wait=True, timeout=None) -> ReplayResponseReplay a session and optionally wait for it to finish.
paramselfparamsession_iduuid.UUIDId of the session to replay.
paramevaluatorslist[EvaluatorConfig]Evaluators run against the result session.
paramagent_version_iduuid.UUID | None= NoneAgent version to replay with, the session's recorded version when unset.
paramoverrideReplayOverride | None= NoneOverride to apply.
paramtool_policyToolPolicy | None= NoneTool policy to apply.
parambaseline_evaluation_modeBaselineEvaluationMode= BaselineEvaluationMode.IF_MISSINGHow to score the baseline session.
paramwaitbool= TrueWhether to wait for the replay to reach a terminal status.
paramtimeoutfloat | None= NoneSeconds to wait before giving up.
Returns
kitaru.api_models.v1.replay.ReplayResponseReplay, in a terminal status when waited for.
funcget_replay(self, replay_id) -> ReplayResponseGet a replay by id.
paramselfparamreplay_iduuid.UUIDId of the replay.
Returns
kitaru.api_models.v1.replay.ReplayResponseStored replay.
funcwait_for_replay(self, replay_id, timeout=None, poll_interval=2.0) -> ReplayResponseWait for a replay to reach a terminal status.
paramselfparamreplay_iduuid.UUIDId of the replay.
paramtimeoutfloat | None= NoneSeconds to wait before giving up.
parampoll_intervalfloat= 2.0Seconds between status checks.
Returns
kitaru.api_models.v1.replay.ReplayResponseReplay in a terminal status.
funcget_experiment(self, experiment) -> ExperimentResponseGet an experiment by id or name.
paramselfparamexperimentuuid.UUID | strId or name of the experiment.
Returns
kitaru.api_models.v1.experiment.ExperimentResponseStored experiment.
funclist_experiments(self) -> AsyncIterator[ExperimentResponse]Iterate over all experiments.
paramselfReturns
collections.abc.AsyncIteratorAsync iterator over every experiment.
funcrun_experiment(self, experiment, cohort_version_id, agent_version_id, baseline_evaluation_mode=BaselineEvaluationMode.IF_MISSING, wait=True, timeout=None) -> ExperimentRunResponseStart an experiment run and optionally wait for it to finish.
paramselfparamexperimentuuid.UUID | strId or name of the experiment.
paramcohort_version_iduuid.UUIDCohort version whose sessions are replayed.
paramagent_version_iduuid.UUIDAgent version to replay with.
parambaseline_evaluation_modeBaselineEvaluationMode= BaselineEvaluationMode.IF_MISSINGHow to score each baseline session.
paramwaitbool= TrueWhether to wait for the run to reach a terminal status.
paramtimeoutfloat | None= NoneSeconds to wait before giving up.
Returns
kitaru.api_models.v1.experiment_run.ExperimentRunResponseExperiment run, in a terminal status when waited for.
funcget_experiment_run(self, run_id) -> ExperimentRunResponseGet an experiment run by id.
paramselfparamrun_iduuid.UUIDId of the experiment run.
Returns
kitaru.api_models.v1.experiment_run.ExperimentRunResponseStored experiment run.
funcwait_for_experiment_run(self, run_id, timeout=None, poll_interval=2.0) -> ExperimentRunResponseWait for an experiment run to reach a terminal status.
paramselfparamrun_iduuid.UUIDId of the experiment run.
paramtimeoutfloat | None= NoneSeconds to wait before giving up.
parampoll_intervalfloat= 2.0Seconds between status checks.
Returns
kitaru.api_models.v1.experiment_run.ExperimentRunResponseExperiment run in a terminal status.