# Your project (/docs/project)



`npm create @nylorun/agent` writes an ordinary TypeScript application.
Agents live under `agents/`; `src/main.ts` connects them to the Runtime.

```text
my-agent/
  agents/
    assistant/agent.ts       # the Order assistant and its lookup_order tool
    index.ts                 # exports every agent and workflow
  src/main.ts                # connectAgents({ agents })
  package.json
  tsconfig.json
  .env.example
  .nylorun/
    .gitignore               # contains *
    link.json                # Runtime URL, Host id, Tenant id
    credentials.json         # application key; mode 0600
```

```ts title="src/main.ts"
import { connectAgents } from "@nylorun/agents";
import { agents } from "../agents/index.js";

await connectAgents({ agents }).ready;
```

This process is your **executor**. `connectAgents` registers the agents with
the Tenant, then waits for the Runtime to ask it to run a tool. Your tools
always run here, in your code, with your dependencies. It does not serve HTTP;
to put agents in front of people, add an
[app server](/docs/deploy/app-server).

## Scripts [#scripts]

| Script  | Command                                           | Role                                           |
| ------- | ------------------------------------------------- | ---------------------------------------------- |
| `dev`   | `tsx watch --env-file-if-exists=.env src/main.ts` | Watch and reconnect the application.           |
| `build` | copy assets and run `tsc`                         | Produce `dist/agents/` and `dist/src/main.js`. |
| `start` | `node dist/src/main.js`                           | Connect the compiled application.              |
| `check` | `tsc --noEmit`                                    | Typecheck without emitting files.              |

Production dependencies are `@nylorun/agents` and `zod`. Development
dependencies are `tsx`, `typescript`, and `@types/node`. The project does not
install the CLI, Studio, or Runtime; run them with `npx`.

## Where state lives [#where-state-lives]

| Location                                   | Contents                                                          | Commit? |
| ------------------------------------------ | ----------------------------------------------------------------- | ------- |
| Project `.nylorun/`                        | Tenant link and application key.                                  | No      |
| Host root (`NYLORUN_HOME` or `~/.nylorun`) | `host.json`, `host-credentials.json`, `stack/`, and Tenant files. | No      |
| Docker volumes                             | Postgres schemas, S2 streams, Restate state, and workspaces.      | No      |
| `.env`                                     | One-time model seed and application configuration.                | No      |

Sessions and history live in the Runtime's Docker volumes, not in your
project. Deleting `.nylorun/` unlinks the project without deleting its Tenant;
run `nylo tenant create` or `nylo tenant use` to link again.

Outside your machine, replace the link with three environment variables:
`NYLORUN_RUNTIME_URL`, `NYLORUN_SERVER_KEY`, and `NYLORUN_TENANT`. See
[App server](/docs/deploy/app-server).

## Next step [#next-step]

<Cards>
  <Card title="Build" description="Change the agent and add tools." href="/docs/build" />

  <Card title="Call it from code" description="Create a session and send input from your backend." href="/docs/run/sessions" />

  <Card title="Serve your users" description="Put agents behind your own sign-in." href="/docs/deploy/app-server" />
</Cards>
