> ## Documentation Index
> Fetch the complete documentation index at: https://docs.innate.bot/llms.txt
> Use this file to discover all available pages before exploring further.

# Definition

Every InputDevice has to implement a `name`, an `on_open` and `on_close` methods. The on\_open is called when an agent is started with this device, and when stopped, `on_close` is called.

## Template

This template, once activated, sends data every 1 second to the agent as if the user was talking.

```python theme={null}
import threading

from brain_client.input_types import InputDevice

class MyInput(InputDevice):
    def __init__(self):
        super().__init__()
        self._stop_evt = threading.Event()

    @property
    def name(self) -> str:
        return "my_input"  # used by agents

    def on_open(self):
        self._stop_evt.clear()
        
        def timer_loop():
            while not self._stop_evt.is_set():
                self.send_data({"text": "tick!"}, data_type="chat_in")
                self._stop_evt.wait(timeout=1.0)
        
        threading.Thread(target=timer_loop, daemon=True).start()

    def on_close(self):
        self._stop_evt.set()
```

## Data types

The Innate agent performs better with properly formatted inputs, so we provide the data\_type parameter to send data on the right channels.

Currently, `data_type` can either be `chat_in` or `custom`. In both cases, `send_data` expects a dictionary:

* `chat_in` — text input as if the user was talking, e.g. `{"text": "Hello robot"}`. You can include extra keys such as `confidence` or `source`.
* `custom` — any other structured data, e.g. `{"air_quality": 42, "unit": "AQI"}`.
