Skip to content

docs: clarify header defaults for custom session/client injection#165

Open
shaun0927 wants to merge 1 commit into
tavily-ai:masterfrom
shaun0927:docs/clarify-custom-session-headers
Open

docs: clarify header defaults for custom session/client injection#165
shaun0927 wants to merge 1 commit into
tavily-ai:masterfrom
shaun0927:docs/clarify-custom-session-headers

Conversation

@shaun0927
Copy link
Copy Markdown

@shaun0927 shaun0927 commented Apr 16, 2026

Summary

  • clarify README behavior for custom session/client injection when api_key is also provided
  • document that Tavily fills in missing default headers on the externally-owned object
  • recommend a dedicated session/client when callers want Tavily defaults isolated from other traffic

Why

The current implementation and tests already support this behavior, but the README only says that custom headers take precedence and that external sessions are user-managed. This small clarification makes the current contract more explicit for integrators using shared HTTP clients.

Testing

  • pytest -q tests/test_custom_session.py tests/test_session_pooling.py
  • README-only change; no runtime behavior changed

Closes #164

The custom session/client injection feature intentionally preserves
existing headers while filling in Tavily defaults when callers also
provide an api_key. The README described precedence and lifecycle but
not the default-header injection behavior, which can surprise users who
reuse shared HTTP clients.

Constraint: Keep scope to README-only clarification for mergeability
Rejected: Change runtime behavior to avoid mutating external clients | behavior is already documented in tests and intended by design
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep docs aligned with the tested contract for custom session/client injection
Tested: `pytest -q tests/test_custom_session.py tests/test_session_pooling.py`
Not-tested: Runtime behavior beyond existing covered tests
@shaun0927
Copy link
Copy Markdown
Author

This PR is ready for review.

Why I kept the scope narrow:

  • README-only clarification
  • no runtime behavior changes
  • wording matches the current implementation and tests for custom session/client injection

Validation:

  • pytest -q tests/test_custom_session.py tests/test_session_pooling.py

The goal here is only to make the existing contract more explicit for integrators using shared HTTP clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: clarify custom session/client header defaults

1 participant