Skip to main content

Trace ingestion client for Torina — captures LLM agent traces and forwards them over HTTP.

Project description

torina

Captures LLM agent traces and forwards them to Torina. LangChain is the only supported integration for now — more are planned.

Quickstart

1. Create an API key

Create one at app.torina.io/profile?section=api-keys.

2. Install

uv add torina
# or
pip install torina

3. Add instrumentation

import os
import torina

torina.auto_instrument()
torina.init_logger(
    api_key=os.environ["TORINA_API_KEY"],
    project="My Project (Python)",
)

auto_instrument() patches LangChain automatically if it's installed, so every agent.invoke()/.stream() call anywhere in your app gets captured with no per-call-site changes.

Traces go to https://app.torina.io/api/traces by default. Pass endpoint= or set TORINA_ENDPOINT to point at a self-hosted or dev instance instead.

Capturing conversations, agent names, and metadata

These all come from LangChain's own config/create_agent(name=...), no Torina-specific code needed:

agent = create_agent(..., name="weather-agent")  # -> payload["agent_name"]

agent.invoke(
    {"messages": [...]},
    config={
        "configurable": {"thread_id": thread_id},  # -> payload["conversation_id"]
        "metadata": {"user_id": "u_123", "plan": "enterprise"},  # -> payload["metadata"]
    },
)

Manual instrumentation

For control over a specific call site instead of the global patch, TorinaCallbackHandler is available directly (requires langchain-core):

from torina.langchain import TorinaCallbackHandler

agent.invoke({"messages": [...]}, config={"callbacks": [TorinaCallbackHandler()]})

dry_run

torina.init_logger(dry_run=True)  # no api_key or endpoint needed

Traces are logged instead of sent — useful for local testing before you have a real endpoint. Same code path either way; dry_run only swaps the network call for a log line.

Contributing

See CONTRIBUTING.md for local development, the release process, and notes on how traces are structured internally.

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

torina-0.1.2.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

torina-0.1.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: torina-0.1.2.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for torina-0.1.2.tar.gz
Algorithm Hash digest
SHA256 846960720539a1cb3538fc5726040653508dcc58700561428ced8e00ff35de3b
MD5 9c3d4fae58fd58a44bad757c3092a74d
BLAKE2b-256 fdcd1a3ca45b3aa79217f6fcca8156f4a1417e7f2d7f8c4199329358e218c1f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: torina-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for torina-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a4a4d288707a6f3d81f70fc68ccd2d5fc2588f0dcfee5ffc43eda576cc517b49
MD5 ec2b5d138036d294685b2324ba1589fd
BLAKE2b-256 5ae190fadf8c7d3a98ca89b8a0f3e1e64e516478970078961af9e500b4130617

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