-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathllms-full.txt
More file actions
25709 lines (19323 loc) · 894 KB
/
llms-full.txt
File metadata and controls
25709 lines (19323 loc) · 894 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# LangWatch
# FILE: ./introduction.mdx
---
title: "LangWatch: The Complete LLMOps Platform"
description: "Ship AI agents 8x faster with comprehensive observability, evaluation, and prompt optimization. Open-source platform, with over 2.5k stars on GitHub."
sidebarTitle: Introduction
keywords: langwatch, llm, ai, observability, evaluation, prompt optimization, llmops, open-source, github
---
<Frame>
<img
className="block"
src="/images/langwatch-quick-preview.gif"
alt="LangWatch Quick Preview"
/>
</Frame>
## Quick Start
Ready to start taking control of your LLM application quality? Quick start with observability or agent simulations right away:
<CardGroup cols={2}>
<Card
title="Observability Quick Start"
description="Track every LLM call, tool usage, and user interaction with detailed traces, spans, and metadata."
icon="chart-network"
href="/integration/quick-start"
arrow
horizontal
/>
<Card
title="Agent Simulation Testing"
description="Test and optimize agents with collaborative tools and A/B testing."
icon="masks-theater"
href="/agent-simulations/getting-started"
arrow
horizontal
/>
<Card
title="LLM Evaluation"
description="Measure output quality with built-in evaluators, custom metrics, and human feedback integration."
icon="square-check"
href="/evaluations/overview"
arrow
horizontal
/>
<Card
title="Prompt Management"
description="Version control, test, and optimize prompts with collaborative tools and A/B testing."
icon="code"
href="/prompt-management/overview"
arrow
horizontal
/>
<Card
title="Cost & Performance Tracking"
description="Monitor token usage, costs, and performance metrics across all models and providers."
icon="chart-line"
href="/integration/python/tutorials/tracking-llm-costs"
arrow
horizontal
/>
<Card
title="Alerts & Automations"
description="Set up alerts and automations for your LLM applications."
icon="bell"
href="/features/automations"
arrow
horizontal
/>
</CardGroup>
## What is LangWatch?
LangWatch is the **open-source** LLMOps platform that helps teams collaboratively debug, analyze, and iterate on their LLM applications. All platform features are natively integrated to accelerate the development workflow.
Building AI applications is hard. Developers spend weeks debugging issues, optimizing prompts, and ensuring quality. Without proper observability, you're flying blind - you don't know why your AI behaves the way it does, where it fails, or how to improve it.
LangWatch provides the missing operations platform for AI applications. Every LLM call, tool usage, and user interaction is automatically tracked with detailed traces, spans, and metadata. See the full conversation flow, identify bottlenecks, and understand exactly how your AI applications behave in production.
## For Every Role
LangWatch serves different needs across your organization, providing value to every team member working with AI applications.
### For Developers
Debug faster with detailed traces that show exactly what happened in each LLM call. Build datasets from production data, run batch evaluations, and continuously improve your AI applications with comprehensive debugging tools and performance insights.
### For Domain Experts
Easily sift through conversations, see topics being discussed, and annotate messages for improvement in a collaborative manner with the development team. Provide feedback on AI outputs and help guide quality improvements through intuitive interfaces.
### For Business Teams
Track conversation metrics, user analytics, and cost tracking with custom dashboards and reporting. Monitor AI application performance, understand user behavior, and make data-driven decisions about your AI investments.
## Where to Start?
Setting up the full process of online tracing, prompt management, production evaluations, and offline evaluations requires some time. This guide helps you figure out what's most important for your use case.
<CardGroup cols={2}>
<Card
title="Just Getting Started?"
description="Start with basic tracing to understand what's happening in your LLM applications."
icon="rocket"
href="/integration/quick-start"
arrow
horizontal
/>
<Card
title="Already Instrumented?"
description="Add prompt management and evaluation to optimize your existing setup."
icon="wrench"
href="/prompt-management/overview"
arrow
horizontal
/>
<Card
title="Production Ready?"
description="Set up comprehensive monitoring, alerts, and cost tracking for production."
icon="chart-line"
href="/observability/overview"
arrow
horizontal
/>
<Card
title="Research & Development?"
description="Use datasets, experiments, and evaluation tools for systematic testing."
icon="flask"
href="/evaluations/overview"
arrow
horizontal
/>
</CardGroup>
Ready to get started? [Sign up for free](https://app.langwatch.ai) and begin building better AI applications today.
---
# FILE: ./concepts.mdx
---
title: Concepts
description: Explore core concepts of LLM tracing, observability, datasets, and evaluations in LangWatch to design reliable AI agent testing workflows.
keywords: LangWatch, concepts, tracing, observability, LLM, AI, travel, blog, user, customer, labels, threads, traces, spans
---
Understanding the core concepts of LangWatch is essential for effective observability in your LLM applications. This guide explains key terms and their relationships using practical examples, like building an AI travel assistant or a text generation service.
### Threads: The Whole Conversation
Field: `thread_id`
Think of a **Thread** as the entire journey a user takes in a single session. It's the complete chat with your AI travel buddy, from "Where should I go?" to booking the flight. For the blog post generator, a `thread_id` bundles up the whole session – from brainstorming headlines to polishing the final SEO-optimized draft. It groups *all* the back-and-forth interactions (Traces) for a specific task or conversation.
### Traces: One Task, End-to-End
Field: `trace_id`
<Note>While previously LangWatch allowed you to pass in a custom `trace_id`, we now generate it for you automatically, and provide no way to pass in your own.</Note>
Zooming in from Threads, a **Trace** represents a single, complete task performed by your AI. It's one round trip.
* **Travel Bot:** A user asking, "What are the cheapest flights to Bali in July?" is one Trace. Asking, "Does the hotel allow llamas?" is another Trace.
* **Blog Tool:** Generating headline options? That's a Trace. Drafting the intro paragraph? Another Trace. Optimizing for keywords? You guessed it – a Trace.
Each `trace_id` captures an entire end-to-end generation, no matter how many internal steps (Spans) it takes.
### Spans: The Building Blocks
Field: `span_id`
<Note>While previously LangWatch allowed you to pass in a custom `span_id`, we now generate it for you automatically, and provide no way to pass in your own.</Note>
Now, let's get granular! **Spans** are the individual steps or operations *within* a single Trace. Think of them as the building blocks of getting the job done.
* **Travel Bot Trace:** Might have a Span for the LLM call figuring out destinations, another Span querying an airline API for prices, and a final Span formatting the response.
* **Blog Tool Trace:** Could involve a Span for the initial text generation, a second Span where the LLM critiques its own work (clever!), and a third Span refining the text based on that critique.
Each `span_id` pinpoints a specific action taken by your system or an LLM call.
### User ID: Who's Using the App?
Field: `user_id`
Simple but crucial: The **User ID** identifies the actual end-user interacting with your product. Whether they're planning trips or writing posts, this `user_id` (usually their account ID in your system) links the activity back to a real person, helping you see how different users experience your AI features.
### Customer ID: For Platform Builders
Field: `customer_id`
Are you building a platform *for other companies* to create *their own* LLM apps? That's where the **Customer ID** shines. If you're providing the tools for others (your customers) to build AI assistants for *their* users, the `customer_id` lets you (and them!) track usage and performance per customer account. It's perfect for offering custom analytics dashboards, showing your customers how *their* AI implementations are doing.
### Labels: Your Organizational Superpowers
Field: `labels`
Think of **Labels** as flexible tags you can slap onto Traces to organize, filter, and compare anything you want! They're your secret weapon for slicing and dicing your data.
* **Categorize Actions:** Use labels like `blogpost_title` or `blogpost_keywords`.
* **Track Versions:** Label traces with `version:v1.0.0`, then deploy an improved prompt and label new traces `version:v1.0.1`.
* **Run Experiments:** Tag traces with `experiment:prompt_a` vs. `experiment:prompt_b`.
Labels make it easy to zoom in on specific features or A/B test different approaches right within the LangWatch dashboard.
---
# FILE: ./observability/overview.mdx
---
title: "Observability & Tracing"
description: "Monitor, debug, and optimize your LLM applications with comprehensive observability and tracing capabilities"
sidebarTitle: Overview
keywords: observability, tracing, langwatch, llm, ai, monitoring
---
See what's happening inside your LLM applications. LangWatch tracks every interaction, helps you debug issues, and shows you how your AI systems actually work in production.
<Frame>
<img
className="block"
src="/images/llm-observability/overview.webp"
alt="LangWatch Observability Dashboard"
/>
</Frame>
## Core Features
<CardGroup cols={2}>
<Card
title="Real-time Tracing"
description="Watch every LLM call and tool usage as it happens, with full context."
icon="chart-network"
href="/concepts"
horizontal
arrow
/>
<Card
title="User Events"
description="See how users actually interact with your AI - thumbs up, selections, custom events."
icon="users"
href="/user-events/overview"
horizontal
arrow
/>
<Card
title="Cost Tracking"
description="Know exactly how much each model call costs you, down to the token."
icon="dollar-sign"
href="/integration/python/tutorials/tracking-llm-costs"
horizontal
arrow
/>
<Card
title="Monitor Performance"
description="Spot slow calls and bottlenecks before your users complain."
icon="gauge"
horizontal
/>
<Card
title="Automations & Alerts"
description="Get notified when things go wrong, or when costs spike unexpectedly."
icon="bell"
href="/features/automations"
horizontal
arrow
/>
<Card
title="Embedded Analytics"
description="Drop dashboards right into your app so your team can see what's happening."
icon="chart-bar"
href="/features/embedded-analytics"
horizontal
arrow
/>
</CardGroup>
## How it works
Add a few lines to your code and LangWatch starts tracking everything:
1. **Add the SDK** - Drop in a few lines of code to your existing app
2. **We track everything** - Automatically captures all your LLM calls and interactions
3. **See it live** - Watch what's happening in real-time through the dashboard
4. **Debug easily** - Click into any trace to see exactly what went wrong
## Get started
Pick your language and start tracking:
<CardGroup cols={2}>
<Card
title="Python SDK"
icon="python"
href="/integration/python/guide"
horizontal
arrow
/>
<Card
title="TypeScript SDK"
icon="code"
href="/integration/typescript/guide"
horizontal
arrow
/>
<Card
title="Go SDK"
icon="golang"
href="/integration/go/guide"
horizontal
arrow
/>
<Card
title="View All Integrations"
icon="plug"
href="/integration/overview"
horizontal
arrow
/>
</CardGroup>
---
# FILE: ./integration/overview.mdx
---
title: "Getting Started"
description: "LangWatch integrates with all major LLM providers, frameworks, and tools. See our complete list of integrations below."
---
# LangWatch, whatever your stack
<Tip>
**Pro Tip**: Start with our [Quick Start Guide](/integration/quick-start) to get up and running in minutes, then explore specific integrations based on your tech stack.
</Tip>
LangWatch is designed to be the most open and flexible platform for LLM observability that integrates with all the major LLM providers, frameworks, and tools. See a full list of integrations below.
LangWatch is based on OpenTelemetry. Use our Python SDK, TypeScript SDK, or Go SDK to log traces to LangWatch. Alternatively, you can also directly use our OpenTelemetry Endpoint from any language.
### MCP's
<Tip>
**Speedy**: Use the LangWatch MCP to automatically instrument your code with LangWatch.
</Tip>
<CardGroup cols={1}>
<Card title="LangWatch MCP" icon="brain-circuit" href="/integration/mcp" arrow>
Automatically instrument your code with LangWatch tracing, create and manage prompts, set up evaluations, debug production issues, and more.
</Card>
</CardGroup>
### SDK's
LangWatch provides SDKs for several programming languages.
<CardGroup cols={2}>
<Card title="Python SDK" icon="python" href="/integration/python/guide" arrow>
Complete Python SDK with automatic instrumentation for popular frameworks
</Card>
<Card title="TypeScript SDK" icon="square-js" href="/integration/typescript/guide" arrow>
Full-featured TypeScript/JavaScript SDK with type safety
</Card>
<Card title="Go SDK" icon="golang" href="/integration/go/guide" arrow>
High-performance Go SDK for server-side applications
</Card>
<Card title="OpenTelemetry" icon="telescope" href="/integration/opentelemetry/guide" arrow>
Native OpenTelemetry integration for any language
</Card>
</CardGroup>
### Frameworks
Use LangWatch to effortlessly integrate with popular AI frameworks
<CardGroup cols={3}>
<Card title="LangChain" icon="/images/logos/langchain.svg" href="/integration/python/integrations/langchain" horizontal arrow />
<Card title="LangGraph" icon="/images/logos/langchain.svg" href="/integration/python/integrations/langgraph" horizontal arrow />
<Card title="Vercel AI SDK" icon="/images/logos/vercel-ai.svg" href="/integration/typescript/integrations/vercel-ai-sdk" horizontal arrow />
<Card title="LiteLLM" icon="/images/logos/litellm.avif" href="/integration/python/integrations/lite-llm" horizontal arrow />
<Card title="OpenAI Agents" icon="/images/logos/openai.svg" href="/integration/python/integrations/open-ai-agents" horizontal arrow />
<Card title="Pydantic AI" icon="/images/logos/pydanticai.svg" href="/integration/python/integrations/pydantic-ai" horizontal arrow />
<Card title="Mastra" icon="/images/logos/mastra.svg" href="/integration/typescript/integrations/mastra" horizontal arrow />
<Card title="DSPy" icon="/images/logos/dspy.webp" href="/integration/python/integrations/dspy" horizontal arrow />
<Card title="LlamaIndex" icon="/images/logos/llamaindex.png" href="/integration/python/integrations/llamaindex" horizontal arrow />
<Card title="Haystack" icon="/images/logos/haystack.png" href="/integration/python/integrations/haystack" horizontal arrow />
<Card title="Strand Agents" icon="/images/logos/strand-agents.svg" href="/integration/python/integrations/strand-agents" horizontal arrow />
<Card title="Agno" icon="/images/logos/agno.png" href="/integration/python/integrations/agno" horizontal arrow />
<Card title="CrewAI" icon="/images/logos/crewai.svg" href="/integration/python/integrations/crew-ai" horizontal arrow />
<Card title="AutoGen" icon="/images/logos/ag.svg" href="/integration/python/integrations/autogen" horizontal arrow />
<Card title="Semantic Kernel" icon="/images/logos/semantic-kernel.png" href="/integration/python/integrations/semantic-kernel" horizontal arrow />
<Card title="Spring AI" icon="/images/logos/spring-boot.svg" href="/integration/java/integrations/spring-ai" horizontal arrow />
<Card title="PromptFlow" icon="/images/logos/promptflow.svg" href="/integration/python/integrations/promptflow" horizontal arrow />
<Card title="Google ADK" icon="/images/logos/google.svg" href="/integration/python/integrations/google-ai" horizontal arrow />
</CardGroup>
### Model Providers
Use LangWatch to effortlessly integrate with popular AI model providers
<CardGroup cols={3}>
<Card title="OpenAI" icon="/images/logos/openai.svg" href="/integration/python/integrations/open-ai" horizontal arrow />
<Card title="Anthropic Claude" icon="/images/logos/anthropic.svg" href="/integration/python/integrations/anthropic" horizontal arrow />
<Card title="Azure OpenAI" icon="/images/logos/azure.svg" href="/integration/go/integrations/azure-openai" horizontal arrow />
<Card title="Azure AI" icon="/images/logos/azure.svg" href="/integration/python/integrations/azure-ai" horizontal arrow />
<Card title="Vertex AI" icon="/images/logos/google.svg" href="/integration/python/integrations/vertex-ai" horizontal arrow />
<Card title="Gemini" icon="/images/logos/google.svg" href="/integration/go/integrations/google-gemini" horizontal arrow />
<Card title="AWS Bedrock" icon="/images/logos/aws.svg" href="/integration/python/integrations/aws-bedrock" horizontal arrow />
<Card title="Groq" icon="/images/logos/groq.svg" href="/integration/go/integrations/groq" horizontal arrow />
<Card title="Grok (xAI)" icon="/images/logos/grok.svg" href="/integration/go/integrations/grok" horizontal arrow />
<Card title="Ollama" icon="/images/logos/ollama.png" href="/integration/go/integrations/ollama" horizontal arrow />
<Card title="OpenRouter" icon="/images/logos/openrouter.svg" href="/integration/go/integrations/openrouter" horizontal arrow />
</CardGroup>
### No-Code Platforms
No-code agent builders and tools
<CardGroup cols={3}>
<Card title="n8n" icon="/images/logos/n8n.svg" href="/integration/n8n" horizontal arrow />
<Card title="Flowise" icon="/images/logos/flowise.svg" href="/integration/flowise" horizontal arrow />
<Card title="Langflow" icon="/images/logos/langflow.svg" href="/integration/langflow" horizontal arrow />
</CardGroup>
### Other Official LangWatch Integrations
LangWatch provides several official integrations with other tools and services.
<CardGroup cols={2}>
<Card title="REST API" icon="globe" href="/integration/rest-api" horizontal arrow>
Direct API integration for custom applications
</Card>
<Card title="MCP" icon="brain-circuit" href="/integration/mcp" horizontal arrow>
Model Context Protocol integration
</Card>
</CardGroup>
## Request a new integration
We use [GitHub Discussions](https://github.com/orgs/langwatch/discussions/new?category=integration-request) to track interest in new integrations. Please upvote/add to the list below if you'd like to see a new integration.
---
# FILE: ./integration/quick-start.mdx
---
title: Quick Start
mode: "wide"
---
LangWatch helps you understand every user interaction (**Thread**), each individual AI task (**Trace**), and all the underlying steps (**Span**) involved. We've made getting started super smooth.
Let's get cracking.
<Steps>
<Step title="Create your LangWatch account">
First step: if you haven't already, grab your LangWatch account. Head over to [langwatch.ai](https://app.langwatch.ai), sign up, and get your API key ready.
<img src="/images/llm-observability/quick-start/setup-full.webp" />
</Step>
<Step title="Sign in with LangWatch">
Open a terminal and run the following command to sign in with LangWatch:
```bash
npx langwatch login
```
This will add the `LANGWATCH_API_KEY` to your local `.env` file.
</Step>
<Step title="Let LangWatch MCP do the rest for you (Optional)">
Install the [LangWatch MCP Server](/integration/mcp) and ask your coding assistant (Cursor, Claude Code, Codex, etc.) to instrument your codebase with LangWatch, OR keep following the steps below to instrument your codebase manually.
Add the LangWatch MCP to your editor:
```json
{
"mcpServers": {
"langwatch": {
"command": "npx",
"args": ["-y", "@langwatch/mcp-server"]
}
}
}
```
Then ask your coding assistant to instrument your codebase with LangWatch:
```plaintext
"Instrument my codebase with LangWatch"
```
</Step>
<Step title="Install the LangWatch SDK">
We have official SDKs for Python and Node.js ready to go. If you're using another language, our [OpenTelemetry Integration Guide](/integration/opentelemetry/guide) provides the details you need.
<CodeGroup>
```bash Python
pip install langwatch
# or
uv add langwatch
```
```bash JavaScript
npm install langwatch @vercel/otel @opentelemetry/api-logs @opentelemetry/instrumentation @opentelemetry/sdk-logs
```
</CodeGroup>
</Step>
<Step title="Add LangWatch to your project">
Time to connect LangWatch. Initialize the SDK within your project. Here's how you can set it up:
<CodeGroup>
```python Python
import langwatch
import os
from langwatch.instrumentors import OpenAIInstrumentor
langwatch.setup(
api_key=os.getenv("LANGWATCH_API_KEY"), # Your LangWatch API key
instrumentors=[OpenAIInstrumentor()] # Add the instrumentor for your LLM
)
```
```javascript JavaScript
// ./next.config.js - Enable the Next.js instrumentation hook
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
instrumentationHook: true,
},
};
module.exports = nextConfig;
// ./src/instrumentation.ts - Configure LangWatch export
import { registerOTel } from '@vercel/otel';
import { LangWatchExporter } from 'langwatch';
export function register() {
registerOTel({
serviceName: 'your-app-name', // Give your service a clear name
traceExporter: new LangWatchExporter({
apiKey: process.env.LANGWATCH_API_KEY, // Your LangWatch API key
})
});
}
// ./src/index.ts - Enable telemetry where needed
const result = await generateText({
model: openai('gpt-5'),
prompt: 'How many calories do I burn jumping to conclusions?',
experimental_telemetry: {
isEnabled: true, // Ensure telemetry is active for relevant operations
},
});
```
</CodeGroup>
</Step>
<Step title="Start observing!">
You're all set! Jump into your LangWatch dashboard to see your data flowing in. You'll find **Traces** (individual AI tasks) and their detailed **Spans** (the steps within), all organized into **Threads** (complete user sessions). Start exploring and use **User IDs** or custom **Labels** to dive deeper!
<img src="/images/llm-observability/quick-start/setup-monitor.webp" />
</Step>
</Steps>
---
# FILE: ./integration/code-examples.mdx
---
title: Code Examples
description: Explore code examples showing LangWatch integrations for tracing, evaluating, and improving AI agent testing pipelines.
keywords: langwatch, examples, code, integration, python, typescript, opentelemetry
---
Below are some examples for integrating LangWatch into your project.
### Python
<CardGroup cols={3}>
<Card title="Azure OpenAI Streaming Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/azure_openai_stream_bot.py" />
<Card title="Custom Evaluation Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/custom_evaluation_bot.py" />
<Card title="DSPy Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/dspy_bot.py" />
<Card title="DSPy Visualization" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/dspy_visualization.ipynb" />
<Card title="Evaluation Manual Call" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/evaluation_manual_call.py" />
<Card title="FastAPI App" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/fastapi_app.py" />
<Card title="Generic Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/generic_bot.py" />
<Card title="Generic Bot Exception" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/generic_bot_exception.py" />
<Card title="Generic Bot RAG" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/generic_bot_rag.py" />
<Card title="Generic Bot RAG Expected Output" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/generic_bot_rag_expected_output.py" />
<Card title="Generic Bot Span Context Manager" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/generic_bot_span_context_manager.py" />
<Card title="Generic Bot Span Low Level" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/generic_bot_span_low_level.py" />
<Card title="Generic Bot Sync Function" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/generic_bot_sync_function.py" />
<Card title="Generic Bot Update Metadata Later" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/generic_bot_update_metadata_later.py" />
<Card title="Guardrails" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/guardrails.py" />
<Card title="Guardrails Parallel" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/guardrails_parallel.py" />
<Card title="Guardrails Without Tracing" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/guardrails_without_tracing.py" />
<Card title="LangChain Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/langchain_bot.py" />
<Card title="LangChain RAG Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/langchain_rag_bot.py" />
<Card title="LangChain RAG Bot Vertex AI" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/langchain_rag_bot_vertex_ai.py" />
<Card title="LiteLLM Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/litellm_bot.py" />
<Card title="OpenAI Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/openai_bot.py" />
<Card title="OpenAI Bot Function Call" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/openai_bot_function_call.py" />
<Card title="OpenAI Bot RAG" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/openai_bot_rag.py" />
<Card title="Weaviate DSPy Visualization" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/weaviate_dspy_visualization.ipynb" />
<Card title="Streamlit OpenAI Assistants API Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/streamlit_openai_assistants_api_bot.py" />
</CardGroup>
### TypeScript
<CardGroup cols={3}>
<Card title="LangGraph Chatbot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/typescript-sdk/examples/langgraph" />
<Card title="LangChain Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/typescript-sdk/examples/langchain" />
<Card title="Mastra Weather Agent" icon="link" href="https://github.com/langwatch/langwatch/blob/main/typescript-sdk/examples/mastra" />
<Card title="Prompt CLI" icon="link" href="https://github.com/langwatch/langwatch/blob/main/typescript-sdk/examples/prompt-cli" />
<Card title="Vercel AI SDK Chatbot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/typescript-sdk/examples/vercel-ai" />
</CardGroup>
### Go
<CardGroup cols={3}>
<Card title="LangWatch Go SDK" icon="link" href="https://github.com/langwatch/langwatch/blob/main/go-sdk/examples" />
</CardGroup>
### OpenTelemetry
<CardGroup cols={3}>
<Card title="OpenInference DSPy Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/opentelemetry/openinference_dspy_bot.py" />
<Card title="OpenInference Haystack" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/opentelemetry/openinference_haystack.py" />
<Card title="OpenInference LangChain Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/opentelemetry/openinference_langchain_bot.py" />
<Card title="OpenInference OpenAI Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/opentelemetry/openinference_openai_bot.py" />
<Card title="OpenTelemetry Anthropic Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/opentelemetry/openllmetry_anthropic_bot.py" />
<Card title="OpenTelemetry LangChain Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/opentelemetry/openllmetry_langchain_bot.py" />
<Card title="OpenTelemetry OpenAI Bot" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/opentelemetry/openllmetry_openai_bot.py" />
<Card title="Traditional Instrumentation FastAPI App" icon="link" href="https://github.com/langwatch/langwatch/blob/main/python-sdk/examples/opentelemetry/traditional_instrumentation_fastapi_app.py" />
</CardGroup>
---
# FILE: ./integration/python/integrations/promptflow.mdx
---
title: PromptFlow Instrumentation
sidebarTitle: PromptFlow
description: Instrument PromptFlow with LangWatch to trace pipelines, measure outcomes, and power AI agent testing workflows.
keywords: promptflow, python, sdk, instrumentation, opentelemetry, langwatch, tracing
---
PromptFlow is a development tool designed to streamline the entire development cycle of AI applications, from ideation, prototyping, testing, evaluation to production deployment and monitoring. For more details on PromptFlow, refer to the [official PromptFlow documentation](https://microsoft.github.io/promptflow/).
LangWatch can capture traces generated by PromptFlow by leveraging its built-in OpenTelemetry support. This guide will show you how to set it up.
## Prerequisites
1. **Install LangWatch SDK**:
```bash
pip install langwatch
```
2. **Install PromptFlow and OpenInference instrumentor**:
```bash
pip install promptflow openinference-instrumentation-promptflow
```
3. **Set up your LLM provider**:
You'll need to configure your preferred LLM provider (OpenAI, Anthropic, etc.) with the appropriate API keys.
## Instrumentation with OpenInference
LangWatch supports seamless observability for PromptFlow using the [OpenInference PromptFlow instrumentor](https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-promptflow). This approach automatically captures traces from your PromptFlow flows and sends them to LangWatch.
### Basic Setup (Automatic Tracing)
Here's the simplest way to instrument your application:
```python
import langwatch
from promptflow import PFClient
from openinference.instrumentation.promptflow import PromptFlowInstrumentor
import os
# Initialize LangWatch with the PromptFlow instrumentor
langwatch.setup(
instrumentors=[PromptFlowInstrumentor()]
)
# Set up environment variables
os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
# Initialize PromptFlow client
pf = PFClient()
# Use PromptFlow as usual—traces will be sent to LangWatch automatically
def run_promptflow_flow(flow_path: str, inputs: dict):
# Run a flow
result = pf.run(
flow=flow_path,
inputs=inputs
)
return result
# Example usage
if __name__ == "__main__":
# Example flow path and inputs
flow_path = "./my_flow"
inputs = {
"question": "What is the capital of France?",
"context": "Geography information"
}
result = run_promptflow_flow(flow_path, inputs)
print(f"Flow result: {result}")
```
**That's it!** All PromptFlow operations will now be traced and sent to your LangWatch dashboard automatically.
### Optional: Using Decorators for Additional Context
If you want to add additional context or metadata to your traces, you can optionally use the `@langwatch.trace()` decorator:
```python
import langwatch
from promptflow import PFClient
from openinference.instrumentation.promptflow import PromptFlowInstrumentor
import os
langwatch.setup(
instrumentors=[PromptFlowInstrumentor()]
)
# ... client setup code ...
@langwatch.trace(name="PromptFlow Flow Execution")
def run_promptflow_flow(flow_path: str, inputs: dict):
# Update the current trace with additional metadata
current_trace = langwatch.get_current_trace()
if current_trace:
current_trace.update(
metadata={
"user_id": "user_123",
"session_id": "session_abc",
"flow_path": flow_path,
"input_count": len(inputs)
}
)
result = pf.run(
flow=flow_path,
inputs=inputs
)
return result
```
## How it Works
1. `langwatch.setup()`: Initializes the LangWatch SDK, which includes setting up an OpenTelemetry trace exporter. This exporter is ready to receive spans from any OpenTelemetry-instrumented library in your application.
2. `PromptFlowInstrumentor()`: The OpenInference instrumentor automatically patches PromptFlow components to create OpenTelemetry spans for their operations, including:
- Flow execution
- Node execution
- LLM calls
- Tool executions
- Data processing
- Input/output handling
3. **Optional Decorators**: You can optionally use `@langwatch.trace()` to add additional context and metadata to your traces, but it's not required for basic functionality.
With this setup, all flow executions, node operations, model calls, and data processing will be automatically traced and sent to LangWatch, providing comprehensive visibility into your PromptFlow-powered applications.
## Environment Variables
Make sure to set the following environment variables:
```bash
# For OpenAI
export OPENAI_API_KEY=your-openai-api-key
# For Anthropic
export ANTHROPIC_API_KEY=your-anthropic-api-key
# LangWatch API key
export LANGWATCH_API_KEY=your-langwatch-api-key
```
## Supported Models
PromptFlow supports various LLM providers including:
- OpenAI (GPT-5, GPT-4o, etc.)
- Anthropic (Claude models)
- Local models (via Ollama, etc.)
- Other providers supported by PromptFlow
All model interactions and flow executions will be automatically traced and captured by LangWatch.
## Notes
- You do **not** need to set any OpenTelemetry environment variables or configure exporters manually—`langwatch.setup()` handles everything.
- You can combine PromptFlow instrumentation with other instrumentors (e.g., OpenAI, LangChain) by adding them to the `instrumentors` list.
- The `@langwatch.trace()` decorator is **optional** - the OpenInference instrumentor will capture all PromptFlow activity automatically.
- For advanced configuration (custom attributes, endpoint, etc.), see the [Python integration guide](/integration/python/guide).
## Troubleshooting
- Make sure your `LANGWATCH_API_KEY` is set in the environment.
- If you see no traces in LangWatch, check that the instrumentor is included in `langwatch.setup()` and that your PromptFlow code is being executed.
- Ensure you have the correct API keys set for your chosen LLM provider.
## Interoperability with LangWatch SDK
You can use this integration together with the LangWatch Python SDK to add additional attributes to the trace:
```python
import langwatch
from promptflow import PFClient
from openinference.instrumentation.promptflow import PromptFlowInstrumentor
langwatch.setup(
instrumentors=[PromptFlowInstrumentor()]
)
@langwatch.trace(name="Custom PromptFlow Application")
def my_custom_promptflow_app(flow_path: str, inputs: dict):
# Your PromptFlow code here
pf = PFClient()
# Update the current trace with additional metadata
current_trace = langwatch.get_current_trace()
if current_trace:
current_trace.update(
metadata={
"user_id": "user_123",
"session_id": "session_abc",
"flow_path": flow_path,
"input_count": len(inputs)
}
)
# Run your flow
result = pf.run(
flow=flow_path,
inputs=inputs
)
return result
```
This approach allows you to combine the automatic tracing capabilities of PromptFlow with the rich metadata and custom attributes provided by LangWatch.
---
# FILE: ./integration/python/integrations/langchain.mdx
---
title: LangChain Instrumentation
sidebarTitle: Python
description: Instrument LangChain applications with LangWatch to trace chains, RAG flows, and metrics for AI agent evaluations.
icon: python
keywords: langchain, instrumentation, callback, langwatch, python, tracing
---
LangWatch integrates with Langchain to provide detailed observability into your chains, agents, LLM calls, and tool usage.
## Installation
<CodeGroup>
```bash pip
pip install langwatch langchain langchain-openai
```
```bash uv
uv add langwatch langchain langchain-openai
```
</CodeGroup>
## Usage
<Info>
The LangWatch API key is configured by default via the `LANGWATCH_API_KEY` environment variable.
</Info>
Use LangWatch's callback handler to instrument your Langchain agents and chains. The callback automatically captures LLM calls, tool usage, and chain execution as spans within your trace.
```python
import langwatch
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI
from langchain_core.runnables import RunnableConfig
import os
import asyncio
langwatch.setup()
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"It's always sunny in {city}!"
agent = create_agent(
model="openai:gpt-5",
tools=[get_weather],
system_prompt="You are a helpful assistant, that can get the weather.",
)
@langwatch.trace(name="Langchain - Weather Agent")
def main(user_question: str):
result = agent.invoke(
{"messages": [{"role": "user", "content": user_question}]},
config=RunnableConfig(
callbacks=[langwatch.get_current_trace().get_langchain_callback()]
),
)
return result["messages"][-1].content
if __name__ == "__main__":
result = main("What is the weather in Philadelphia?")
print(result)
```
The `@langwatch.trace()` decorator creates a parent trace, and `get_langchain_callback()` provides a callback handler that captures Langchain events as spans. Pass the callback to your agent or chain's `RunnableConfig` to enable instrumentation.
## Related
- [Capturing RAG](/integration/python/tutorials/capturing-rag) - Learn how to capture RAG data from LangChain retrievers and tools
- [Capturing Metadata and Attributes](/integration/python/tutorials/capturing-metadata) - Add custom metadata and attributes to your traces and spans
- [Capturing Evaluations & Guardrails](/integration/python/tutorials/capturing-evaluations-guardrails) - Log evaluations and implement guardrails in your LangChain applications
---
# FILE: ./integration/python/integrations/agno.mdx
---
title: Agno Instrumentation
sidebarTitle: Agno
description: Instrument Agno agents with LangWatch’s Python SDK to send traces, analyze behaviors, and strengthen AI agent testing and evaluations.
keywords: agno, openinference, langwatch, python, tracing, observability
---
LangWatch integrates with Agno through OpenInference instrumentation to capture traces from your Agno agents automatically.
## Installation
<CodeGroup>
```bash pip
pip install langwatch agno openai openinference-instrumentation-agno
```
```bash uv
uv add langwatch agno openai openinference-instrumentation-agno
```
</CodeGroup>
## Usage
<Info>
The LangWatch API key is configured by default via the `LANGWATCH_API_KEY` environment variable.
</Info>
Use the OpenInference instrumentation for Agno by passing `AgnoInstrumentor` to `langwatch.setup()`.
```python
import langwatch
import os
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from openinference.instrumentation.agno import AgnoInstrumentor
langwatch.setup(instrumentors=[AgnoInstrumentor()])
# Create and configure your Agno agent
agent = Agent(
name="A helpful AI Assistant",
model=OpenAIChat(id="gpt-5"),
tools=[],
instructions="You are a helpful AI Assistant.",
debug_mode=True,
)
agent.print_response("Tell me a joke.")
```
The `AgnoInstrumentor` automatically captures all Agno agent activity. All traces will be sent to your LangWatch dashboard without requiring manual OpenTelemetry configuration.
## Related