Send your first trace
Connect an application to KNet Traces — API keys, environment variables, and a working Python example.
There are two ways traces reach KNet Traces, and only one of them needs setup.
K-Net workflows are traced automatically
If your work runs as a K-Net workflow, you do not need to do anything. The platform derives an ingestion key for your workspace and exports traces for you. Open flow.knetai.com/traces, pick your workspace, and the runs are already there.
Keys minted this way appear with a pk-lf-traces- / sk-lf-traces- prefix.
That is expected — it marks them as platform-issued so they are easy to tell
apart from keys you create yourself. Both kinds work the same way.
Instrumenting your own application
KNet Traces is built on Langfuse, so you instrument your code with the standard Langfuse SDKs and simply point them at KNet.
1. Create an API key
In Traces, go to Project Settings → API Keys and create a key pair. Copy the secret key when it is shown — it is not displayed again.
2. Set the environment variables
LANGFUSE_SECRET_KEY="sk-lf-..."
LANGFUSE_PUBLIC_KEY="pk-lf-..."
LANGFUSE_BASE_URL="https://flow.knetai.com/traces"The /traces suffix on the base URL matters. KNet Traces is served under that
path, and the SDK appends its API routes to whatever you give it — omitting it
produces authentication errors that look like bad keys.
3. Install the SDK
pip install langfuse4. Trace an LLM call
The quickest start is the OpenAI drop-in. Change the import and every call is recorded, with no other edits:
from langfuse.openai import openai
completion = openai.chat.completions.create(
name="test-chat",
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is observability?"},
],
)To trace your own functions, not just model calls, use the @observe()
decorator:
from langfuse import observe
@observe()
def handle_request(question: str) -> str:
return answer(question)For finer control, open observations explicitly with the context manager:
from langfuse import get_client
langfuse = get_client()
with langfuse.start_as_current_observation(
as_type="span", name="process-request"
) as span:
# your processing logic here
span.update(output="Processing complete")5. Confirm it arrived
Open your project in Traces and look at Tracing. Your run should appear within a few seconds, with the prompt, model, output, latency and token cost attached.
Other languages and frameworks
The same environment variables work across the Langfuse SDK family — JS/TS,
plus integrations for LangChain, LlamaIndex, and others. Point them at the same
LANGFUSE_BASE_URL and use the keys from your project. See the
Langfuse SDK documentation for the full reference
for each language and framework.
If nothing shows up
- Check
LANGFUSE_BASE_URLends in/traces. - Confirm the key pair belongs to the project you are looking at — keys are per-project, and a key from another workspace authenticates but writes somewhere else.
- Short-lived scripts can exit before the SDK flushes. Call
langfuse.flush()before the process ends.
Still stuck? See Getting help.

