KitaruClient
Kitaru client.
Kitaru client.
Attributes
attributeapiKitaruAPIClientAPI client with one method per endpoint.
Functions
constructor__init__(api_client=None) -> NoneInitialize the client.
paramapi_clientKitaruAPIClient | None= NoneAPI client used to send requests.
Returns
Nonefuncclose() -> NoneClose the underlying API client.
Returns
Nonefuncget_agent(agent) -> AgentResponseGet an agent by id or name.
paramagentuuid.UUID | strId or name of the agent.
Returns
kitaru.api_models.v1.agent.AgentResponseStored agent.
funcregister_agent(name, run_spec, *, description=None, display_version=None, version_description=None, capabilities=None, agent_idempotency_key=None, version_idempotency_key=None) -> AgentRegistrationResultCreate an agent and its initial version.
The operation sends separate agent and version requests. If the agent is
created but the initial version request raises an ordinary exception,
AgentRegistrationError records the created agent, exact version
request, and version idempotency key. Cancellation still propagates,
with the agent id and version idempotency key attached as an exception
note. The method does not roll back the agent or start a fresh version
request with a different idempotency key.
paramnamestrNew agent name.
paramrun_specRunSpecRun spec for the initial version.
paramdescriptionstr | None= NoneAgent description.
paramdisplay_versionstr | None= NoneHuman-readable designator for the initial version.
paramversion_descriptionstr | None= NoneInitial version description.
paramcapabilitiesAgentCapabilities | None= NoneInitial version capabilities.
paramagent_idempotency_keystr | None= NoneIdempotency key for agent creation.
paramversion_idempotency_keystr | None= NoneIdempotency key for version creation.
Returns
kitaru.client.AgentRegistrationResultCreated agent and initial version.
funcregister_agent_version(agent, run_spec, *, display_version=None, description=None, capabilities=None, idempotency_key=None) -> AgentVersionResponseCreate the next version of an existing agent.
paramagentuuid.UUID | strId or exact name of the agent.
paramrun_specRunSpecRun spec for the new version.
paramdisplay_versionstr | None= NoneHuman-readable version designator.
paramdescriptionstr | None= NoneVersion description.
paramcapabilitiesAgentCapabilities | None= NoneVersion capabilities.
paramidempotency_keystr | None= NoneIdempotency key for version creation.
Returns
kitaru.api_models.v1.agent_version.AgentVersionResponseCreated agent version.
funclist_agents() -> AsyncIterator[AgentResponse]Iterate over all agents.
Returns
collections.abc.AsyncIteratorAsync iterator over every agent.
funcget_session(session_id) -> SessionDetailResponseGet a session by id.
paramsession_iduuid.UUIDId of the session.
Returns
kitaru.api_models.v1.session.SessionDetailResponseStored session.
funclist_sessions(agent=None) -> AsyncIterator[SessionResponse]Iterate over sessions, optionally scoped to one agent.
paramagentuuid.UUID | str | None= NoneId or name of the agent to scope to.
Returns
collections.abc.AsyncIteratorAsync iterator over every matching session.
funclist_session_nodes(session_id) -> AsyncIterator[SessionNodeResponse]Iterate over the nodes of a session in index order.
paramsession_iduuid.UUIDId of the session.
Returns
collections.abc.AsyncIteratorAsync iterator over every node.
funcreplay(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.
paramsession_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(replay_id) -> ReplayResponseGet a replay by id.
paramreplay_iduuid.UUIDId of the replay.
Returns
kitaru.api_models.v1.replay.ReplayResponseStored replay.
funcwait_for_replay(replay_id, timeout=None, poll_interval=2.0) -> ReplayResponseWait for a replay to reach a terminal status.
paramreplay_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(experiment) -> ExperimentResponseGet an experiment by id or name.
paramexperimentuuid.UUID | strId or name of the experiment.
Returns
kitaru.api_models.v1.experiment.ExperimentResponseStored experiment.
funclist_experiments() -> AsyncIterator[ExperimentResponse]Iterate over all experiments.
Returns
collections.abc.AsyncIteratorAsync iterator over every experiment.
funcrun_experiment(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.
paramexperimentuuid.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(run_id) -> ExperimentRunResponseGet an experiment run by id.
paramrun_iduuid.UUIDId of the experiment run.
Returns
kitaru.api_models.v1.experiment_run.ExperimentRunResponseStored experiment run.
funcwait_for_experiment_run(run_id, timeout=None, poll_interval=2.0) -> ExperimentRunResponseWait for an experiment run to reach a terminal status.
paramrun_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.