# How the Code Works

1. Within the ExampleAIRisk project → Pages folder when the project is first run, index.razor indexes the login url to navigate to the correct url where the project will be hosted.

2. Then the callback.razor page will query the code by requesting an access token, then once given the access token it navigates to the users.razor page that is the first initial page seen once project is run.

3. On the Users.razor page it lists out all the different users than you can login as, that once you select the user you want to login as it then logs you in as that user and navigates to the page where you choose the agent you want to chat with.

4. Once choosing the agent you want to chat with you are redirected to the Chat.razor page where a conversation is created with the agent and there exists a stream of asks The AIRiskModels Project under the models page exists the AIRiskAPIService.cs where here all the code that is responsible for the token, Getting Client, Login URL, Ask Stream, Get Users, List Agents, and Create Conversation exists.

5. Within the ExampleAIRisk project go to pages folder when the project is first run. Index.razor directs the login URL to the appropriate address where the project will be hosted.

6. Then the callback.razor page will query the code by requesting an access token. After receiving the access token, it redirects to the users.razor page, which is the first page displayed when the project is launched.

7. The Users.razor page displays a list of available users for login. After selecting a user, the system logs in as that user and redirects to the page where an agent can be selected for chat.

8. After selecting the agent for the chat, the system redirects to the Chat.razor page, where a conversation is initiated with the agent, and there exists a stream of asks.  The AIRiskModels Project under the model's page exists the AIRiskAPIService.cs.  Here all the code that is responsible for the token, Getting Client, Login URL, Ask Stream, Get Users, List Agents, and Create Conversation exists.


---

# 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.aicrisk.com/server-admin/api-access/how-to-launch-our-api-example/how-the-code-works.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.
