# Quickstart

### Installation

The first step is to install the FastAgent dependency. To install the project, use pip.

```sh
pip install git+https://github.com/bastienpo/fastagent.git
```

{% hint style="info" %}
Currently the project is available only on github and will soon be available on pypi.
{% endhint %}

### Create a simple LangChain application

Let's create an `app.py` file with the simplest langchain runnable you can make, consisting of just a large language model.

{% code title="myapplication/app.py" %}

```python
# pip install -qU langchain-mistralai and requires MISTRAL_API_KEY in to be set
from langchain_mistralai import ChatMistralAI

chain = ChatMistralAI(model="ministral-3b-latest")
```

{% endcode %}

### Create a fastagent configuration

The first step is to create and initialize a fastagent using the cli tool or by hand. (You can also choose not to pass the argument, and you will be prompted instead.)

```
fastagent init --name my-first-application --template langchain
```

{% hint style="info" %}
Currently only langchain is supported, but on the roadmap is support for langgraph (currently experimental) and dspy.
{% endhint %}

You will need to update the **app field** in the **project section** to match the path of your application in the form:

`<module_path>:<module_attribute>` in you case it would be `myapplication.app:chain`

### Launching you server in development mode

Now that everything is set up, you can simply start the server using

```
fastagent dev
```

The development server is reloaded every time the code changes and provides some advanced logging. You should see:

```bash
╭───────────────────────────────────────────────────────╮
│ Running fastagent server in development mode 🚀       │
│                                                       │
│ The application is available at http://127.0.0.1:8000 │
╰───────────────────────────────────────────────────────╯
time=2024-11-17T09:51:29.401350-08:00 level=INFO msg='Starting application'
```

To see the available endpoint, go to *<http://127.0.0.1:8000/docs>* and you should see the documentation.

<figure><img src="/files/bhrfDYd5xXOX9rcjHqXv" alt=""><figcaption><p>Swagger</p></figcaption></figure>

### Launching you server in production mode

When you decide to move your project into production, it can be nice to disable some features, such as reloading the server. You can simply use the

```bash
fastagent run
```

This command is very similar to the development command under the hood, it uses exactly the same interface but disables some features of development mode.


---

# 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://fastagent.gitbook.io/fastagent/getting-started/quickstart.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.
