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},
    cost=usage.total_tokens * 0.000005,
    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.1.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.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: runlens_sdk-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 1cee1fb8a1ae18d1fadb2ab383cdd1eb156f6d130f9d5da4aa810c8d15cb1917
MD5 7bf230b49767d0a6662d7bb5cfb1d7aa
BLAKE2b-256 463bb17a721711a8ba3a252111e32c3c5cbd653ea03260bfcd49fec5c414d72d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: runlens_sdk-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a1d07695c1cbe8f87ca35c7335b0f2ee8e35337a87d3fbe20fbab806fc4d9cf
MD5 c8258a4a40f1df3e1b2a5cc0e1046173
BLAKE2b-256 46a6c6259a6a392ff46653f7d457f35a6a7b1179fd74b20c701be3a371dc6183

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