Skip to main content

redlineai-sdk

Records what your AI agent did — every model call, tool call and step — and sends it to your Redline project. The tracing API is Langfuse's Python SDK (MIT, langfuse 5.x), so an agent is instrumented exactly as it would be for Langfuse.

pip install redlineai-sdk
import redline
from redline import observe, propagate_attributes

redline.init(api_key="rl_…", url="https://your-redline-server")

@observe(as_type="agent")           # a step per call: input, output, timing, errors, nesting
def answer(question: str) -> str:
    ...                             # model calls inside are recorded too (see below)

@observe(as_type="tool")
def lookup_order(order_id: str) -> dict:
    ...

with propagate_attributes(session_id="chat-42", user_id="customer-7", tags=["support"]):
    answer("Where is my order?")    # every call in the same session_id is one conversation

api_key and url can come from REDLINE_API_KEY and REDLINE_URL instead. init() returns the client (also get_client()); call redline.flush() before a short script exits.

What Langfuse's SDK gives you here

@observe(name=, as_type=, capture_input=, capture_output=) a span per call; as_type: span, generation, agent, tool, chain, retriever, embedding, evaluator, guardrail, event
propagate_attributes(session_id=, user_id=, tags=, metadata=, version=, trace_name=) trace fields for everything inside the block
get_client().start_as_current_observation(...), start_observation(...) spans without a decorator
get_client().update_current_span(...), update_current_generation(model=, usage_details=, cost_details=, ...) fill in the current step
LangfuseMedia(content_bytes=, content_type=) images, audio and files, uploaded to Redline and shown in the app; set them as an observation's input, output or metadata (update_current_generation(input=...)) — Langfuse's SDK uploads media only from those fields
redline.openai Langfuse's OpenAI drop-in: from redline.openai import OpenAI
redline.langchain.CallbackHandler Langfuse's LangChain handler (see LangChain below)

Recorded without code

init() records the libraries your agent uses, each only when it is installed, the way Langfuse's integration page for that library records it (langfuse-docs, src/redline/_integrations.py):

Library How (Langfuse's page)
OpenAI and every OpenAI-compatible API (DeepSeek, Groq, Together, Ollama, xAI, Qwen, Hugging Face…), Instructor, Ragas Langfuse's OpenAI drop-in, switched on for every client (model-providers/openai-py)
LangChain, LangGraph, Deep Agents Langfuse's LangChain handler on every run; session, user and tags from propagate_attributes or the run's metadata (langfuse_session_id, langfuse_user_id, langfuse_tags) (frameworks/langchain)
Anthropic OpenLLMetry's opentelemetry-instrumentation-anthropic (model-providers/anthropic)
LiteLLM LiteLLM's langfuse_otel callback (frameworks/litellm-sdk)
Pydantic AI its own spans, Agent.instrument_all() (frameworks/pydantic-ai)
Strands, Amazon AgentCore Strands' own spans (frameworks/strands-agents)
Microsoft Agent Framework its own spans with sensitive data on (frameworks/microsoft-agent-framework)
LiveKit Agents its own spans, all of them sent (frameworks/livekit)
Agno OpenLIT's Agno instrumentor — pip install "redlineai-sdk[agno]" (frameworks/agno-agents)
LlamaIndex, CrewAI, OpenAI Agents, DSPy, Haystack, smolagents, Google ADK, Claude Agent SDK, Gemini, Vertex AI, Groq, TypeSafe OpenInference instrumentors, as on their pages; BeeAI with pip install "redlineai-sdk[beeai]"
Bedrock, Mistral, Cohere, Ollama, Together SDKs, MCP OpenInference instrumentors (Langfuse has no automatic integration for these)
Pipecat, Mirascope, Semantic Kernel, AutoGen as on their Langfuse pages: Pipecat PipelineTask(enable_tracing=True), Mirascope @with_langfuse(), AutoGen's own spans; their model calls through OpenAI are recorded by the drop-in

Langfuse's pages switch on one integration at a time; init() switches on all installed ones. When one library runs on another (LangChain, OpenAI Agents or LlamaIndex on the OpenAI client), the model client's record of a call made inside a model call another integration records is not sent, so each model call is one generation. Spans are sent with Langfuse's default filter (is_default_export_span), plus LiveKit's.

init(auto_instrument=False) turns all of this off.

If your app already set up OpenTelemetry, init() records into your tracer provider instead of replacing it.

Scores

from redline import get_client

langfuse = get_client()
langfuse.score_current_trace(name="user-feedback", value=1, data_type="BOOLEAN", comment="thumbs up")
langfuse.score_current_span(name="relevance", value=0.7)
langfuse.create_score(trace_id=..., observation_id=..., name="tone", value="friendly")  # CATEGORICAL

Tests from Redline (Experiments, Workflows)

redline.serve() takes the tests Redline gives your agent (Experiments → "New experiment", Workflows → "Run") and runs each one with your own code, in any framework. Return the agent's reply; raising fails the step.

redline.init()

def run(task: str, step: redline.Step) -> str:
    # a workflow's steps come in order in one session: keep the conversation by step.session_id
    return support_agent.run_sync(task, message_history=history(step.session_id)).output

redline.serve(agent="support-agent", run=run)                  # blocks; block=False runs it in a thread
await redline.serve_async(agent="support-agent", run=run)      # inside an event loop; run may be async

While it runs, the agent is connected on the Experiments page. Each step is recorded as one run under the test's session (propagate_attributes(session_id=…), an agent observation with the task as input and the reply as output). One test at a time.

Already on Langfuse's SDK

Keep your code and point it at Redline:

LANGFUSE_BASE_URL=https://your-redline-server
LANGFUSE_PUBLIC_KEY=pk-bt-<project id>     # shown on the Setup page
LANGFUSE_SECRET_KEY=rl_…

Tested with: langfuse 5.0.2, langchain 1.4 / langchain-core 1.6 / langgraph 1.2 (create_agent, invoke, ainvoke, stream), openai 3.33, openai-agents (Runner.run), scores.

Metadata

Release files for redlineai-sdk 0.3.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redlineai-sdk 0.3.6
File Size Uploaded Provenance
redlineai_sdk-0.3.6.tar.gz 16.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for redlineai-sdk 0.3.6
File Interpreter ABI Platform
redlineai_sdk-0.3.6-py3-none-any.whl Python 3 none any Details

Total release size: 36.5 kB

Release files / redlineai_sdk-0.3.6.tar.gz

Download URL redlineai_sdk-0.3.6.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c3e7fe5bb33aff1cfb2e022f8f5a4e64fb488bc90b74f327bff2bd9d766c2aea
BLAKE2b-256 checksum
How to use checksums
4f50c7e4e02b8ba51e87b02070d88a243e8256991ec33e85d618921c9d9ea0e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Release files / redlineai_sdk-0.3.6-py3-none-any.whl

Download URL redlineai_sdk-0.3.6-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
66dcfa3b3b7142768d8404d9a872b5819ba730aaffd40c01fd4304ef0ef6c239
BLAKE2b-256 checksum
How to use checksums
743d1eb60e9f6ee8bc943b4136ccdf57d0613a9089085cd8ef95b11eed2e8132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.11

Security for redlineai-sdk 0.3.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.6 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page