Copy as Markdown[View as Markdown](/docs/sdk/functions/writeQueryToAgent.md)

***

# Function: writeQueryToAgent()

> **writeQueryToAgent**(`directory`): (`query`, `agent`, `options`) => `Promise`<`void`>

Defined in: queries.ts:180

Write a query to an agent in EventCatalog.

## Parameters[​](#parameters "Direct link to Parameters")

| Parameter   | Type     |
| ----------- | -------- |
| `directory` | `string` |

## Returns[​](#returns "Direct link to Returns")

`Function`

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter           | Type                                                                      |
| ------------------- | ------------------------------------------------------------------------- |
| `query`             | `Query`                                                                   |
| `agent`             | { `id`: `string`; `version`: `string`; }                                  |
| `agent.id`          | `string`                                                                  |
| `agent.version`?    | `string`                                                                  |
| `options`           | { `format`: `"md"` \| `"mdx"`; `override`: `boolean`; `path`: `string`; } |
| `options.format`?   | `"md"` \| `"mdx"`                                                         |
| `options.override`? | `boolean`                                                                 |
| `options.path`?     | `string`                                                                  |

### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`void`>
