KitaruClient

Kitaru client.

Kitaru client.

Attributes

attributeapiKitaruAPIClient

API client with one method per endpoint.

Functions

constructor__init__(api_client=None) -> None

Initialize the client.

paramapi_clientKitaruAPIClient | None
= None

API client used to send requests.

Returns

None
funcclose() -> None

Close the underlying API client.

Returns

None
funcget_agent(agent) -> AgentResponse

Get an agent by id or name.

paramagentuuid.UUID | str

Id or name of the agent.

Returns

kitaru.api_models.v1.agent.AgentResponse

Stored agent.

funcregister_agent(name, run_spec, *, description=None, display_version=None, version_description=None, capabilities=None, agent_idempotency_key=None, version_idempotency_key=None) -> AgentRegistrationResult

Create 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.

paramnamestr

New agent name.

paramrun_specRunSpec

Run spec for the initial version.

paramdescriptionstr | None
= None

Agent description.

paramdisplay_versionstr | None
= None

Human-readable designator for the initial version.

paramversion_descriptionstr | None
= None

Initial version description.

paramcapabilitiesAgentCapabilities | None
= None

Initial version capabilities.

paramagent_idempotency_keystr | None
= None

Idempotency key for agent creation.

paramversion_idempotency_keystr | None
= None

Idempotency key for version creation.

Returns

kitaru.client.AgentRegistrationResult

Created agent and initial version.

funcregister_agent_version(agent, run_spec, *, display_version=None, description=None, capabilities=None, idempotency_key=None) -> AgentVersionResponse

Create the next version of an existing agent.

paramagentuuid.UUID | str

Id or exact name of the agent.

paramrun_specRunSpec

Run spec for the new version.

paramdisplay_versionstr | None
= None

Human-readable version designator.

paramdescriptionstr | None
= None

Version description.

paramcapabilitiesAgentCapabilities | None
= None

Version capabilities.

paramidempotency_keystr | None
= None

Idempotency key for version creation.

Returns

kitaru.api_models.v1.agent_version.AgentVersionResponse

Created agent version.

funclist_agents() -> AsyncIterator[AgentResponse]

Iterate over all agents.

Returns

collections.abc.AsyncIterator

Async iterator over every agent.

funcget_session(session_id) -> SessionDetailResponse

Get a session by id.

paramsession_iduuid.UUID

Id of the session.

Returns

kitaru.api_models.v1.session.SessionDetailResponse

Stored session.

funclist_sessions(agent=None) -> AsyncIterator[SessionResponse]

Iterate over sessions, optionally scoped to one agent.

paramagentuuid.UUID | str | None
= None

Id or name of the agent to scope to.

Returns

collections.abc.AsyncIterator

Async iterator over every matching session.

funclist_session_nodes(session_id) -> AsyncIterator[SessionNodeResponse]

Iterate over the nodes of a session in index order.

paramsession_iduuid.UUID

Id of the session.

Returns

collections.abc.AsyncIterator

Async 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) -> ReplayResponse

Replay a session and optionally wait for it to finish.

paramsession_iduuid.UUID

Id of the session to replay.

paramevaluatorslist[EvaluatorConfig]

Evaluators run against the result session.

paramagent_version_iduuid.UUID | None
= None

Agent version to replay with, the session's recorded version when unset.

paramoverrideReplayOverride | None
= None

Override to apply.

paramtool_policyToolPolicy | None
= None

Tool policy to apply.

parambaseline_evaluation_modeBaselineEvaluationMode
= BaselineEvaluationMode.IF_MISSING

How to score the baseline session.

paramwaitbool
= True

Whether to wait for the replay to reach a terminal status.

paramtimeoutfloat | None
= None

Seconds to wait before giving up.

Returns

kitaru.api_models.v1.replay.ReplayResponse

Replay, in a terminal status when waited for.

funcget_replay(replay_id) -> ReplayResponse

Get a replay by id.

paramreplay_iduuid.UUID

Id of the replay.

Returns

kitaru.api_models.v1.replay.ReplayResponse

Stored replay.

funcwait_for_replay(replay_id, timeout=None, poll_interval=2.0) -> ReplayResponse

Wait for a replay to reach a terminal status.

paramreplay_iduuid.UUID

Id of the replay.

paramtimeoutfloat | None
= None

Seconds to wait before giving up.

parampoll_intervalfloat
= 2.0

Seconds between status checks.

Returns

kitaru.api_models.v1.replay.ReplayResponse

Replay in a terminal status.

funcget_experiment(experiment) -> ExperimentResponse

Get an experiment by id or name.

paramexperimentuuid.UUID | str

Id or name of the experiment.

Returns

kitaru.api_models.v1.experiment.ExperimentResponse

Stored experiment.

funclist_experiments() -> AsyncIterator[ExperimentResponse]

Iterate over all experiments.

Returns

collections.abc.AsyncIterator

Async iterator over every experiment.

funcrun_experiment(experiment, cohort_version_id, agent_version_id, baseline_evaluation_mode=BaselineEvaluationMode.IF_MISSING, wait=True, timeout=None) -> ExperimentRunResponse

Start an experiment run and optionally wait for it to finish.

paramexperimentuuid.UUID | str

Id or name of the experiment.

paramcohort_version_iduuid.UUID

Cohort version whose sessions are replayed.

paramagent_version_iduuid.UUID

Agent version to replay with.

parambaseline_evaluation_modeBaselineEvaluationMode
= BaselineEvaluationMode.IF_MISSING

How to score each baseline session.

paramwaitbool
= True

Whether to wait for the run to reach a terminal status.

paramtimeoutfloat | None
= None

Seconds to wait before giving up.

Returns

kitaru.api_models.v1.experiment_run.ExperimentRunResponse

Experiment run, in a terminal status when waited for.

funcget_experiment_run(run_id) -> ExperimentRunResponse

Get an experiment run by id.

paramrun_iduuid.UUID

Id of the experiment run.

Returns

kitaru.api_models.v1.experiment_run.ExperimentRunResponse

Stored experiment run.

funcwait_for_experiment_run(run_id, timeout=None, poll_interval=2.0) -> ExperimentRunResponse

Wait for an experiment run to reach a terminal status.

paramrun_iduuid.UUID

Id of the experiment run.

paramtimeoutfloat | None
= None

Seconds to wait before giving up.

parampoll_intervalfloat
= 2.0

Seconds between status checks.

Returns

kitaru.api_models.v1.experiment_run.ExperimentRunResponse

Experiment run in a terminal status.

On this page