Skip to main content

Lightweight local-first tracing SDK for Python LLM applications

Project description

LangFeather Python SDK

English README

LangFeather Python SDK는 LangChain·LangGraph 실행과 일반 Python 코드를 local LangFeather collector로 보냅니다. SDK는 application의 실행 결과를 바꾸지 않도록 백그라운드에서 best-effort로 전송합니다.

시작하기 전에 local collector와 UI를 실행하세요. 전체 설치 방법은 프로젝트 README를 참고하세요.

설치

LangChain 또는 LangGraph application에는 optional extra를 설치합니다.

pip install "langfeather[langchain]"

일반 Python 함수나 ASGI application만 관측한다면 core package만 설치하면 됩니다.

pip install langfeather

SDK endpoint는 다음 우선순위로 결정됩니다.

  1. langfeather.configure(endpoint="http://...")
  2. endpoint를 생략했을 때 LANGFEATHER_ENDPOINT
  3. 기본값 http://127.0.0.1:4319

Host에서 application을 실행하면 기본 endpoint를 그대로 사용할 수 있습니다. 같은 Docker Compose network 안의 application container에서는 http://langfeather:4319처럼 collector service 주소를 지정하세요.

사용법

StateGraph.compile()의 결과처럼 실제로 호출하는 최상위 Runnable을 감쌉니다.

import langfeather

langfeather.configure(endpoint="http://127.0.0.1:4319")
graph = langfeather.wrap_runnable(compiled_graph, name="my-langgraph-app")

result = graph.invoke(
    {"question": "검색 결과를 요약해줘"},
    {"configurable": {"thread_id": "example-session"}},
)

# 짧게 끝나는 CLI/script에서는 종료 전에 호출합니다.
langfeather.flush(timeout=2)

UI에서 새 trace를 열어 root graph와 내부 Runnable·LLM·retriever·tool 실행을 확인하세요. 기존 입력, 출력, streaming chunk, 예외는 wrapper를 씌우기 전과 같은 형태로 application에 전달됩니다.

다음 문서

최소 API

import langfeather

langfeather.configure(endpoint="http://127.0.0.1:4319")

@langfeather.observe(name="retrieve_documents", kind="retriever")
def retrieve_documents(query: str) -> list[str]:
    with langfeather.span("local_lookup", input={"query": query}) as operation:
        documents = ["document"]
        operation.set_output(documents)
    return documents

@observe는 동기 함수, coroutine, generator, async generator를 지원합니다. 직접 provider SDK를 호출하거나 LangChain callback에 나타나지 않는 도구는 @observe(kind="tool") 또는 span(kind="tool")으로 감싸세요.

데이터와 전달의 경계

LangFeather는 debugging을 위해 trace payload를 자동으로 redact, truncate, summarize, sample하지 않습니다. 실제 secret이나 production data를 공유 database에 넣지 마세요.

전송은 bounded in-memory queue와 짧은 retry를 사용하는 best-effort 방식입니다. collector가 없거나 queue가 가득 차도 application의 반환값이나 예외를 바꾸지 않지만, 그 trace는 유실될 수 있습니다. flush()True를 반환해도 SDK가 collector에 전달 처리를 마쳤다는 뜻일 뿐, 서버 database에 저장됐다는 end-to-end 보장은 아닙니다. 자세한 운영 의미는 전송과 제약을 확인하세요.

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

langfeather-0.3.1.tar.gz (44.4 kB view details)

Uploaded Source

Built Distribution

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

langfeather-0.3.1-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

Details for the file langfeather-0.3.1.tar.gz.

File metadata

  • Download URL: langfeather-0.3.1.tar.gz
  • Upload date:
  • Size: 44.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for langfeather-0.3.1.tar.gz
Algorithm Hash digest
SHA256 4379b4762b400b89b2780b702a6abbeda79fe6d5143fd9b55e1027d3effb9c66
MD5 f3493ba9b1345c3f2294ea46a7ef273b
BLAKE2b-256 3cd852070cf45dce3210218942351db5e3b7000e0885a996b7a138d3935bf974

See more details on using hashes here.

Provenance

The following attestation bundles were made for langfeather-0.3.1.tar.gz:

Publisher: release.yml on SungjinWi99/LangFeather

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langfeather-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: langfeather-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for langfeather-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 60e7ff95f49c2b048b0ef98a120361c4bfb8fd0c8505ca3ca0f86fc9b3bdd9d8
MD5 5a94661c5be8ac672b5db0d40dc9276b
BLAKE2b-256 e1d2af14271c6b49de1c5a4160778484683c434cb0266499cb44106b8e518543

See more details on using hashes here.

Provenance

The following attestation bundles were made for langfeather-0.3.1-py3-none-any.whl:

Publisher: release.yml on SungjinWi99/LangFeather

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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