Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.trulayer.ai/llms.txt

Use this file to discover all available pages before exploring further.

The demo-python repository contains a curated set of standalone scripts that show every public surface of the trulayer SDK end-to-end. Each example is intentionally small — one concept per file — so you can copy a pattern straight into your own app.
Status: alpha. The demo scripts currently pin the SDK from a local sibling path while we cut the first public release. Standalone clones will fail to install until trulayer 0.1.0 is on PyPI. Track the release in the demo-python repo. Once 0.1.0 ships, this notice will be removed.

What’s in the repo

  • 11 runnable examples under examples/, one per SDK concept (manual tracing, auto-instrumentation, RAG, agents, streaming, feedback, async, LangChain).
  • A local mock ingestion server (examples/mock_server.py) so you can run every example offline.
  • A pytest suite (tests/test_examples.py) that asserts each script’s payload shape end-to-end.

Clone and run

git clone https://github.com/trulayer/demo-python.git
cd demo-python
cp .env.example .env      # add TRULAYER_API_KEY and provider keys
uv sync
uv run python -m examples.basic_trace
To run every example against the bundled mock server (no network, no real keys):
TRULAYER_DEMO_MOCK=1 uv run python -m examples.run_all

Representative examples

basic_trace.py

Manual trace() and span() around a real OpenAI call — the smallest possible end-to-end example.

openai_auto.py

instrument_openai() — patches the client so every chat.completions.create becomes a span automatically.

rag_pipeline.py

Embed → retrieve → generate, captured as three typed spans (retrieval, llm) inside one trace.

agent.py

Tool-calling agent loop, with one span per tool invocation and one per LLM turn.

feedback.py

Trace an answer, then attach a thumbs-up FeedbackData record to it via submit_feedback().
For the full list, see the examples directory on GitHub.

Where to go next

Tutorial

Build the same patterns from scratch with a step-by-step walkthrough.

Reference

Every public export, with signatures and types.