Sometimes, you need to trace a request across multiple services.LangSmith supports distributed tracing out of the box, linking runs within a trace across services using context propagation headers (langsmith-trace and optional baggage for metadata/tags).Example client-server setup:
Trace starts on client
Continues on server
Only accept distributed-tracing headers from trusted services. The langsmith-trace and baggage headers are consumed as trusted tracing context. Do not add TracingMiddleware (or pass inbound request headers as the tracing parent) on a service that receives requests directly from untrusted third parties or the public internet. Keep distributed tracing to internal, service-to-service calls, and strip these headers from untrusted inbound requests at your gateway or proxy. Trusting baggage from an external caller lets them influence how your runs are recorded.
# client.pyfrom langsmith.run_helpers import get_current_run_tree, traceableimport httpx@traceableasync def my_client_function(): headers = {} async with httpx.AsyncClient(base_url="...") as client: if run_tree := get_current_run_tree(): # add langsmith-id to headers headers.update(run_tree.to_headers()) return await client.post("/my-route", headers=headers)
Then the server (or other service) can continue the trace by handling the headers appropriately. If you are using an asgi app Starlette or FastAPI, you can connect the distributed trace using LangSmith’s TracingMiddleware.
The TracingMiddleware class was added in langsmith==0.1.133.
Example using FastAPI:
from langsmith import traceablefrom langsmith.middleware import TracingMiddlewarefrom fastapi import FastAPI, Requestapp = FastAPI() # Or Flask, Django, or any other frameworkapp.add_middleware(TracingMiddleware)@traceableasync def some_function(): ...@app.post("/my-route")async def fake_route(request: Request): return await some_function()
If you are using other server frameworks, you can always “receive” the distributed trace by passing the headers in through langsmith_extra:
# server.pyimport langsmith as lsfrom fastapi import FastAPI, Request@ls.traceableasync def my_application(): ...app = FastAPI() # Or Flask, Django, or any other framework@app.post("/my-route")async def fake_route(request: Request): # request.headers: {"langsmith-trace": "..."} # as well as optional metadata/tags in `baggage` with ls.tracing_context(parent=request.headers): return await my_application()
The example above uses the tracing_context context manager. You can also directly specify the parent run context in the langsmith_extra parameter of a method wrapped with @traceable.
# ... same as above@app.post("/my-route")async def fake_route(request: Request): # request.headers: {"langsmith-trace": "..."} my_application(langsmith_extra={"parent": request.headers})
Distributed tracing in TypeScript
Distributed tracing in TypeScript requires langsmith>=0.1.31
First, we obtain the current run tree from the client and convert it to langsmith-trace and baggage header values, which we can pass to the server:
Then, the server converts the headers back to a run tree, which it uses to further continue the tracing.To pass the newly created run tree to a traceable function, we can use the withRunTree helper, which will ensure the run tree is propagated within traceable invocations.
// server.mtsimport { RunTree } from "langsmith";import { traceable, withRunTree } from "langsmith/traceable";import express from "express";import bodyParser from "body-parser"; const server = traceable( (text: string) => `Hello from the server! Received "${text}"`, { name: "server" } ); const app = express(); app.use(bodyParser.text());app.post("/", async (req, res) => { const runTree = RunTree.fromHeaders(req.headers); const result = await withRunTree(runTree, () => server(req.body)); res.send(result);});
// server.mtsimport { RunTree } from "langsmith";import { traceable, withRunTree } from "langsmith/traceable";import { Hono } from "hono"; const server = traceable( (text: string) => `Hello from the server! Received "${text}"`, { name: "server" } ); const app = new Hono();app.post("/", async (c) => { const body = await c.req.text(); const runTree = RunTree.fromHeaders(c.req.raw.headers); const result = await withRunTree(runTree, () => server(body)); return c.body(result);});
Connect these docs to your agent of choice via MCP for real-time answers.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Docs by LangChain","description":"Documentation for LangSmith, Fleet, and our open source packages.","colors":{"primary":"#161F34","light":"#7FC8FF","dark":"#006DDD"},"logo":{"light":"https://mintcdn.com/langchain-5e9cc07a/nQm-sjd_MByLhgeW/images/brand/langchain-docs-dark-blue.png?fit=max\u0026auto=format\u0026n=nQm-sjd_MByLhgeW\u0026q=85\u0026s=5babf1a1962208fd7eed942fa2432ecb","dark":"https://mintcdn.com/langchain-5e9cc07a/nQm-sjd_MByLhgeW/images/brand/langchain-docs-light-blue.png?fit=max\u0026auto=format\u0026n=nQm-sjd_MByLhgeW\u0026q=85\u0026s=0bcd2a1f2599ed228bcedf0f535b45b1"},"favicon":{"light":"https://mintcdn.com/langchain-5e9cc07a/8njVp3mXF3LrAS1d/images/brand/docs-favicon.png?fit=max\u0026auto=format\u0026n=8njVp3mXF3LrAS1d\u0026q=85\u0026s=a61c2b4666f558992e1fd44750b08465","dark":"https://mintcdn.com/langchain-5e9cc07a/8njVp3mXF3LrAS1d/images/brand/docs-favicon.png?fit=max\u0026auto=format\u0026n=8njVp3mXF3LrAS1d\u0026q=85\u0026s=a61c2b4666f558992e1fd44750b08465"},"appearance":{"default":"system","strict":false},"background":{"color":{"light":"#FFFFFF","dark":"#030710"}},"navbar":{"links":[{"icon":"message","href":"https://chat.langchain.com/","label":"Ask AI"},{"icon":"brand-github","href":"https://github.com/langchain-ai","label":"GitHub"}],"primary":{"type":"button","label":"Try LangSmith","href":"https://smith.langchain.com/"}},"footer":{"socials":{"github":"https://github.com/langchain-ai","x":"https://x.com/LangChain","linkedin":"https://www.linkedin.com/company/langchain","youtube":"https://www.youtube.com/@LangChain"},"links":[{"header":"Resources","items":[{"label":"Forum","href":"https://forum.langchain.com/"},{"label":"Changelog","href":"https://changelog.langchain.com/"},{"label":"LangChain Academy","href":"https://academy.langchain.com/"},{"label":"Contact Sales","href":"https://www.langchain.com/contact-sales"}]},{"header":"Company","items":[{"label":"Home","href":"https://langchain.com/"},{"label":"Trust Center","href":"https://trust.langchain.com/"},{"label":"Careers","href":"https://langchain.com/careers"},{"label":"Blog","href":"https://blog.langchain.com/"}]}]},"seo":{"metatags":{"canonical":"https://docs.langchain.com","google-site-verification":"9_2KHeJwmEdwgncBRk1MsKxriZz7Sc21EJdbfCxkTEo"}},"fonts":{"heading":{"family":"TWK Lausanne","weight":700,"source":"fonts/TWKLausanne-700.woff2","format":"woff2"},"body":{"family":"Inter","weight":400}},"icons":{"library":"tabler"},"styling":{"eyebrows":"breadcrumbs","codeblocks":{"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}},"latex":true},"integrations":{"gtm":{"tagId":"GTM-MBBX68ST"}},"errors":{"404":{"redirect":false,"title":"Page not found","description":"We couldn't find the page you were looking for."}},"contextual":{"options":["copy","view",{"title":"llms.txt","description":"Open llms.txt for this site","icon":"file","href":"https://docs.langchain.com/llms.txt"},"chatgpt","claude","mcp","cursor","vscode"],"display":"header"},"interaction":{"drilldown":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"langchain-5e9cc07a","hasAudioNarration":false,"actualSubdomain":"langchain-5e9cc07a","customDomains":["docs.langchain.com"],"gitSource":{"type":"github","owner":"langchain-ai","repo":"docs","deployBranch":"prod","contentDirectory":"build","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":false,"issues":false},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b1016c000bab4ca313439f0","clientVersion":"0.0.4410","searchFilterCounts":[{"language":"default","tag":"Reference","count":842},{"language":"default","tag":"AGENT IMPROVEMENT","count":833},{"language":"default","tag":"AGENT RUNTIME","count":769},{"language":"default","tag":"Monitor","count":743},{"language":"default","tag":"LangSmith REST API","count":632},{"language":"default","tag":"Build","count":486},{"language":"default","tag":"Deploy","count":257},{"language":"default","tag":"TypeScript","count":254},{"language":"default","tag":"AGENT GOVERNANCE","count":233},{"language":"default","tag":"Python","count":232}],"searchSettings":{"maxResults":10,"showContentSnippets":true,"isFiltersEnabled":false}},"assistantConfig":{"enableAskAiButton":false,"enableAskAiSearchBar":true,"deflection":{"enabled":false,"email":"support@langchain.dev"}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","href":"/_mintlify/custom/langchain-5e9cc07a/d59117b7cd22d12d/style.css"}]}
{"page":{"pagePath":"langsmith/distributed-tracing","slug":"/langsmith/distributed-tracing","pageMetadata":{"title":"Implement distributed tracing","sidebarTitle":"Implement distributed tracing","description":null,"href":"/langsmith/distributed-tracing"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,hr:`hr`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Callout,CodeBlock,CodeGroup,Heading,Info,Note,Tip,Warning}=_components;if(!Callout)_missingMdxReference(`Callout`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Sometimes, you need to trace a request across multiple services.`}),`\n`,_jsxs(_components.p,{children:[`LangSmith supports distributed tracing out of the box, linking runs within a trace across services using context propagation headers (`,_jsx(_components.code,{children:`langsmith-trace`}),` and optional `,_jsx(_components.code,{children:`baggage`}),` for metadata/tags).`]}),`\n`,_jsx(_components.p,{children:`Example client-server setup:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Trace starts on client`}),`\n`,_jsx(_components.li,{children:`Continues on server`}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Only accept distributed-tracing headers from trusted services.`}),` The `,_jsx(_components.code,{children:`langsmith-trace`}),` and `,_jsx(_components.code,{children:`baggage`}),` headers are consumed as trusted tracing context. Do not add `,_jsx(_components.code,{children:`TracingMiddleware`}),` (or pass inbound request headers as the tracing `,_jsx(_components.code,{children:`parent`}),`) on a service that receives requests directly from untrusted third parties or the public internet. Keep distributed tracing to internal, service-to-service calls, and strip these headers from untrusted inbound requests at your gateway or proxy. Trusting `,_jsx(_components.code,{children:`baggage`}),` from an external caller lets them influence how your runs are recorded.`]})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.a,{href:`https://github.com/langchain-ai/langchain-skills/tree/main/skills/langchain-agent-tracing`,children:_jsx(_components.code,{children:`langchain-agent-tracing`})}),` skill helps your coding agent trace requests across services. To install it, see `,_jsx(_components.a,{href:`/langsmith/skills`,children:`LangSmith skills`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`distributed-tracing-in-python`,children:`Distributed tracing in Python`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes catppuccin-latte catppuccin-mocha`,style:{backgroundColor:`#eff1f5`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#4c4f69`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`# client.py`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` langsmith`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`run_helpers `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` get_current_run_tree`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` traceable`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` httpx`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`@traceable`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`async`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` my_client_function`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`():`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` headers `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` async`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` with`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` httpx`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:`AsyncClient`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`base_url`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"...\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` as`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` client`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` if`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` run_tree `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`:=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:` get_current_run_tree`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`():`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # add langsmith-id to headers`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` headers`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:`update`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`run_tree`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:`to_headers`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`())`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` await`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` client`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:`post`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"/my-route\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` headers`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`headers`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Then the server (or other service) can continue the trace by handling the headers appropriately. If you are using an asgi app Starlette or FastAPI, you can connect the distributed trace using LangSmith’s `,_jsx(_components.code,{children:`TracingMiddleware`}),`.`]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`TracingMiddleware`}),` class was added in `,_jsx(_components.code,{children:`langsmith==0.1.133`}),`.`]})}),`\n`,_jsx(_components.p,{children:`Example using FastAPI:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes catppuccin-latte catppuccin-mocha`,style:{backgroundColor:`#eff1f5`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#4c4f69`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` langsmith `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` traceable`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` langsmith`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`middleware `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` TracingMiddleware`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` fastapi `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` FastAPI`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` Request`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`app `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:` FastAPI`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`()`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # Or Flask, Django, or any other framework`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`app`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:`add_middleware`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`TracingMiddleware`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`@traceable`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`async`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` some_function`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`():`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` ...`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`@app`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`post`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"/my-route\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`async`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` fake_route`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`request`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-dark\":`#EBA0AC`},children:` Request`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` await`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:` some_function`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Or in Starlette:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes catppuccin-latte catppuccin-mocha`,style:{backgroundColor:`#eff1f5`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#4c4f69`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` starlette`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`applications `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` Starlette`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` starlette`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`middleware `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` Middleware`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` langsmith`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`middleware `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` TracingMiddleware`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`routes `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` ...`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`middleware `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` [`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:` Middleware`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`TracingMiddleware`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`),`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`]`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`app `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:` Starlette`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`...`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` middleware`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`middleware`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If you are using other server frameworks, you can always “receive” the distributed trace by passing the headers in through `,_jsx(_components.code,{children:`langsmith_extra`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes catppuccin-latte catppuccin-mocha`,style:{backgroundColor:`#eff1f5`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#4c4f69`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`16`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`# server.py`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` langsmith `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`as`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` ls`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` fastapi `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` FastAPI`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` Request`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`@ls`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`traceable`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`async`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` my_application`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`():`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` ...`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`app `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:` FastAPI`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`()`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # Or Flask, Django, or any other framework`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`@app`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`post`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"/my-route\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`async`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` fake_route`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`request`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-dark\":`#EBA0AC`},children:` Request`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # request.headers: {\"langsmith-trace\": \"...\"}`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:\" # as well as optional metadata/tags in `baggage`\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` with`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` ls`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:`tracing_context`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`parent`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`request`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`headers`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` await`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:` my_application`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`The example above uses the `,_jsx(_components.code,{children:`tracing_context`}),` context manager. You can also directly specify the parent run context in the `,_jsx(_components.code,{children:`langsmith_extra`}),` parameter of a method wrapped with `,_jsx(_components.code,{children:`@traceable`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes catppuccin-latte catppuccin-mocha`,style:{backgroundColor:`#eff1f5`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#4c4f69`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`# ... same as above`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`@app`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#FE640B`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`post`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"/my-route\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`async`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` fake_route`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`request`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-dark\":`#EBA0AC`},children:` Request`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # request.headers: {\"langsmith-trace\": \"...\"}`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-dark\":`#89B4FA`},children:` my_application`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`langsmith_extra`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`{`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"parent\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` request`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`headers`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`})`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`distributed-tracing-in-typescript`,children:`Distributed tracing in TypeScript`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`Distributed tracing in TypeScript requires `,_jsx(_components.code,{children:`langsmith>=0.1.31`})]})}),`\n`,_jsxs(_components.p,{children:[`First, we obtain the current run tree from the client and convert it to `,_jsx(_components.code,{children:`langsmith-trace`}),` and `,_jsx(_components.code,{children:`baggage`}),` header values, which we can pass to the server:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes catppuccin-latte catppuccin-mocha`,style:{backgroundColor:`#eff1f5`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#4c4f69`,\"--shiki-dark\":`#cdd6f4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`// client.mts`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` getCurrentRunTree`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` traceable `}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` from`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"langsmith/traceable\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` client `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` traceable`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` async`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` ()`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:` =>`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` runTree `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` getCurrentRunTree`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`()`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` await`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` fetch`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"...\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` method`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`:`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"POST\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` headers`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`:`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` runTree`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`toHeaders`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`()`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` }`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`)`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`then`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`a`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:` =>`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` a`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`text`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`())`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` },`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` name`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`:`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"client\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` }`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`)`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`await`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` client`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`()`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Then, the server converts the headers back to a run tree, which it uses to further continue the tracing.`}),`\n`,_jsxs(_components.p,{children:[`To pass the newly created run tree to a traceable function, we can use the `,_jsx(_components.code,{children:`withRunTree`}),` helper, which will ensure the run tree is propagated within traceable invocations.`]}),`\n`,_jsxs(CodeGroup,{children:[_jsx(CodeBlock,{filename:`Express.JS`,numberOfLines:`19`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes catppuccin-latte catppuccin-mocha`,style:{backgroundColor:`#eff1f5`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#4c4f69`,\"--shiki-dark\":`#cdd6f4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`19`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`// server.mts`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` RunTree `}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` from`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"langsmith\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` traceable`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` withRunTree `}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` from`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"langsmith/traceable\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` express `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"express\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` bodyParser `}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"body-parser\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` server `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` traceable`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` (`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`text`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`:`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` string`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:` =>`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:' `Hello from the server! Received \"'}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:\"${\"}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`text`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:'\"`'}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` name`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`:`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"server\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` }`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` )`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` app `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` express`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`()`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` app`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`use`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(bodyParser`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`text`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`())`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`app`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`post`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"/\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` async`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` (`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`req`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` res`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:` =>`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` runTree `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` RunTree`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`fromHeaders`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(req`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`headers)`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` result `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` await`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` withRunTree`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(runTree`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` ()`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:` =>`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` server`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(req`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`body))`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` res`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`send`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(result)`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`)`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`]})})}),_jsx(CodeBlock,{filename:`Hono`,numberOfLines:`18`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes catppuccin-latte catppuccin-mocha`,style:{backgroundColor:`#eff1f5`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#4c4f69`,\"--shiki-dark\":`#cdd6f4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`18`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`// server.mts`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` RunTree `}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` from`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"langsmith\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` traceable`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` withRunTree `}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` from`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"langsmith/traceable\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` Hono `}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` from`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"hono\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` server `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` traceable`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` (`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`text`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`:`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` string`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:` =>`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:' `Hello from the server! Received \"'}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:\"${\"}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`text`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:'\"`'}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` name`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`:`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:` \"server\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` }`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` )`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` app `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-light-font-weight\":`bold`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-weight\":`bold`},children:` new`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` Hono`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`()`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`app`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`post`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(`}),_jsx(_components.span,{style:{color:`#40A02B`,\"--shiki-dark\":`#A6E3A1`},children:`\"/\"`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` async`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` (`}),_jsx(_components.span,{style:{color:`#E64553`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`c`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:` =>`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` body `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` await`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` c`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`req`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`text`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`()`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` runTree `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` RunTree`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`fromHeaders`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(c`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`req`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`raw`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`headers)`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` const`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` result `}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` await`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` withRunTree`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(runTree`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:` ()`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:` =>`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` server`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(body))`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8839EF`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:` c`}),_jsx(_components.span,{style:{color:`#179299`,\"--shiki-dark\":`#94E2D5`},children:`.`}),_jsx(_components.span,{style:{color:`#1E66F5`,\"--shiki-light-font-style\":`italic`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`body`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`(result)`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`}`}),_jsx(_components.span,{style:{color:`#4C4F69`,\"--shiki-dark\":`#CDD6F4`},children:`)`}),_jsx(_components.span,{style:{color:`#7C7F93`,\"--shiki-dark\":`#9399B2`},children:`;`})]}),`\n`]})})})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsxs(`div`,{className:`source-links`,children:[_jsx(Callout,{icon:`terminal-2`,children:_jsxs(_components.p,{children:[_jsx(_components.a,{href:`/use-these-docs`,children:`Connect these docs`}),` to your agent of choice via MCP for real-time answers.`]})}),_jsx(Callout,{icon:`edit`,children:_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://github.com/langchain-ai/docs/edit/main/src/langsmith/distributed-tracing.mdx`,children:`Edit this page on GitHub`}),` or `,_jsx(_components.a,{href:`https://github.com/langchain-ai/docs/issues/new/choose`,children:`file an issue`}),`.`]})})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}},"config":{},"pageMetadata":{"title":"Implement distributed tracing","sidebarTitle":"Implement distributed tracing","description":null,"href":"/langsmith/distributed-tracing"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Distributed tracing in Python","slug":"distributed-tracing-in-python","depth":2,"children":[]},{"title":"Distributed tracing in TypeScript","slug":"distributed-tracing-in-typescript","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/langchain-5e9cc07a/8e2bdc5fa13bae3b/language-toggle.js","/_mintlify/custom/langchain-5e9cc07a/e53df5e6c631412e/ChatLangChainEmbed.js","/_mintlify/custom/langchain-5e9cc07a/de0c938f8f025ce1/integration-downloads-table.js","/_mintlify/custom/langchain-5e9cc07a/bf5a14ed20580d69/default-changelog-filter.js","/_mintlify/custom/langchain-5e9cc07a/2b68992dd6b93a5a/changelog-navigation.js"],"subdomain":"langchain-5e9cc07a","siteName":"Docs by LangChain","title":"Implement distributed tracing - Docs by LangChain","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-12-02T10:33:58.713Z","originalFileLocation":"langsmith/distributed-tracing.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Docs by LangChain\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Implement distributed tracing - Docs by LangChain\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Docs by LangChain\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.langchain.com/langsmith/distributed-tracing\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://langchain-5e9cc07a.mintlify.site/_mintlify/api/og/v2?division=Advanced+tracing+techniques\u0026amp;title=Implement+distributed+tracing\u0026amp;theme=f35197f94eda06999e44c5f5\u0026amp;signature=4061c11c9b7289c94cfd98c5057c73de6fb8f42ac7e7ffee5012ddf8a5dc9e4e\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Implement distributed tracing - Docs by LangChain\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://langchain-5e9cc07a.mintlify.site/_mintlify/api/og/v2?division=Advanced+tracing+techniques\u0026amp;title=Implement+distributed+tracing\u0026amp;theme=f35197f94eda06999e44c5f5\u0026amp;signature=4061c11c9b7289c94cfd98c5057c73de6fb8f42ac7e7ffee5012ddf8a5dc9e4e\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/langchain-5e9cc07a/YSQua9Gt91yRswvJ/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Docs by LangChain\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#161F34\">\u003cmeta data-mint-head name=\"google-site-verification\" content=\"9_2KHeJwmEdwgncBRk1MsKxriZz7Sc21EJdbfCxkTEo\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.langchain.com/langsmith/distributed-tracing\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/langsmith/distributed-tracing.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.langchain.com/#organization\",\"name\":\"Docs by LangChain\",\"url\":\"https://docs.langchain.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/langchain-5e9cc07a/nQm-sjd_MByLhgeW/images/brand/langchain-docs-dark-blue.png?fit=max\u0026auto=format\u0026n=nQm-sjd_MByLhgeW\u0026q=85\u0026s=5babf1a1962208fd7eed942fa2432ecb\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.langchain.com#website\",\"name\":\"Docs by LangChain\",\"url\":\"https://docs.langchain.com\",\"publisher\":{\"@id\":\"https://docs.langchain.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.langchain.com/langsmith/distributed-tracing#webpage\",\"url\":\"https://docs.langchain.com/langsmith/distributed-tracing\",\"name\":\"Implement distributed tracing\",\"dateModified\":\"2026-12-02T10:33:58.713Z\",\"isPartOf\":{\"@id\":\"https://docs.langchain.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.langchain.com/langsmith/distributed-tracing#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.langchain.com/langsmith/distributed-tracing#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Configuration \u0026 troubleshooting\",\"item\":\"https://docs.langchain.com/langsmith/log-traces-to-agent\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Implement distributed tracing\",\"item\":\"https://docs.langchain.com/langsmith/distributed-tracing\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.langchain.com/langsmith/distributed-tracing#article\",\"headline\":\"Implement distributed tracing\",\"name\":\"Implement distributed tracing\",\"url\":\"https://docs.langchain.com/langsmith/distributed-tracing\",\"mainEntityOfPage\":{\"@id\":\"https://docs.langchain.com/langsmith/distributed-tracing#webpage\"},\"dateModified\":\"2026-12-02T10:33:58.713Z\",\"publisher\":{\"@id\":\"https://docs.langchain.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.langchain.com#website\"}}]}\u003c/script>","agentPointerHref":"/langsmith/distributed-tracing.md","siteName":"Docs by LangChain","nav":{"global":null,"products":[{"product":"AGENT RUNTIME","menu":[{"item":"No-code agents","icon":"wand","description":"Build agents without code","tabs":[{"tab":"Studio","pages":[{"title":"Studio","href":"/langsmith/build-an-agent"}]},{"tab":"Fleet","pages":[{"title":"Fleet","href":"/langsmith/fleet"}]}]},{"item":"Build","icon":"hammer","description":"Build agents with open source","dropdowns":[{"dropdown":"Python","icon":{"style":"regular","name":"brand-python"},"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":"/build-overview"}]},{"tab":"Managed Deep Agents","pages":[{"title":"Managed Deep Agents","href":"/langsmith/python/managed-deep-agents-overview"}]},{"tab":"Deep Agents","pages":[{"title":"Deep Agents","href":"/oss/python/deepagents/overview"}]},{"tab":"LangChain","pages":[{"title":"LangChain","href":"/oss/python/langchain/overview"}]},{"tab":"LangGraph","pages":[{"title":"LangGraph","href":"/oss/python/langgraph/overview"}]},{"tab":"OpenWiki","pages":[{"title":"OpenWiki","href":"/oss/openwiki/overview"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/oss/python/integrations/providers/overview"}]},{"tab":"Learn","pages":[{"title":"Learn","href":"/oss/python/learn"}]},{"tab":"Reference","pages":[{"title":"Reference","href":"/oss/python/reference/overview"}]},{"tab":"Contribute","pages":[{"title":"Contribute","href":"/oss/python/contributing/overview"}]}]},{"dropdown":"TypeScript","icon":{"style":"regular","name":"brand-typescript"},"tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":"/build-overview"}]},{"tab":"Managed Deep Agents","pages":[{"title":"Managed Deep Agents","href":"/langsmith/javascript/managed-deep-agents-overview"}]},{"tab":"Deep Agents","pages":[{"title":"Deep Agents","href":"/oss/javascript/deepagents/overview"}]},{"tab":"LangChain","pages":[{"title":"LangChain","href":"/oss/javascript/langchain/overview"}]},{"tab":"LangGraph","pages":[{"title":"LangGraph","href":"/oss/javascript/langgraph/overview"}]},{"tab":"OpenWiki","pages":[{"title":"OpenWiki","href":"/oss/openwiki/overview"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/oss/javascript/integrations/providers/overview"}]},{"tab":"Learn","pages":[{"title":"Learn","href":"/oss/javascript/learn"}]},{"tab":"Reference","pages":[{"title":"Reference","href":"/oss/javascript/reference/overview"}]},{"tab":"Contribute","pages":[{"title":"Contribute","href":"/oss/javascript/contributing/overview"}]}]}]},{"item":"Deploy","icon":"rocket","description":"Ship agents to production","tabs":[{"tab":"Get started","pages":[{"title":"Get started","href":"/langsmith/deploy-overview"}]},{"tab":"Agent Server","pages":[{"title":"Agent Server","href":"/langsmith/agent-server"}]},{"tab":"Deploy to Cloud","pages":[{"title":"Deploy to Cloud","href":"/langsmith/deploy-to-cloud-overview"}]},{"tab":"Deploy to Self-hosted","pages":[{"title":"Deploy to Self-hosted","href":"/langsmith/deploy-to-self-hosted-overview"}]},{"tab":"Prompt \u0026 Context Hub","pages":[{"title":"Prompt \u0026 Context Hub","href":"/langsmith/prompt-context-hub"}]},{"tab":"Sandboxes","pages":[{"title":"Sandboxes","href":"/langsmith/sandboxes"}]}]}],"pages":[{"title":"AGENT RUNTIME","href":"/langsmith/build-an-agent"}]},{"product":"AGENT IMPROVEMENT","menu":[{"item":"Test","icon":"flask","description":"Evaluate and refine agents","tabs":[{"tab":"Get started","pages":[{"title":"LangSmith Evaluation","sidebarTitle":"Overview","mode":"wide","href":"/langsmith/evaluation"},{"title":"Evaluation quickstart","sidebarTitle":"Quickstart","href":"/langsmith/evaluation-quickstart"},{"title":"Evaluation concepts","sidebarTitle":"Concepts","href":"/langsmith/evaluation-concepts"},{"title":"Application-specific evaluation approaches","sidebarTitle":"Evaluation approaches","href":"/langsmith/evaluation-approaches"}]},{"tab":"Datasets \u0026 Experiments","pages":[{"group":"Datasets","pages":[{"group":"Create a dataset","pages":[{"title":"Create and manage datasets in the UI","sidebarTitle":"With the UI","icon":"browser","href":"/langsmith/manage-datasets-in-application"},{"title":"How to create and manage datasets programmatically","sidebarTitle":"With the SDK","href":"/langsmith/manage-datasets-programmatically"}]},{"title":"Manage datasets","sidebarTitle":"Manage datasets","href":"/langsmith/manage-datasets"},{"title":"Custom output rendering","sidebarTitle":"Custom output rendering","href":"/langsmith/custom-output-rendering"}]},{"group":"Run an evaluation","pages":[{"title":"How to evaluate agents","sidebarTitle":"With the SDK","href":"/langsmith/evaluate-llm-application"},{"title":"How to evaluate with OpenTelemetry","sidebarTitle":"With OpenTelemetry","href":"/langsmith/evaluate-with-opentelemetry"},{"title":"Run an evaluation with the UI","sidebarTitle":"With the UI","url":"/langsmith/run-evaluation-from-playground","href":"/langsmith/playground-link"},{"title":"How to use the REST API","sidebarTitle":"With the API","href":"/langsmith/run-evals-api-only"}]},{"group":"Evaluation techniques","pages":[{"group":"Define evaluation target","pages":[{"title":"How to define a target function to evaluate","sidebarTitle":"Define a target function to evaluate","href":"/langsmith/define-target-function"},{"title":"How to evaluate an application's intermediate steps","sidebarTitle":"Evaluate intermediate steps","href":"/langsmith/evaluate-on-intermediate-steps"},{"title":"How to evaluate a runnable","sidebarTitle":"Evaluate a runnable","href":"/langsmith/langchain-runnable"},{"title":"How to evaluate a graph","sidebarTitle":"Evaluate a graph","href":"/langsmith/evaluate-graph"},{"title":"How to simulate multi-turn interactions","sidebarTitle":"Simulate multi-turn interactions","href":"/langsmith/multi-turn-simulation"},{"title":"How to evaluate your agent with trajectory evaluations","sidebarTitle":"Evaluate agent trajectories","href":"/langsmith/trajectory-evals"}]},{"group":"Scoring methods","pages":[{"title":"How to return multiple scores in one evaluator","sidebarTitle":"Return multiple scores in one evaluator","href":"/langsmith/multiple-scores"},{"title":"How to return categorical vs numerical metrics","sidebarTitle":"Return categorical vs numerical metrics","href":"/langsmith/metric-type"}]},{"group":"Experiment configuration","pages":[{"title":"Experiment configuration","sidebarTitle":"Experiment configuration","href":"/langsmith/experiment-configuration"},{"title":"How to run an evaluation asynchronously","sidebarTitle":"Run an evaluation asynchronously","href":"/langsmith/evaluation-async"},{"title":"How to evaluate with repetitions","sidebarTitle":"Evaluate with repetitions","href":"/langsmith/repetition"},{"title":"How to handle model rate limits","sidebarTitle":"Handle model rate limits","href":"/langsmith/handle-model-rate-limiting"},{"title":"Automatically run evaluators on experiments","sidebarTitle":"Run evaluators on experiments","url":"/langsmith/bind-evaluator-to-dataset","href":"/langsmith/bind-evaluator-to-dataset-link"},{"title":"How to add evaluators to an existing experiment (Python only)","sidebarTitle":"Evaluate an existing experiment (Python)","href":"/langsmith/evaluate-existing-experiment"},{"title":"How to run an evaluation locally (Python only)","sidebarTitle":"Run an evaluation locally (Python)","href":"/langsmith/local"},{"title":"How to read experiment results locally","sidebarTitle":"Read experiment results locally","href":"/langsmith/read-local-experiment-results"},{"title":"How to retry failed runs in experiments (Python only)","sidebarTitle":"Retry on failed experiment runs (Python)","href":"/langsmith/evaluate-with-retry"}]},{"group":"Multimodal evaluations","pages":[{"title":"Run an evaluation with multimodal content","sidebarTitle":"Run an evaluation with multimodal content","href":"/langsmith/evaluate-with-attachments"}]}]},{"group":"Analyze experiment results","pages":[{"title":"Analyze an experiment","sidebarTitle":"Analyze an experiment","href":"/langsmith/analyze-an-experiment"},{"title":"LangSmith Chat","sidebarTitle":"Analyze with Chat","url":"/langsmith/chat#evaluation","href":"/langsmith/chat-evaluation"},{"title":"How to compare experiment results","sidebarTitle":"Compare experiment results","href":"/langsmith/compare-experiment-results"},{"title":"How to filter experiments in the UI","sidebarTitle":"Filter experiments in the UI","href":"/langsmith/filter-experiments-ui"},{"title":"How to fetch performance metrics for an experiment","sidebarTitle":"Fetch performance metrics for an experiment","href":"/langsmith/fetch-perf-metrics-experiment"},{"title":"How to upload experiments run outside of LangSmith with the REST API","sidebarTitle":"Upload experiments run outside of LangSmith","href":"/langsmith/upload-existing-experiments"}]},{"group":"Fine-tuning","pages":[{"title":"Fine-tune models with Smithtune","sidebarTitle":"Fine-tune models","tag":"Beta","href":"/langsmith/smithtune"}]},{"group":"Tutorials","pages":[{"title":"Evaluate a chatbot","sidebarTitle":"Evaluate a chatbot","href":"/langsmith/evaluate-chatbot-tutorial"},{"title":"Evaluate a RAG application","sidebarTitle":"Evaluate a RAG application","href":"/langsmith/evaluate-rag-tutorial"},{"title":"Test a ReAct agent with Pytest/Vitest and LangSmith","sidebarTitle":"Test a ReAct agent with Pytest/Vitest and LangSmith","href":"/langsmith/test-react-agent-pytest"},{"title":"Evaluate a complex agent","sidebarTitle":"Evaluate a complex agent","href":"/langsmith/evaluate-complex-agent"},{"title":"Run backtests on a new version of an agent","sidebarTitle":"Run backtests on a new version of an agent","href":"/langsmith/run-backtests-new-agent"}]},{"group":"Common data types","pages":[{"title":"Example data format","sidebarTitle":"Example data format","href":"/langsmith/example-data-format"},{"title":"Dataset prebuilt JSON schema types","sidebarTitle":"Dataset prebuilt JSON schema types","href":"/langsmith/dataset-json-types"},{"title":"Dataset transformations","sidebarTitle":"Dataset transformations","href":"/langsmith/dataset-transformations"}]}]},{"tab":"Evaluators","pages":[{"title":"Evaluation types","sidebarTitle":"Overview","href":"/langsmith/evaluation-types"},{"title":"Manage evaluators","sidebarTitle":"Manage evaluators","href":"/langsmith/evaluators"},{"title":"Manage evaluators with the SDK","sidebarTitle":"Manage evaluators programmatically","icon":"code","tag":"SDK","href":"/langsmith/manage-evaluators-sdk"},{"title":"Automatically run evaluators on experiments","sidebarTitle":"Run evaluators on experiments","href":"/langsmith/bind-evaluator-to-dataset"},{"title":"Track and limit evaluator spend","sidebarTitle":"Evaluator spend","href":"/langsmith/evaluator-spend"},{"group":"Evaluator types","pages":[{"group":"UI","pages":[{"title":"How to define an LLM-as-a-judge evaluator","sidebarTitle":"LLM-as-a-judge","href":"/langsmith/llm-as-judge"},{"title":"How to define a decision model evaluator","sidebarTitle":"Decision model","href":"/langsmith/decision-model-evaluator"},{"title":"How to define a code evaluator","sidebarTitle":"Code evaluator","href":"/langsmith/code-evaluator-ui"},{"title":"Use advanced code evaluators","sidebarTitle":"Advanced code evaluator","tag":"Beta","href":"/langsmith/advanced-code-evaluators"},{"title":"How to create a composite evaluator","sidebarTitle":"Composite evaluators","href":"/langsmith/composite-evaluators-ui"}]},{"group":"SDK","pages":[{"title":"How to define an LLM-as-a-judge evaluator","sidebarTitle":"LLM-as-a-judge","href":"/langsmith/llm-as-judge-sdk"},{"title":"How to define a code evaluator","sidebarTitle":"Code evaluator","href":"/langsmith/code-evaluator-sdk"},{"title":"How to create a composite evaluator","sidebarTitle":"Composite evaluators","href":"/langsmith/composite-evaluators-sdk"},{"title":"How to define a summary evaluator","sidebarTitle":"Summary evaluator","href":"/langsmith/summary"},{"title":"How to run a pairwise evaluation","sidebarTitle":"Pairwise evaluation","href":"/langsmith/evaluate-pairwise"}]}]},{"group":"Frameworks \u0026 integrations","pages":[{"title":"Run evals with openevals package","sidebarTitle":"Run evals with openevals package","href":"/langsmith/openevals"},{"title":"How to run evaluations with pytest","sidebarTitle":"Run evals with pytest","href":"/langsmith/pytest"},{"title":"How to run evaluations with Vitest/Jest","sidebarTitle":"Run evals with Vitest/Jest","href":"/langsmith/vitest-jest"},{"title":"Harbor integrations","href":"/langsmith/harbor-integrations"}]},{"group":"Improve evaluators","pages":[{"title":"Improve LLM-as-judge evaluators using human feedback","sidebarTitle":"Improve LLM-as-judge evaluators using human feedback","href":"/langsmith/improve-judge-evaluator-feedback"},{"title":"How to improve your evaluator with few-shot examples","sidebarTitle":"Improve your evaluator with few-shot examples","href":"/langsmith/create-few-shot-evaluators"},{"title":"How to audit evaluator scores","sidebarTitle":"Audit evaluator scores","href":"/langsmith/audit-evaluator-scores"}]}]},{"tab":"Annotation Queues","pages":[{"title":"Use annotation queues","sidebarTitle":"Use annotation queues","href":"/langsmith/annotation-queues"},{"title":"Build custom views for annotation queues","sidebarTitle":"Build custom views","href":"/langsmith/annotation-queue-custom-views"},{"title":"Manage feedback \u0026 annotation queues programmatically","sidebarTitle":"Manage feedback \u0026 annotation queues","tag":"SDK","href":"/langsmith/annotation-queues-sdk"},{"title":"Use assertions","sidebarTitle":"Use assertions","href":"/langsmith/assertions"},{"title":"Set up feedback criteria","sidebarTitle":"Set up feedback criteria","href":"/langsmith/set-up-feedback-criteria"},{"title":"Annotate traces and runs inline","sidebarTitle":"Annotate traces and runs inline","href":"/langsmith/annotate-traces-inline"},{"group":"Feedback","pages":[{"title":"Log user feedback using the SDK","sidebarTitle":"Log user feedback using the SDK","href":"/langsmith/attach-user-feedback"},{"title":"Collect feedback with presigned URLs","sidebarTitle":"Collect feedback with presigned URLs","href":"/langsmith/presigned-feedback-tokens"}]}]},{"tab":"Test from Playground","pages":[{"title":"Test from the Playground","sidebarTitle":"Overview","href":"/langsmith/test-from-playground"},{"title":"Run an evaluation from the Playground","sidebarTitle":"Run an evaluation","href":"/langsmith/run-evaluation-from-playground"}]},{"tab":"Test from Studio","pages":[{"title":"LangSmith Studio","sidebarTitle":"Overview","href":"/langsmith/studio"},{"title":"Get started with Studio","sidebarTitle":"Quickstart","href":"/langsmith/quick-start-studio"},{"title":"How to use Studio","sidebarTitle":"Runs, assistants, threads","href":"/langsmith/use-studio"},{"title":"Observability in Studio","sidebarTitle":"Traces, datasets, prompts","href":"/langsmith/observability-studio"},{"title":"Studio troubleshooting","sidebarTitle":"Troubleshooting","href":"/langsmith/troubleshooting-studio"}]}]},{"item":"Monitor","icon":"chart-line","description":"Trace, debug, and observe agents","tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":"/langsmith/observability"}]},{"tab":"Trace","pages":[{"title":"Tracing quickstart","sidebarTitle":"Quickstart","icon":"rocket","href":"/langsmith/observability-quickstart"},{"title":"Trace an agent","sidebarTitle":"Tutorial","icon":"school","href":"/langsmith/observability-llm-tutorial"},{"title":"Observability concepts","sidebarTitle":"Concepts","icon":"book","href":"/langsmith/observability-concepts"},{"title":"LangSmith Chat","sidebarTitle":"Chat","url":"https://docs.langchain.com/langsmith/chat#observability","icon":"feather","href":"/langsmith/chat-observability"},{"group":"Tracing setup","pages":[{"group":"Integrations","icon":"plug","pages":[{"title":"Integrations","sidebarTitle":"Overview","mode":"wide","href":"/langsmith/integrations"},{"group":"LLM providers","pages":[{"title":"Trace with Anthropic","sidebarTitle":"Anthropic","href":"/langsmith/trace-anthropic"},{"title":"Trace with Amazon Bedrock","sidebarTitle":"Bedrock","href":"/langsmith/trace-bedrock"},{"title":"Trace with DeepSeek","sidebarTitle":"DeepSeek","href":"/langsmith/trace-deepseek"},{"title":"Trace with Google Gemini","sidebarTitle":"Google Gemini","href":"/langsmith/trace-with-google-gemini"},{"title":"Trace with LiteLLM","sidebarTitle":"LiteLLM","href":"/langsmith/trace-litellm"},{"title":"Trace with Mistral","sidebarTitle":"Mistral","href":"/langsmith/trace-with-mistral"},{"title":"Trace with OpenAI","sidebarTitle":"OpenAI","href":"/langsmith/trace-openai"},{"title":"Trace OpenAI-compatible providers","sidebarTitle":"OpenAI-compatible APIs","href":"/langsmith/trace-with-openai-compatible"}]},{"group":"Agent frameworks","pages":[{"title":"Trace AutoGen agents","sidebarTitle":"AutoGen","href":"/langsmith/trace-with-autogen"},{"title":"Trace with the Claude Agent SDK","sidebarTitle":"Claude Agent SDK","href":"/langsmith/trace-claude-agent-sdk"},{"title":"Trace Claude Managed Agents","sidebarTitle":"Claude Managed Agents","href":"/langsmith/trace-with-claude-managed-agents"},{"title":"Trace CrewAI agents","sidebarTitle":"CrewAI","href":"/langsmith/trace-with-crewai"},{"title":"Trace Deep Agents","sidebarTitle":"Deep Agents","href":"/langsmith/trace-deep-agents"},{"title":"Trace Google ADK agents","sidebarTitle":"Google ADK","href":"/langsmith/trace-with-google-adk"},{"title":"Trace LangChain agents (Python and JS/TS)","sidebarTitle":"LangChain","href":"/langsmith/trace-with-langchain"},{"title":"Trace LangGraph agents","sidebarTitle":"LangGraph","href":"/langsmith/trace-with-langgraph"},{"title":"Trace Mastra agents","sidebarTitle":"Mastra","href":"/langsmith/trace-with-mastra"},{"title":"Trace with Microsoft Agent Framework","sidebarTitle":"Microsoft Agent Framework","href":"/langsmith/trace-with-microsoft-agent-framework"},{"title":"Trace with the OpenAI Agents SDK","sidebarTitle":"OpenAI Agents SDK","href":"/langsmith/trace-with-openai-agents-sdk"},{"title":"Trace with OpenTelemetry","sidebarTitle":"OpenTelemetry","href":"/langsmith/trace-with-opentelemetry"},{"title":"Trace PydanticAI agents","sidebarTitle":"PydanticAI","href":"/langsmith/trace-with-pydantic-ai"},{"title":"Trace Semantic Kernel agents","sidebarTitle":"Semantic Kernel","href":"/langsmith/trace-with-semantic-kernel"},{"title":"Trace with Strands Agents","sidebarTitle":"Strands Agents","href":"/langsmith/trace-with-strands-agents"},{"title":"Trace Vercel AI SDK agents (JS/TS only)","sidebarTitle":"Vercel AI SDK","href":"/langsmith/trace-with-vercel-ai-sdk"}]},{"group":"Voice AI frameworks","pages":[{"title":"Voice tracing fundamentals","sidebarTitle":"Voice fundamentals","href":"/langsmith/trace-voice-fundamentals"},{"title":"Trace OpenAI Realtime agents","sidebarTitle":"OpenAI Realtime","tag":"Beta","href":"/langsmith/trace-openai-realtime"},{"title":"Trace Gemini Live agents","sidebarTitle":"Gemini Live","tag":"Beta","href":"/langsmith/trace-gemini-live"},{"title":"Trace LiveKit agents","sidebarTitle":"LiveKit","tag":"Beta","href":"/langsmith/trace-with-livekit"},{"title":"Trace Pipecat agents","sidebarTitle":"Pipecat","tag":"Beta","href":"/langsmith/trace-with-pipecat"}]},{"group":"Developer tools","pages":[{"title":"Coding agent metadata contract","sidebarTitle":"Metadata contract","href":"/langsmith/coding-agent-metadata-contract"},{"title":"Trace Claude Code sessions","sidebarTitle":"Claude Code","href":"/langsmith/trace-claude-code"},{"title":"Trace OpenAI Codex sessions","sidebarTitle":"OpenAI Codex","href":"/langsmith/trace-with-codex"},{"title":"Trace OpenCode sessions","sidebarTitle":"OpenCode","href":"/langsmith/trace-with-opencode"},{"title":"Trace Cursor sessions","sidebarTitle":"Cursor","href":"/langsmith/trace-with-cursor"},{"title":"Trace Pi coding agent sessions","sidebarTitle":"Pi","href":"/langsmith/trace-with-pi"},{"title":"Trace with Instructor","sidebarTitle":"Instructor (Python only)","href":"/langsmith/trace-with-instructor"},{"title":"Trace n8n workflows","sidebarTitle":"n8n","href":"/langsmith/trace-with-n8n"},{"title":"Trace with Temporal","sidebarTitle":"Temporal","href":"/langsmith/trace-with-temporal"},{"title":"Trace Visual Studio Code Copilot Chat sessions","sidebarTitle":"VS Code Copilot","href":"/langsmith/trace-with-vscode-copilot"}]},{"group":"Productivity","pages":[{"title":"Trace Claude Cowork sessions","sidebarTitle":"Claude Cowork","href":"/langsmith/trace-claude-cowork"}]}]},{"group":"Manual instrumentation","pages":[{"title":"Custom instrumentation","sidebarTitle":"Customize instrumentation","href":"/langsmith/annotate-code"},{"title":"Trace with API","sidebarTitle":"Trace with API","href":"/langsmith/trace-with-api"},{"title":"Log LLM calls","sidebarTitle":"Log LLM calls","href":"/langsmith/log-llm-trace"},{"title":"Log retriever traces","sidebarTitle":"Log retriever traces","href":"/langsmith/log-retriever-trace"},{"title":"Metadata parameters reference","sidebarTitle":"Metadata parameters","href":"/langsmith/ls-metadata-parameters"},{"title":"Upload files with traces","sidebarTitle":"Upload files with traces","href":"/langsmith/upload-files-with-traces"}]}]},{"group":"Configuration \u0026 troubleshooting","pages":[{"group":"Agent \u0026 environment settings","pages":[{"title":"Log traces to an agent","sidebarTitle":"Log traces to an agent","href":"/langsmith/log-traces-to-agent"},{"title":"Write traces to multiple destinations with replicas","sidebarTitle":"Trace replicas","href":"/langsmith/trace-replicas"},{"title":"Trace without setting environment variables","sidebarTitle":"Trace without env vars","mode":"wide","href":"/langsmith/trace-without-env-vars"},{"title":"Conditional tracing","sidebarTitle":"Conditional tracing","href":"/langsmith/conditional-tracing"},{"title":"Set a sampling rate for traces","sidebarTitle":"Set a sampling rate for traces","href":"/langsmith/sample-traces"}]},{"title":"Cost tracking","sidebarTitle":"Cost tracking","href":"/langsmith/cost-tracking"},{"title":"Usage and billing","sidebarTitle":"Usage and billing","description":"Understand LangSmith trace data retention tiers, pricing, rate limits, and usage limits.","href":"/langsmith/usage-and-billing"},{"group":"Advanced tracing techniques","pages":[{"title":"Implement distributed tracing","sidebarTitle":"Implement distributed tracing","href":"/langsmith/distributed-tracing"},{"title":"Access the current run (span) within a traced function","sidebarTitle":"Access the current run (span) within a traced function","description":null,"href":"/langsmith/access-current-span"},{"title":"Trace JS functions in serverless environments","sidebarTitle":"Trace JS functions in serverless environments","href":"/langsmith/serverless-environments"},{"title":"Log multimodal traces","sidebarTitle":"Log multimodal traces","href":"/langsmith/log-multimodal-traces"},{"title":"Trace generator functions","sidebarTitle":"Trace generator functions","href":"/langsmith/trace-generator-functions"}]},{"group":"Data \u0026 privacy","pages":[{"title":"Add metadata and tags to traces","sidebarTitle":"Add metadata and tags to traces","href":"/langsmith/add-metadata-tags"},{"title":"Prevent logging of sensitive data in traces","sidebarTitle":"Prevent logging of sensitive data in traces","href":"/langsmith/mask-inputs-outputs"},{"title":"Redact secrets from traces","href":"/langsmith/redact-secrets"},{"title":"Redact sensitive data with the OpenTelemetry Gateway architecture","sidebarTitle":"Redact sensitive data with OTEL","href":"/langsmith/otel-gateway-trace-redaction"}]},{"group":"Troubleshooting guides","pages":[{"title":"Troubleshoot trace nesting","sidebarTitle":"Troubleshoot trace nesting","href":"/langsmith/nest-traces"},{"title":"Troubleshoot variable caching","sidebarTitle":"Troubleshoot variable caching","href":"/langsmith/troubleshooting-variable-caching"}]}]}]},{"tab":"Debug","pages":[{"title":"Debug","href":"/langsmith/view-traces"}]},{"tab":"Observe","pages":[{"title":"Observe","href":"/langsmith/dashboards"}]},{"tab":"Reference","pages":[{"title":"Reference","href":"/langsmith/reference"}]}]},{"item":"Engine","icon":"https://mintlify.s3.us-west-1.amazonaws.com/langchain-5e9cc07a/images/brand/engine-icon-no-bg-dark.svg","description":"Find and fix agent issues","pages":[{"title":"LangSmith Engine","sidebarTitle":"Overview","href":"/langsmith/engine"},{"title":"Set up LangSmith Engine","sidebarTitle":"Set up Engine","href":"/langsmith/engine-setup"},{"title":"Find and fix your agent's issues with LangSmith Engine","sidebarTitle":"Find and fix issues","href":"/langsmith/engine-issues"},{"title":"Connect Engine to your repository","sidebarTitle":"Connect your repository","href":"/langsmith/engine-repositories"},{"title":"LangSmith Engine notifications","sidebarTitle":"Notifications","href":"/langsmith/engine-notifications"},{"title":"Validate fixes automatically","sidebarTitle":"Validate fixes automatically","tag":"Beta","href":"/langsmith/engine-fix-validation"},{"title":"Proactively identify issues with Red Teaming","sidebarTitle":"Proactively identify issues","tag":"Beta","href":"/langsmith/engine-red-teaming"},{"title":"LangSmith Engine security","sidebarTitle":"Security","href":"/langsmith/engine-security"},{"group":"Self-hosted and BYOC","pages":[{"title":"LangSmith Engine on Self-hosted and BYOC","sidebarTitle":"Overview and setup","href":"/langsmith/engine-self-hosted"},{"title":"Configure model providers for Engine on self-hosted and BYOC","sidebarTitle":"Model providers","href":"/langsmith/engine-self-hosted-model-providers"},{"title":"Configure GitHub for Engine on self-hosted and BYOC","sidebarTitle":"GitHub configuration","href":"/langsmith/engine-self-hosted-github"}]}]}]},{"product":"AGENT GOVERNANCE","menu":[{"item":"LangSmith setup","icon":"server","description":"Hosting and administration","tabs":[{"tab":"Overview","pages":[{"title":"Overview","href":"/langsmith/langsmith-setup-overview"}]},{"tab":"Account","pages":[{"title":"Account","href":"/langsmith/admin"}]},{"tab":"Cloud","pages":[{"title":"Cloud","href":"/langsmith/cloud"}]},{"tab":"BYOC","pages":[{"title":"BYOC","href":"/langsmith/byoc"}]},{"tab":"Self-hosted","pages":[{"title":"Self-hosted","href":"/langsmith/self-hosted"}]},{"tab":"Govern","pages":[{"title":"Govern","href":"/langsmith/govern-overview"}]}]},{"item":"LLM Gateway","icon":"route","description":"Route, control, and observe LLM traffic","pages":[{"title":"LLM Gateway","href":"/langsmith/llm-gateway"}]},{"item":"Tool Gateway","icon":"https://mintlify.s3.us-west-1.amazonaws.com/langchain-5e9cc07a/images/ui/tool-gateway.svg","description":"Govern agent tool calls","pages":[{"title":"Tool Gateway","href":"/langsmith/tool-gateway"}]}],"pages":[{"title":"AGENT GOVERNANCE","href":"/langsmith/langsmith-setup-overview"}]}]},"basePath":"","title":"Implement distributed tracing - Docs by LangChain","deploymentId":"dpl_3VZr4zL4q2wbintGwWjSCGUgnuP7","buildId":"dpl_3VZr4zL4q2wbintGwWjSCGUgnuP7","dynamics":[],"chunks":[]}