# Initialization and Setup

In your main application file, import and set up the `Skynet-SmartAccessPoint` with your project’s core services.

Here is an example initialization:&#x20;

```typescript
import dotenv from 'dotenv';
dotenv.config();

import express from 'express';
import { initAIAccessPoint } from '@decloudlabs/Skynet-SmartAccessPoint /lib/init';
import { checkBalance } from '@decloudlabs/Skynet-SmartAccessPoint /lib/middleware/checkBalance';
import { protect } from '@decloudlabs/Skynet-SmartAccessPoint /lib/middleware/auth';
import SkyMainNodeJS from '@decloudlabs/skynet/lib/services/SkyMainNodeJS';
import { getSkyNode } from './clients/skynet';

const app = express();
const port = process.env.PORT || 3000;

const setupAccessPoint = async () => {
    const skyNode: SkyMainNodeJS = await getSkyNode();

    await initAIAccessPoint(
        skyNode,
        checkBalanceCondition,
        applyCosts,
        app,
        runNaturalFunction
    );

    app.listen(port, () => {
        console.log(`Server running on port ${port}`);
    });
};

setupAccessPoint();
```

The `initAIAccessPoint` function sets up the necessary routes and middleware, allowing you to securely manage AI access while enforcing balance checks and service control.


---

# 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://documentation.skynet.io/skynet/build-your-project-on-skynet/integrate-ai-agent-tools/initialization-and-setup.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.
