Skip to main content

Debug and compare AI agent runs

Project description

runlens-sdk

Debug and compare AI agent runs.

Install

pip install runlens-sdk

Quickstart

import openai
from runlens import start_run, record_step, end_run

run = start_run(
    task="answer_question",
    context={
        "model": "gpt-4o",
        "prompt_version": "v1",
        "temperature": 0.7,
    },
    api_url="https://runlens-api.onrender.com",
)

prompt = "What is the capital of France?"
response = openai.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": prompt}],
)
answer = response.choices[0].message.content
usage = response.usage

record_step(
    run_id=run.id,
    step_type="llm_call",
    name="answer question",
    input={"prompt": prompt},
    output={"answer": answer},
    model="gpt-4o",           # cost is calculated automatically
    tokens=usage.total_tokens,
)

end_run(run.id)

Open your RunLens dashboard to inspect the run and compare it against others.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

runlens_sdk-0.1.2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

runlens_sdk-0.1.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file runlens_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: runlens_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for runlens_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ef3223ec5ca9452e4ef85d3db6db448fbaf809baca52c798612160ed15fe6063
MD5 b3baf05bd2b97908cdea5bcb12231682
BLAKE2b-256 c6f12e7efd83e08f46e9ed27fe7e28481097436f284eed91dbf288cfd41c0cc6

See more details on using hashes here.

File details

Details for the file runlens_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: runlens_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for runlens_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 00a47a81af15968be38bcdbb7fa5bf89fa7bf5c4f7712430ad2d9bef218dbe26
MD5 b970853384c0954267ec55f203088009
BLAKE2b-256 380188e867f41e28968da72c84f72b478cc6c5ba4aeb4c985f4915156ad7b3fb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page