Repository navigation
feat(weaviate): report crewai-tools in the Weaviate integration header - #8322
Duda Nogueira (dudanogueira) wants to merge 2 commits into
Conversation
Strix Security ReviewWarning This pull request has 220 commits after the last Strix review ( No security issues found. Review summaryReviewed the full diff: the new Weaviate integration-header helpers in Updated for Reviewed by Strix |
316e76f to
57ec9ce
Compare
57ec9ce to
f3b92ee
Compare
Weaviate reads `X-Weaviate-Client-Integration` (since server 1.38.0) to attribute
traffic to the integration that produced it. The tool sent nothing, so CrewAI was
invisible in that telemetry.
Registration goes through `client.integrations.configure` rather than the `headers=`
argument, because that applies the header to the gRPC transport as well as REST --
searches travel over gRPC. It is best-effort: `_IntegrationConfig` is private API, so
a `weaviate-client` without it skips registration instead of breaking the tool.
`MongoDBVectorSearchTool` already identifies CrewAI to its database the same way, via
`DriverInfo(name="CrewAI", version=version("crewai-tools"))`.
Verified against Weaviate 1.39.5: the header arrives on both transports as
`crewai-tools/<version>`.
Adds the first tests for this tool.
Raises the floor from 4.10.2 to the current release. The lock previously resolved two versions (4.16.2 and 4.21.3) depending on the Python marker; it now resolves 4.23.1 everywhere, which also drops the unused grpcio-health-checking. 4.23.1 still ships `weaviate.connect.integrations._IntegrationConfig`, so the integration header registration is unchanged; checked live against Weaviate 1.39.5 (header present on REST and gRPC).
f3b92ee to
287d02f
Compare
Related issue
Fixes #8321
Summary
Since server 1.38.0, Weaviate reads the
X-Weaviate-Client-Integrationheader to tell which integration sent a request.WeaviateVectorSearchTooldoesn't send it, so Weaviate's telemetry can't see that CrewAI sent the traffic.MongoDBVectorSearchToolalready sends the same kind of identification withDriverInfo(name="CrewAI", ...).client.integrations.configureinstead ofheaders=. Aheaders=argument only goes on REST requests, buthybridsearch goes over gRPC.integrations.configuresets the header on both.configuretakes a subclass of_IntegrationConfig, which is private API inweaviate-client. The import, the subclass and the call all sit inside onetry. If anything fails, it logs at debug level and the search runs as before.crewai-toolspackage metadata.crewai_tools.__version__would be a circular import. If the version can't be read, the value iscrewai-tools/unknown.weaviate-clientraised from 4.10.2 to 4.23.1. The lock used to resolve 4.16.2 or 4.21.3 depending on the Python marker. It now resolves 4.23.1 everywhere and dropsgrpcio-health-checking. Most of theuv.lockdiff comes from this. The bump isn't needed for the header, and I can drop it if you'd rather keep the old minimum.Things to look at in review:
_register_integration: check that every failure path, including a failed import, is caught, and that the header is set beforecollections.getand the query._CrewAIIntegration: the field'sserialization_aliasbecomes the header name.Verification
Tests added or updated for the changed behavior
Relevant tests and quality checks pass locally
This tool had no tests before. The new
tests/tools/test_weaviate_vector_search_tool.pyhas 15 fully mocked tests. They cover how the version is read, the header name and value, the header staying within Weaviate's 128-bytename/versionformat, skipping registration when the private API is missing orconfigureraises, and setting the header before the query runs.The full
crewai-toolssuite passes (1053 passed, 9 skipped).ruff check,ruff format --checkandmypyare clean on the changed files.Checked by hand against Weaviate 1.39.5:
crewai-tools/<version>on both REST and gRPC.X-Weaviate-Client-Integration: crewai-tools/1.15.28on both REST and gRPC.Additional context
weaviate-clientchanges or removes_IntegrationConfig, registration is skipped and only attribution is lost.Note
Low Risk
Telemetry-only change with defensive error handling; dependency bump is the main install-time impact for consumers of the weaviate extra.
Overview
Weaviate vector search now registers CrewAI with Weaviate telemetry by setting
X-Weaviate-Client-Integration: crewai-tools/<version>viaclient.integrations.configure(so the header applies on gRPC as well as REST), immediately after connect and before queries. Version comes from distribution metadata with an"unknown"fallback; registration is best-effort and must not break searches if the integrations API is missing or fails.The optional
weaviate-clientextra minimum is raised to>=4.23.1, withuv.lockrefreshed accordingly.A new mocked test module covers version resolution, header shape, ordering, failure paths, and end-to-end
_runbehavior.Reviewed by Cursor Bugbot for commit f3b92ee. Bugbot is set up for automated code reviews on this repo. Configure here.