Skip to main content

traceAI-tavily

Trace TavilyClient and AsyncTavilyClient search and extraction calls in Future AGI.

Install

Requires Python 3.10–3.13, tavily-python>=0.8.4,<1, and fi-instrumentation-otel>=1.1.0.

pip install "traceAI-tavily>=0.1.0"

Set FI_API_KEY, FI_SECRET_KEY and TAVILY_API_KEY in your environment. For a self-hosted Future AGI deployment, also set FI_BASE_URL to its base URL.

import os

from fi_instrumentation import register
from fi_instrumentation.fi_types import ProjectType
from tavily import TavilyClient
from traceai_tavily import TavilyInstrumentor

tracer_provider = register(
    project_name="tavily-example", project_type=ProjectType.OBSERVE, verbose=False
)
TavilyInstrumentor().instrument(tracer_provider=tracer_provider)

client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"])
response = client.search("What is OpenTelemetry?", max_results=2)
print("results:", len(response["results"]))
tracer_provider.force_flush()

Open the tavily-example project in Future AGI to find the tavily.search span. Calls made inside an active OpenTelemetry span appear as its children. The instrumentor also supports using_session, using_user and suppress_tracing from fi_instrumentation.

Supported calls

Both client classes support these spans. With AsyncTavilyClient, await the method and close the client with await client.close() when finished. The deprecated tavily.Client subclass inherits the synchronous instrumentation.

Method Span Kind
search tavily.search RETRIEVER
extract tavily.extract TOOL

Private HTTP helpers and convenience methods have no separate spans. If a convenience method calls a supported method, that underlying call is traced once. Usage, credits and search options are not recorded.

Privacy and attributes

  • Search queries and extract reranking queries are recorded as input.value, with client keys redacted and text capped at 1,024 UTF-8 bytes. Search also records gen_ai.retrieval.query.
  • Result bodies and URL arguments are not recorded. Extraction records URL counts instead. Text you put into a query is still input text; hide inputs if it is sensitive.
  • tavily.result_count records the number of results when present; tavily.failed_result_count records failed extractions. Unknown counts are omitted.
  • Set FI_HIDE_INPUTS=true to mask inputs, omit retrieval queries and remove search/extract query text from error details.
  • Set FI_PII_REDACTION=true to redact supported personal-data patterns before query text is capped, so truncation cannot leave a recognizable PII fragment. You can also pass config=TraceConfig(hide_inputs=True, pii_redaction=True) to instrument(), importing TraceConfig from fi_instrumentation.

Errors are re-raised unchanged. Search HTTP/transport failures record only the exception type, never messages or tracebacks: these errors can include custom endpoint credentials. Other search errors retain scrubbed, frames-free summaries. Extraction failures also record only the type, because errors can echo sensitive URL arguments. Type-only recording applies even with default privacy settings and on the minimum supported core version. Cancelling an async call sets ERROR and tavily.cancelled=true, without an exception event. Instrumentation failures do not replace your SDK result or exception.

LangChain and LangGraph

For langchain_tavily.TavilySearch or the community Tavily tool, use traceAI-langchain to trace the tool call. This package targets bare Tavily clients, not those tool wrappers.

If your own LangChain tool calls TavilyClient, enabling both instrumentors creates a tool span and a lower-level client span. Enable only LangChain tracing if you want one span per tool call. To hide tool results that become a later agent input, set both FI_HIDE_INPUTS=true and FI_HIDE_OUTPUTS=true.

Troubleshooting

  • No spans: instrument before calling the client, pass the provider returned by register(), and flush before a short-lived process exits. Check the traceai_tavily logger for an unsupported SDK version or a moved method.
  • Stop tracing: TavilyInstrumentor().uninstrument() restores the original client methods; subsequent calls are not traced.

Metadata

Release files for traceAI-tavily 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for traceAI-tavily 0.1.1
File Size Uploaded Provenance Actions
traceai_tavily-0.1.1.tar.gz 12.1 kB Without provenance Details for traceai_tavily-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for traceAI-tavily 0.1.1
File Interpreter ABI Platform Actions
traceai_tavily-0.1.1-py3-none-any.whl Python 3 none any Details for traceai_tavily-0.1.1-py3-none-any.whl

Total release size: 24.4 kB

Release files / traceai_tavily-0.1.1.tar.gz

Download URL traceai_tavily-0.1.1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
98b885355c9d7565bd788af52e6dd1256350c2e83f775ed57d3ba44479861096
BLAKE2b-256 checksum
How to use checksums
1b801a5de43f60b3d006f530e41a6e35e5bec3885719bc570e6da5b4471956cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / traceai_tavily-0.1.1-py3-none-any.whl

Download URL traceai_tavily-0.1.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41d7971d72446269e580c4dbe4b38610f266d6c86bc8d15d80c43de2f63cd2e6
BLAKE2b-256 checksum
How to use checksums
306ce5bd6ba08527e09b1d94886dda6cf5cb332ce241dc7b0c50bd9783331806
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for traceAI-tavily 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page