# JavaScript/TypeScript client

The TypeScript client supports code that is written in TypeScript or JavaScript. It allows you to easily interact with the Query Agent API from your JavaScript or TypeScript applications.

It relies on the [Weaviate Client package](../client-libraries/typescript.md), and handles authentication and connection to your Weaviate instance from there.

:::::callout{intent="note" title="JavaScript/TypeScript client (SDK)"}
The latest Query Agent TypeScript client is version `v1.5.0`.

::::card-grid
:::card{title="weaviate/agents-typescript-client" href="https://github.com/weaviate/agents-typescript-client" icon="github"}
:::

:::card{title="Reference manual (docstrings)" href="https://weaviate.github.io/agents-typescript-client/index.html" icon="book"}
:::
::::
:::::

## Installation

The Query Agent TypeScript client is distributed as the [`weaviate-agents`](https://www.npmjs.com/package/weaviate-agents) package on npm, and depends on the [`weaviate-client`](https://www.npmjs.com/package/weaviate-client) package, which it declares as a peer dependency. You should install both packages together:

```shell
npm install weaviate-client weaviate-agents
```

Or with `yarn` / `pnpm`:

```shell
yarn add weaviate-client weaviate-agents
```

```shell
pnpm add weaviate-client weaviate-agents
```

### Imports

Import the agent class directly from the `weaviate-agents` package, alongside your usual `weaviate-client` imports:

```typescript
import weaviate from "weaviate-client";
import { QueryAgent } from "weaviate-agents";
```

#### Troubleshooting: Force `npm` to install the latest version

For existing installations, `npm install` may not upgrade `weaviate-agents` to the [latest version](https://www.npmjs.com/package/weaviate-agents). If this occurs, explicitly upgrade the package:

```shell
npm install weaviate-agents@latest
```

## 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`.
