> For the complete documentation index, see [llms.txt](https://docs.orkestra.online/orkestra-online/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.orkestra.online/orkestra-online/okpy/get-started/first-tool-with-the-agent.md).

# Build your first tool with OkPy Agent

Describe a tool in your own words, watch OkPy Agent build it, try it safely in Test Mode, then save or publish it. No code needed.

OkPy Agent builds tools from a description. You say what you need, it builds the tool while you watch, and you try it on your open model. Nothing changes in your model until you decide to run the tool for real.

You need an Orkestra account and to be signed in. A free account gets a number of requests each day. See [What is free and what needs a license](https://docs.orkestra.online/orkestra-online/okpy/get-started/plans-and-licenses.md).

{% stepper %}
{% step %}

### Open OkPy Agent

Open your model, then click **OkPy Agent** on the Orkestra ribbon (in Revit, it is in the **OkPy** split button). See [Open OkPy](https://docs.orkestra.online/orkestra-online/okpy/get-started/open-okpy.md) for the other design apps.

OkPy Agent opens with "What should we build for Revit today?" (or your design app), and four examples you can click.

<figure><img src="https://705252832-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M6wDJF-clP9xeoy68-u%2Fuploads%2Fxs6hQxd4RWTeRK0Yd6XK%2Fscreenshots-okpy-agent-welcome.png?alt=media" alt="OkPy Agent in Revit, empty: the stage on the left says Your tool will appear here as I build it; the chat on the right asks What should we build for Revit today? with four ideas: Renumber rooms visually, 3D sun and shadow study, Doors dashboard + Excel, Batch rename sheets."><figcaption><p>OkPy Agent, ready for your request.</p></figcaption></figure>
{% endstep %}

{% step %}

### Describe the tool you need

Describe the **tool** you need, in your own words, and press **Enter**. Say what the tool should show, what you click in it, and what it gives you at the end. For example:

> I need a tool for renaming sheets in bulk. It lists all the sheets of the model in a table, lets me type a renaming pattern or a find and replace, shows a live before and after preview with the changes highlighted, and renames the sheets in one click.

Ask for a tool, not for the job itself: "I need a tool that renames sheets", not "rename my sheets". OkPy Agent builds tools; it doesn't change your model for you. The tool is what you keep, run again next month, and share with your team.

If something is unclear, the agent asks you a question with a few choices. Pick one, or choose **Other...** and type your own answer, then click **Send**.

More tips: [Write good requests](https://docs.orkestra.online/orkestra-online/okpy/okpy-agent/write-good-requests.md).
{% endstep %}

{% step %}

### Watch it build

Next to the chat, the stage draws a map of your tool as it takes shape: where the information comes from ("Your Revit model"), what does the work ("The brain"), what you will see ("The window"), and what you get at the end ("The results"). Then the tool's window itself appears, as a live preview.

Before it hands over, the agent tries the tool itself and undoes everything it changed. When it's done, the chat shows **Completed in** and the time it took.

<figure><img src="https://705252832-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M6wDJF-clP9xeoy68-u%2Fuploads%2FGDjG5IpIeFrRyPc1cNkd%2Fscreenshots-okpy-agent-building.png?alt=media" alt="OkPy Agent building the Bulk Sheet Renamer: the stage shows Writing the code and a map with Your Revit model, The brain, The window and Helper parts; the chat shows the request and the agent&#x27;s progress, with a task list at the bottom."><figcaption><p>The stage draws a map of the tool while the agent builds it.</p></figcaption></figure>

{% hint style="info" %}
You don't have to wait in front of it. If you switch to your model, OkPy shows a notification when it has a question ("OkPy has a question") and when the tool is ready ("Your tool is ready").
{% endhint %}
{% endstep %}

{% step %}

### Try it in Test Mode

Click **Test it**. The tool opens as your team will see it, framed in green, and you use it for real on your open model.

When you close the tool's window, Test Mode ends and **everything the tool changed is undone**. The agent reads how the test went and fixes the tool if something failed.

<figure><img src="https://705252832-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M6wDJF-clP9xeoy68-u%2Fuploads%2FjFCt5iyzlquGsu0LsNEr%2Fscreenshots-okpy-agent-test-mode.png?alt=media" alt="The Bulk Sheet Renamer window in Test Mode, inside a green frame with the strip TEST MODE - changes are undone when this window closes: Find Floor Plan, Replace with Plan - Level, a table of sheets with the removed text struck out in red and the new text highlighted, 12 to rename, and the button Rename 12 sheets."><figcaption><p>Test Mode: a green frame, and everything is undone when you close the window.</p></figcaption></figure>

What "undone" means depends on your design app: in Navisworks only what you see (hidden items, selection) is restored. See [Run, Test and Preview](https://docs.orkestra.online/orkestra-online/okpy/the-editor/run-test-and-preview.md#what-test-mode-undoes).
{% endstep %}

{% step %}

### Ask for changes

Not quite right? Say so in the chat: "make the table sortable", "add an Export to Excel button". You can also point at what to change on the preview: click a control and write a note, or draw on it. See [Build a tool with OkPy Agent](https://docs.orkestra.online/orkestra-online/okpy/okpy-agent/build-with-okpy-agent.md#point-at-what-to-change).

Test again after each change.
{% endstep %}

{% step %}

### Save or publish it

The agent never saves for you. When you are happy:

* **Save** keeps the tool on your computer, in `Documents\OkPy Tools` the first time. Open it again from OkPy (**Recent Files** on the home screen), or add that folder as a [local workspace](https://docs.orkestra.online/orkestra-online/desktop-app/find-and-use-tools/local-workspaces.md) to run it from the Orkestra pane.
* **Publish** shares it to an Orkestra workspace so your team can run it. This needs an Orkestra license. See [Publish to Orkestra](https://docs.orkestra.online/orkestra-online/okpy/save-and-share/publish-to-orkestra.md).

**Run it** runs the tool for real on your model, without undo by OkPy. Use it when you actually want the result.
{% endstep %}
{% endstepper %}

## Good to know

* Tools made with OkPy Agent are written in C#. You never have to look at the code, but you can: click **Open full editor**. Your conversation continues there, and **Simple view** brings you back.
* OkPy keeps an automatic snapshot of your tool before each run, so you can go back. See [Tool Backups](https://docs.orkestra.online/orkestra-online/okpy/save-and-share/tool-backups.md).
* If you close OkPy before saving, it asks "Save this tool before closing?".

## Related pages

* [Build a tool with OkPy Agent](https://docs.orkestra.online/orkestra-online/okpy/okpy-agent/build-with-okpy-agent.md)
* [Tutorial: a door dashboard](https://docs.orkestra.online/orkestra-online/okpy/okpy-agent/tutorial-door-dashboard.md)
* [Publish to Orkestra](https://docs.orkestra.online/orkestra-online/okpy/save-and-share/publish-to-orkestra.md)
