# Collection configuration

The Query Agent, in Ask Mode or Search Mode, has the option to search one or more of any collections that are provided to it.

These collections can either be specified by a string (the name of the collection) or via a more advanced configuration.

### Simple configuration

To give your collections without any advanced configuration, you can just pass strings of the collection names to the Query Agent.

:::code-group{sync="languages"}
```python title="Python"
from weaviate.agents.query import QueryAgent

qa = QueryAgent(
    client=client,
    collections=["ECommerce", "FinancialContracts"],
)
```

```typescript title="JavaScript/TypeScript"
import { QueryAgent } from 'weaviate-agents';

const qaSimple = new QueryAgent(client, {
    collections: ['ECommerce', 'FinancialContracts'],
});
```
:::

### Advanced configuration

You can provide a more detailed configuration on how you want the agents to interact with your collections to define the tenant names (for a multi-tenant collection), target vector(s), property names and any additional filters.

::::tabs{sync="languages"}
:::tab{title="Python"}
```python
from weaviate.agents.classes import QueryAgentCollectionConfig

qa = QueryAgent(
    client=client,
    collections=[
        # Use QueryAgentCollectionConfig class to provide further collection configuration
        QueryAgentCollectionConfig(
            name="ECommerce", 
            target_vector=[
                "name_description_brand_vector"
            ], 
            view_properties=[
                "name",
                "description",
                "category",
                "brand",
            ],  
        ),
        QueryAgentCollectionConfig(
            name="FinancialContracts"
        ),
    ],
)
```

The `QueryAgentCollectionConfig` class accepts the following arguments:

| Field                | Type                       | Description                                                                                                                                                                                      |
| -------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `name`               | `str`                      | The name of the collection to query. Required.                                                                                                                                                   |
| `target_vector`      | `str \| list[str] \| None` | An optional list of target vector name(s) for collections with named vectors. Required when the collection has more than one named vector.                                                       |
| `view_properties`    | `list[str] \| None`        | An optional list of property names that the agent is allowed to view when reasoning about and querying the collection. If omitted, the agent can view all properties.                            |
| `tenant`             | `str \| None`              | An optional tenant name for collections with multi-tenancy enabled.                                                                                                                              |
| `additional_filters` | `Filter \| None`           | An optional `Filter` object that is always combined with any agent-generated filters when querying this collection. [See the page on additional filters for more detail](additional-filters.md). |
:::

:::tab{title="JavaScript/TypeScript"}
```typescript
const qa = new QueryAgent(client, {
    collections: [
        // Provide an object to specify further collection configuration
        {
            name: 'ECommerce',
            targetVector: [
                'name_description_brand_vector'
            ],
            viewProperties: [
                'name',
                'description',
                'category',
                'brand',
            ],
        },
        {
            name: 'FinancialContracts'
        },
    ],
});
```

A collection configuration object accepts the following fields:

| Field               | Type                 | Description                                                                                                                                                                                      |
| ------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `name`              | `string`             | The name of the collection to query. Required.                                                                                                                                                   |
| `targetVector`      | `string \| string[]` | An optional list of target vector name(s) for collections with named vectors. Required when the collection has more than one named vector.                                                       |
| `viewProperties`    | `string[]`           | An optional list of property names that the agent is allowed to view when reasoning about and querying the collection. If omitted, the agent can view all properties.                            |
| `tenant`            | `string`             | An optional tenant name for collections with multi-tenancy enabled.                                                                                                                              |
| `additionalFilters` | `FilterValue`        | An optional `Filter` object that is always combined with any agent-generated filters when querying this collection. [See the page on additional filters for more detail](additional-filters.md). |
:::
::::

## Runtime configuration

The examples above show configuring collections at instantiation of the Query Agent. This defines the _default_ collections which will be used automatically when running Ask Mode or Search Mode.

You can instead or additionally provide collection information at runtime of the Query Agent, which will override any default collections set at instantiation.

:::code-group{sync="languages"}
```python title="Python"
response = qa.ask(
    "Recommend some shoes below $60.",
    collections=[
        QueryAgentCollectionConfig(
            name="ECommerce",
            target_vector=[
                "name_description_brand_vector"
            ],
        ),
    ],
)
```

```typescript title="JavaScript/TypeScript"
const response = await qa.ask(
    "Recommend some shoes below $60.", {
    collections: [
        {
            name: 'ECommerce',
            targetVector: [
                'name_description_brand_vector'
            ],
        }
    ],
});
```
:::

Similarly to above, this collection can also be either string(s) of the collection name(s), or a set of configurations.

This is possible in both Ask and Search Mode.

## Questions and feedback

Have a question or feedback? Here's how to reach us.

::::card-grid
:::card{title="Community Forum" href="https://forum.weaviate.io/c/support" icon="messages-square"}
Ask questions and connect with other developers on our **Community forum**.
:::

:::card{title="Support" href="/guides/support-overview" icon="life-buoy"}
Weaviate Cloud user or customer? Find the right channel on the **Support page**.
:::
::::

## Related pages

- [Agents](./agents-index.md)
- [AI-assisted Weaviate code generation](./ai-assisted-vibe-coding-index.md)
- [APIs](./apis-index.md)
- [Authorization and authentication](./authorization-and-authentication-index.md)
- [Benchmarks](./benchmarks-index.md)
- [Best practices](./best-practices-index.md)
- [Client libraries](./clients-index.md)
- [Client Libraries / SDKs](./client-libraries-index.md)
- [Cloud](./cloud-index.md)
- [Cloud account management](./cloud-account-management-index.md)

# Agent Instructions

This portal answers questions programmatically. To receive a synthesized,
source-cited answer instead of crawling page by page, append the `?ask=`
query parameter to any page URL on this site:

    /guides/quickstart?ask=how+do+I+authenticate

Optional parameters:

- `&goal=<what-you-are-trying-to-do>` steers the answer toward your
  objective (e.g. `&goal=write+a+python+client`).
- `&version=<label>` scopes the answer to a mounted version when the
  portal publishes more than one.

The response is `text/markdown`: the answer followed by a `# Sources` list
of the portal pages it was grounded in. Status codes are the contract:

- `200` — the answer; `402` — the portal owner’s plan or answer credits are
  exhausted (surface this to your operator; do NOT retry); `429` — you are
  rate-limited; back off for the `Retry-After` seconds; `503` — the answer
  lane is temporarily unavailable; fall back to crawling the `.md` pages.

For the full corpus map read `llms.txt` at the site root; for the tool
surface (search + page fetch as MCP tools) see `/mcp`.
