Python client
The Python client allows you to easily interact with the Query Agent API from your Python applications.
It relies on the Weaviate Client package, and handles authentication and connection to your Weaviate instance from there.
The latest Query Agent Python client is version v1.5.0.
Installation
The Query Agent Python client is distributed as the weaviate-agents package on PyPI, and depends on the weaviate-client package. You can install it in one of two equivalent ways.
Recommended: Install via the weaviate-client extra
pip install -U "weaviate-client[agents]"
This installs weaviate-client together with its agents extra, which pulls in a compatible version of weaviate-agents. This is the recommended form because it makes the relationship explicit — weaviate-agents is a sub-package designed to be used alongside weaviate-client.
Alternative: Install weaviate-agents directly
pip install -U weaviate-agents
weaviate-agents declares weaviate-client as a hard dependency, so this command also installs both packages. The end result is the same set of installed packages as the recommended form.
Imports
Both install commands install the same two packages (weaviate-client and weaviate-agents), so the following two import styles both work and are equivalent in practice — pick whichever you prefer:
# Style A — import directly from the agents package
from weaviate_agents.query import QueryAgent
# Style B — import via the weaviate.agents namespace
from weaviate.agents.query import QueryAgent
If you try to import a Weaviate agent from the Weaviate Python Client without the agents package being installed, i.e.
from weaviate.agents import ...
it will raise a WeaviateAgentsNotInstalledError. Simply install the agents package via the above installation options to fix.
Troubleshooting: Force pip to install the latest version
For existing installations, even pip install -U "weaviate-client[agents]" may not upgrade weaviate-agents to the latest version. If this occurs, additionally try to explicitly upgrade the weaviate-agents package:
pip install -U weaviate-agents
Or install a specific version:
pip install -U weaviate-agents==1.5.0
Questions and feedback
If you have any questions or feedback, let us know in the user forum.
