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://your-runlens-api.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.0.tar.gz (4.6 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.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: runlens_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 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.0.tar.gz
Algorithm Hash digest
SHA256 edd552b40903857f0a846a3326a66507b45df7cb0a1124d90c1b0e6f81d79621
MD5 1e7b5ed085d93296357275e7dfbf8960
BLAKE2b-256 e999a14c554e5da69ee07cc53cc828005b88a967249edda6f0c4a1bf98550426

See more details on using hashes here.

File details

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

File metadata

  • Download URL: runlens_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2104a24255efeb31d044d08752379d963a11eeb6247a987878f2fec425803b72
MD5 3aeab543255d77c5da43d5ea7af27800
BLAKE2b-256 204701c2cb793fc431b988d92280676953fb249af78dd3ce1751be9a40cef4b0

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