From b00841f1991041bb2e3d3171b6c47736e42e97ff Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Tue, 29 Sep 2026 13:41:04 +0000 Subject: [PATCH] docs(python): Document TypeSafe AI Jev tracing Co-Authored-By: Alexander Webb --- docs/platforms/python/agent-tracing/index.mdx | 1 + .../python/agent-tracing/typesafe/index.mdx | 85 +++++++++++++++++++ docs/platforms/python/integrations/index.mdx | 1 + src/components/platformIcon.tsx | 7 ++ 4 files changed, 94 insertions(+) create mode 100644 docs/platforms/python/agent-tracing/typesafe/index.mdx diff --git a/docs/platforms/python/agent-tracing/index.mdx b/docs/platforms/python/agent-tracing/index.mdx index 8c0839a4291b01..42c4be069beced 100644 --- a/docs/platforms/python/agent-tracing/index.mdx +++ b/docs/platforms/python/agent-tracing/index.mdx @@ -41,6 +41,7 @@ Pick your AI stack. Each page has install and verify details. {to: "/agent-tracing/pydantic-ai/", title: "Pydantic AI", icon: "pydantic-ai"}, {to: "/agent-tracing/huggingface_hub/", title: "Hugging Face Hub", icon: "huggingface_hub"}, {to: "/agent-tracing/mistral/", title: "Mistral", icon: "mistral"}, + {to: "/agent-tracing/typesafe/", title: "TypeSafe AI", icon: "typesafe-ai"}, ]} /> diff --git a/docs/platforms/python/agent-tracing/typesafe/index.mdx b/docs/platforms/python/agent-tracing/typesafe/index.mdx new file mode 100644 index 00000000000000..3082e80d4807bb --- /dev/null +++ b/docs/platforms/python/agent-tracing/typesafe/index.mdx @@ -0,0 +1,85 @@ +--- +title: TypeSafe AI +description: "Learn about using Sentry for TypeSafe AI." +sidebar_order: 30 +--- + +This integration connects Sentry with the [TypeSafe Python SDK](https://github.com/typesafe-ai/typesafe-sdk-python). + +Once you've installed this SDK, you can use the Sentry Agents Tracing, a Sentry dashboard that helps you understand what's going on with your AI requests. + +## Install + +Install `sentry-sdk` from PyPI: + +```bash {tabTitle:pip} +pip install sentry-sdk +``` + +```bash {tabTitle:uv} +uv add sentry-sdk +``` + +## Configure + +Add `TypeSafeIntegration()` to your `integrations` list: + +```python +import sentry_sdk +from sentry_sdk.integrations.typesafe import TypeSafeIntegration + +sentry_sdk.init( + dsn="___PUBLIC_DSN___", + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for tracing. + traces_sample_rate=1.0, + # Add data like inputs and responses; + # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info + send_default_pii=True, + integrations=[ + TypeSafeIntegration(), + ], +) +``` + +## Verify + +Verify that the integration works by making a request to TypeSafe AI. + +```python +import sentry_sdk +from sentry_sdk.integrations.typesafe import TypeSafeIntegration + +from typesafe_sdk import Choice, TypeSafeClient + +sentry_sdk.init( + dsn="___PUBLIC_DSN___", + traces_sample_rate=1.0, + send_default_pii=True, + integrations=[ + TypeSafeIntegration(), + ], +) + +client = TypeSafeClient(api_key="(your TypeSafe key)") + +response = client.system_one( + state={"document": "I was charged twice. Please fix this ASAP."}, + questions={ + "category": Choice( + instructions="What is this ticket about?", + criteria={"billing": None, "technical": None, "other": None}, + ), + }, +) +``` + +To try the async variant, use `AsyncTypeSafeClient` with `await`. + +After running this script, the resulting data should show up in the `AI Spans` tab on the `Explore > Traces > Trace` page on Sentry.io. + +It may take a couple of moments for the data to appear in [sentry.io](https://sentry.io). + +## Supported Versions + +- TypeSafe AI (`typesafe-sdk`): `0.7.0+` diff --git a/docs/platforms/python/integrations/index.mdx b/docs/platforms/python/integrations/index.mdx index a70de7f56497c1..d74c744516a865 100644 --- a/docs/platforms/python/integrations/index.mdx +++ b/docs/platforms/python/integrations/index.mdx @@ -53,6 +53,7 @@ The Sentry SDK uses integrations to hook into the functionality of popular libra | | ✓ | | | | | | ✓ | +| | | ### Data Processing diff --git a/src/components/platformIcon.tsx b/src/components/platformIcon.tsx index 9e43120a89fdf8..9686fd9614a5bf 100644 --- a/src/components/platformIcon.tsx +++ b/src/components/platformIcon.tsx @@ -145,6 +145,7 @@ import TokioSVG from 'platformicons/svg/tokio.svg'; import TornadoSVG from 'platformicons/svg/tornado.svg'; import TracingSVG from 'platformicons/svg/tracing.svg'; import TrytonSVG from 'platformicons/svg/tryton.svg'; +import TypeSafeSVG from 'platformicons/svg/typesafe-ai.svg'; import UnitySVG from 'platformicons/svg/unity.svg'; import UnoSVG from 'platformicons/svg/uno.svg'; import UnrealSVG from 'platformicons/svg/unreal.svg'; @@ -303,6 +304,7 @@ import TokioSVGLarge from 'platformicons/svg_80x80/tokio.svg'; import TornadoSVGLarge from 'platformicons/svg_80x80/tornado.svg'; import TracingSVGLarge from 'platformicons/svg_80x80/tracing.svg'; import TrytonSVGLarge from 'platformicons/svg_80x80/tryton.svg'; +import TypeSafeSVGLarge from 'platformicons/svg_80x80/typesafe-ai.svg'; import UnitySVGLarge from 'platformicons/svg_80x80/unity.svg'; import UnoSVGLarge from 'platformicons/svg_80x80/uno.svg'; import UnrealSVGLarge from 'platformicons/svg_80x80/unreal.svg'; @@ -929,6 +931,10 @@ const formatToSVG = { sm: TrytonSVG, lg: TrytonSVGLarge, }, + 'typesafe-ai': { + sm: TypeSafeSVG, + lg: TypeSafeSVGLarge, + }, unity: { sm: UnitySVG, lg: UnitySVGLarge, @@ -1181,6 +1187,7 @@ export const PLATFORM_TO_ICON = { sql: 'sql', sqlserver: 'sqlserver', swift: 'swift', + 'typesafe-ai': 'typesafe-ai', unity: 'unity', // This will be deprecated in favor of 'unrealengine' ue4: 'unreal',