> For the complete documentation index, see [llms.txt](https://archivedocs.stackstate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://archivedocs.stackstate.com/5.1/develop/developer-guides/agent_check/connect_agent_check_with_stackstate.md).

# Connect an Agent check to StackState

## Overview

The recommended way to connect your Agent check and visualize the data within StackState is to install the **Custom Synchronization** StackPack. Note that the Custom Synchronization StackPack only supports a single instance, to synchronize multiple instances you will need to create a multi-tenant StackPack.

## Install

Install the Custom Synchronization StackPack from the StackState UI **StackPacks** > **Integrations** screen. You will need to enter the following parameters:

* **Instance type (source identifier)** - `TopologyInstance`
* **Instance URL**

These are directly mapped to the `TopologyInstance` supplied in the `get_instance_key` function of your Agent check.

In the example Agent check below StackState, the Custom Synchronization StackPack **Instance type** would be `example` and the **Instance URL** would be `instance_url`.

```
    def get_instance_key(self, instance):
        if 'url' not in instance:
            raise ConfigurationError('Missing url in topology instance configuration.')

        instance_url = instance['url']
        return TopologyInstance("example", instance_url)
```

When the StackPack has been installed, the Custom Synchronization should become enabled and you should start to see the topology coming in for your Agent Check.

## See also

* [Agent check API](/5.1/develop/developer-guides/agent_check/agent-check-api.md)
* [How to develop Agent checks](/5.1/develop/developer-guides/agent_check/how_to_develop_agent_checks.md)
* [Developer guide - Custom Synchronization StackPack](/5.1/develop/developer-guides/custom_synchronization_stackpack.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://archivedocs.stackstate.com/5.1/develop/developer-guides/agent_check/connect_agent_check_with_stackstate.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.
