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

***

# Function: writeCommandToAgent()

> **writeCommandToAgent**(`directory`): (`command`, `agent`, `options`) => `Promise`<`void`>

Defined in: commands.ts:181

Write a command 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                                                                      |
| ------------------- | ------------------------------------------------------------------------- |
| `command`           | `Command`                                                                 |
| `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`>
