# Publishing an agent

The simplest way to allow your end-users to interact with your model to get decisions is by publishing a Rainbird agent.

This enables you to configure what queries can be made by the user. You can also customise other elements of the agent to tailor the user experience. These are published on the web and can be accessed via a shareable link or embedded into your website.

## Setting up an agent

Publishing an agent requires two steps:

<details>

<summary>1 - Setup the queries you want to run</summary>

Before publishing an agent, you need to ensure the queries you want to test are configured. (If you have already setup queries in this way, you can skip this step.)

With the knowledge map open that you want to test, go to **Test** > **TryQuery > + New Query**

<img src="/files/342lT3tZ8j9PnzxwzIDd" alt="" data-size="original">

1. In the Query drop-down select the relationship you want to query.
2. Provide a helpful description (this will display on the agent start screen).
3. Configure the subject and object of the query.
   1. This will default so the user is asked to provide the subject and for Rainbird to infer the object, returning this as the result. See [Making a query](/rainbird/knowledge-modelling/what-is-a-query.md#making-a-query) for more information on different approaches.
4. Configure the answer text.
   1. By default it will display only the object as the answer, showing is as `(variable)`. Typing `(` will allow you to also add the subject as a variable. You can also include static text around these variables for a more user friendly answer if required.
5. Click to add this query
6. Repeat these steps for any other queries you want to make available for testing, or continue to the next step.

</details>

<details>

<summary>2 - Create and publish an agent</summary>

With the knowledge map open that you want to test, go to **Publish** > **Agents > + New Agent**

![](/files/1MufgTI5v1MaR9Kwm1rJ)

1. Add an optional title and subtitle
2. Select the query or queries you want to be available to select in the agent
3. Configure the features available:
   1. Back button: allows a user to return to a previously asked question
   2. Group questions: displays a set of related questions together.  ([Question grouping](/rainbird/knowledge-modelling/modelling-features/relationships/question-configuration.md#question-grouping) must have been configured in the knowledge map for this apply.)
   3. Display Evidence Tree: displays a link to the Evidence Tree for each result returned.
   4. Display certainty of results: displays the % certainty of each result.
   5. Display print results button: allows the user to print the results page to paper or PDF.
   6. Context Identifier: requests the ID of a user at the start, for when context has been configured.
4. Optionally configure the agents colour scheme using hexidecimal codes.
5. Click Publish
6. Use the agent preview to confirm it's configured correctly.

</details>

## Accessing the agent

From the Publish > Agent page, press the Run button for the agent you want to access.

<figure><img src="/files/MvR9HMBqiYYq8HQ2D7qi" alt=""><figcaption></figcaption></figure>

## **Sharing the agent**

From the Publish > Agent page, press the Run button for the agent you want to share. Once open, copy the URL for sharing.

## Embed an agent

To embed an agent as an iFrame into a website, open the agent configuration page and copy the iFrame code snippet beneath the agent preview and provide to your web-developer.

<figure><img src="/files/7pRi2Dw23ePcPEBRVCts" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rainbird.ai/rainbird/knowledge-modelling/publishing-your-km/publishing-an-agent.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
