# Install a Library or Service

Arguably TinyChain's most powerful feature is the ability to install a `Library` or `Service` at runtime without restarting. For example, TinyChain's linear algebra and machine learning services are distributed as part of the Python client (`math.linalg.LinearAlgebra`, `ml.NeuralNets`, and `ml.Optimizers`). Installing them is as easy as:

```python
import tinychain as tc

# the lead replica (can be a load balancer)
LEAD = tc.URI("http://your.tinychain.cluster")

host = tc.Host(LEAD)
host.install(tc.math.linalg.LinearAlgebra())

```

## Install your Service

Of course the built-in `Service`s aren't much use without being able to install your own!&#x20;

```python
# ...

class MyService(tc.service.Service):
    NS = "my_namespace"
    NAME = "my_service"
    VERSION = tc.Version("0.0.0")

    __uri__ = tc.service.service_uri(LEAD, NS, NAME, VERSION)

    @tc.get
    def hello(self, name: tc.String) -> tc.String:
        return tc.String("Hello, {{name}}!").render(name=name)


assert tc.URI(MyService).path() == "/service/my_namespace/my_service/0.0.0"

host.install(MyService())

assert host.get(tc.URI(MyService()).path() + "/hello", "World") == "Hello, World!"
```


---

# 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.tinychain.net/guides/install-a-library-or-service.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.
