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.

The company's tools (Get started, step 3)

redline.agent_tools() gives your agent the tools of the apps switched on for it on its Tools tab in Redline, and its skills, ready for any framework: each has name, description, inputSchema (JSON Schema) and call(arguments) → str. Hand each to your framework's JSON-Schema tool constructor, and ask again per conversation or message so a change on the Tools tab, or a new skill, counts.

from redline import agent_tools

tools = agent_tools(agent="support-agent")
# Pydantic AI:  Tool.from_schema(lambda **a: t["call"](a), name=t["name"], description=t["description"], json_schema=t["inputSchema"])
# LangChain:    StructuredTool(name=t["name"], description=t["description"], args_schema=t["inputSchema"], func=lambda **a: t["call"](a))
# Agno:         Function(name=…, description=…, parameters=t["inputSchema"], entrypoint=lambda **a: t["call"](a), skip_entrypoint_processing=True)
# CrewAI:       a BaseTool with args_schema=create_model_from_schema(t["inputSchema"]) and _run calling t["call"]

An app has hundreds of tools (Zendesk 656, Stripe 612), more than a model takes in one call. Past listed tools (default 40) the app tools are deferred, as eveTools does in the TypeScript SDK: the model gets redline_search_tools to find one by what it does and redline_call_tool to call it by name, and the skills stay listed. openai_tools() does the same for OpenAI's chat completions; get_tools() / execute_tool() are the raw list and the raw call.

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.7

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.7
File Size Uploaded Provenance
redlineai_sdk-0.3.7.tar.gz 19.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 43.0 kB

Release files / redlineai_sdk-0.3.7.tar.gz

Download URL redlineai_sdk-0.3.7.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8393b753109296c00b15669c539a7ed71067ed330d9d9c6304c18c823df090b5
BLAKE2b-256 checksum
How to use checksums
da097d212caec72dce8b9fca5ec0c15b60b576e0db1060eaf9f499c20ff9c467
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.7-py3-none-any.whl

Download URL redlineai_sdk-0.3.7-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
283c5c946cdd402cfb8839fe87cd38e08ccbf7dc27137bc3f1209d953320dc6b
BLAKE2b-256 checksum
How to use checksums
b1bc2685317e6abafac4aaae8c2329641ee43e530438c066259e7f74375f366e
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.7

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.7 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