Skip to main content

kairos-sdk (Python)

The flight recorder for autonomous operations.

Instrument any AI agent in 3 lines. Every prompt, decision, tool call, and failure — captured, replayable, and governable.

Install

pip install kairos-sdk

Optional — faster HTTP (recommended):

pip install kairos-sdk[http]

Quickstart

from kairos import create_kairos

kairos = create_kairos()

exec = kairos.execution(workflow_name="research-agent")

exec.set_prompt(user_prompt, model="claude-sonnet-4-6")
exec.tool_call("web_search", input={"query": query}, output=results, latency_ms=1200)
exec.decision("Selected most credible source", confidence=0.91)

exec.complete(output)

Open your Kairos dashboard to see the execution replay.

LangChain integration

from kairos import create_kairos

kairos = create_kairos()

class KairosCallbackHandler(BaseCallbackHandler):
    def __init__(self, exec):
        self.exec = exec

    def on_llm_start(self, serialized, prompts, **kwargs):
        self.exec.set_prompt(prompts[0])

    def on_tool_start(self, serialized, input_str, **kwargs):
        self._tool_start = time.time()
        self._tool_name = serialized.get("name", "tool")
        self.exec._emit("tool_called", {"name": self._tool_name, "input": input_str})

    def on_tool_end(self, output, **kwargs):
        latency = int((time.time() - self._tool_start) * 1000)
        self.exec._emit("tool_completed", {"name": self._tool_name, "output": str(output)}, latency_ms=latency)

    def on_chain_end(self, outputs, **kwargs):
        self.exec.complete(outputs.get("output"))

exec = kairos.execution(workflow_name="langchain-agent")
handler = KairosCallbackHandler(exec)
agent.run(query, callbacks=[handler])

API

create_kairos(base_url?, debug?)

kairos = create_kairos(
    base_url="https://kairos-production-64c5.up.railway.app",  # default
    debug=False,
)

kairos.execution(workflow_name?, agent_id?)

Returns a KairosExecution builder.

Method Description
.set_prompt(prompt, model?) Record the prompt sent to the model
.set_model(model) Set the model name
.set_tokens(prompt_tokens, completion_tokens) Set token counts
.set_cost(usd) Set cost in USD
.tool_call(name, input?, output?, latency_ms?) Record a tool call
.decision(reasoning, confidence?) Record a model decision
.policy_check(policy, result) Record a policy check
.memory_write(key, value?) Record a memory write
.memory_read(key, value?) Record a memory read
.retry(attempt, reason?) Record a retry
.event(type, payload?) Emit any custom event
.complete(output?) Finish execution as completed
.fail(error) Finish execution as failed

License

MIT

Metadata

Release files for kairos-trace 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kairos-trace 0.1.1
File Size Uploaded Provenance Actions
kairos_trace-0.1.1.tar.gz 3.5 kB Without provenance Details for kairos_trace-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kairos-trace 0.1.1
File Interpreter ABI Platform Actions
kairos_trace-0.1.1-py3-none-any.whl Python 3 none any Details for kairos_trace-0.1.1-py3-none-any.whl

Total release size: 7.6 kB

Release files / kairos_trace-0.1.1.tar.gz

Download URL kairos_trace-0.1.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
813132542e50612d2a920c146b14c9c4a25c289fd3071ed0368238b9947b67cc
BLAKE2b-256 checksum
How to use checksums
44901a859ef42d5f99449204c7f2b5918ad1a189caaae1a9425f6c4d91be34e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / kairos_trace-0.1.1-py3-none-any.whl

Download URL kairos_trace-0.1.1-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a355fc0c4477f2bbab5f190a2d77fa3bc0ad5e423434bd3fce9020d5718e619
BLAKE2b-256 checksum
How to use checksums
3645614250ff3dc51901ccff58948bb000072498e8f52190afe005cd4ecf3313
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for kairos-trace 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page