Docs

    Get started

    Install the SDK

    Install syntropylabs-evalkit for Python or TypeScript, call init() once with your environment key, add your framework's middleware and send a first trace.

    The EvalKit SDK runs inside your application and sends its traces to the Environment whose key you pass to init(). This page covers Python and TypeScript.

    The in-app quickstart shows the same snippets with your real key filled in. Open it from the Install SDK step on Home, or with Install guide on the Environments tab. It has a tab for each SDK (Python, TypeScript, Go and Java), one for coding agents, and a Framework switch. The Go and Java tabs show manual-instrumentation snippets.

    To have your coding agent do these steps, paste this prompt into it. Set up with a coding agent explains what it does.

    Copy for your coding agent
    Read https://syntropylabs.ai/docs/evalkit-skill.md, save it as a skill or rule for this repository as it describes, then integrate EvalKit into this project following it. Ask me for the environment key's variable name if the project doesn't have one, and never write the key itself into a file.

    1. Install

    pip install syntropylabs-evalkit      # installs as syntropylabs-evalkit, imported as evalkit

    2. Initialize once, as early as possible

    Call init() once at startup, before the modules that make requests are loaded, so auto-instrumentation can hook the libraries. The only required option is the environment key. service_name is the name the Services view and the trace list show. environment should match the kind of the Environment the key belongs to.

    import evalkit
    
    evalkit.init(
        subscription_key="tk_live_...",   # the environment key
        service_name="my-service",
        environment="development",        # development | staging | production
    )
    
    # Every OpenAI / Anthropic / HTTP / DB call from here on is traced automatically.
    from openai import OpenAI
    
    resp = OpenAI().chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": "Hello!"}],
    )
    
    evalkit.flush()   # before a short-lived process exits

    3. Add the middleware for your framework

    With the middleware, each incoming request becomes one root trace and every model, tool, HTTP and database call inside it nests underneath. Without it, Python calls are still traced, each as its own trace. In TypeScript, init() already makes each request to a Node.js HTTP or HTTPS server a trace; the Fastify, Koa, Hono and hapi adapters name its span by route, as Supported frameworks shows. Each framework there has its own guide and tutorial.

    # FastAPI / Starlette
    from evalkit import EvalKitMiddleware
    app.add_middleware(EvalKitMiddleware)
    
    # Flask
    evalkit.instrument_flask(app)
    
    # Django: add to MIDDLEWARE
    "evalkit.EvalKitDjangoMiddleware"

    4. Make one request

    Run your app and send it one request. The quickstart checks the Environment for a trace every 5 seconds for the first two minutes, then every 15 seconds. After 30 minutes with no trace it stops and offers Check again.

    When the trace arrives, the page shows "First trace received" with the operation, latency, span count and model, and a View trace button. Continue in Your first trace.

    Home's checklist marks Install SDK and Receive first trace as done on its next load. It reads them from the Environment's traces of the last month, not from a stored flag, so a project instrumented entirely from a terminal is already checked off.

    If no trace arrives

    After two minutes with no trace, the quickstart lists the usual causes:

    • A 401 from the ingest endpoint means the key in your config does not match this Environment. Copy it again from the Environments tab.
    • The process must be able to reach api.syntropylabs.ai. Check egress rules and proxies.
    • A short script can exit before the batch is sent. Call flush() at the end, or keep the process alive.
    • Traces arrive in the Environment whose key you used. If you are looking at another one, switch it in the top bar.

    If a check itself fails, the quickstart stops and shows "Could not check for traces" with Retry.

    The SDK can also say what happened to the spans. From 0.3.6, evalkit.stats() in Python and evalkit.getStats() in TypeScript give the spans queued, exported and dropped, the last export error and whether exporting is paused. One warning from init() at startup means an option cannot work and the SDK is off. A serverless function must flush before it returns; see Serverless and edge runtimes and Troubleshooting.

    What is traced automatically

    CategoryPythonTypeScript
    LLM clientsOpenAI, Anthropic, Bedrock (boto3 and aiobotocore), Cohere, Google GenAI and Vertex, MistralOpenAI, Anthropic, Bedrock, Cohere, Google, Vertex, LangChain
    FrameworksLangChain and LangGraph, LlamaIndex, LiteLLM, Google ADK, Claude Agent SDK, MCP clients; see Supported frameworksLangChain and LangGraph, LlamaIndex, Google ADK, MCP clients
    HTTPrequests, httpx, httpx2 and aiohttp, with method, URL, status and latencyfetch, axios and node:http, with method, URL, status and latency
    Databasespsycopg 3, psycopg2, asyncpg, PyMySQL, PyMongo and Redis, with query text and latency; SQLAlchemy after one patch call per enginePostgres, MySQL, MongoDB and Redis, with query text and latency
    Your own codeFunctions in your app's source tree, on by defaultOpt in per function, tool or class, or for the whole app on NestJS

    Next, add session_id, user_id and device_id so traces group into conversations and users. See Sessions and users. The full option list, content capture and masking are in Configuration and privacy.

    EvalKit is built by SyntropyLabs. Published on PyPI and npm.