> ## Documentation Index
> Fetch the complete documentation index at: https://trytilde.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Host agents on Tilde

> Let Tilde Cloud run your agent's code, with nothing to deploy yourself, paid from your organization's credits.

A hosted agent is one whose code Tilde Cloud runs for you. `tilde deploy` bundles the agent's code and uploads it, and Tilde runs it on serverless compute in its own cloud account. You set up no AWS account, function, role or network path. Hosting is available to every Tilde Cloud organization.

A hosted agent works like a [Lambda agent](https://trytilde.ai/docs/deployment/lambda-agents.md), except that Tilde owns the function. Each run starts when the agent is invoked and stops when the run ends, so nothing runs between runs.

## Write the entry module

Export the SDK's Lambda handler from your agent's entry module, as for a Lambda agent. `tilde deploy` refuses a hosted agent whose module does not export `handler`:

```ts src/index.ts theme={"system"}
import { createLambdaHandler } from "@trytilde/sdk";
import { run } from "./agent.js";

export const handler = createLambdaHandler({ run });
```

Hosted agents run Node.js 22. `tilde deploy` bundles the code with everything it imports, including prompts imported as text (`with { type: "text" }`) and shared files from the project root.

## Declare it hosted

With [Agents as code](https://trytilde.ai/docs/deployment/iac/overview.md), set the agent's deploy target to `hosted`:

```ts agents/triage/tilde.config.ts theme={"system"}
import { defineAgent } from "@trytilde/iac";

export const triage = defineAgent({
  key: "triage",
  name: "Triage",
  deploy: { target: "hosted" },
});
```

Without a spec, pass the target to the CLI: `tilde deploy --target hosted`.

## Deploy

Run `tilde deploy` from the agent's folder, or from the project root to deploy every agent:

```bash theme={"system"}
tilde deploy
```

`tilde deploy` bundles the code with esbuild, registers a deployment, and uploads the bundle. Tilde publishes it as a new version of the agent's function, and the deployment takes traffic as soon as it is published. A deploy whose code and declarations did not change registers nothing new.

Each deployment keeps its own version. To roll back, promote an earlier deployment on the agent's **Deployment** tab.

## Watch it run

The agent's **Deployment** tab shows its hosted function: its state, the version each deployment serves, this period's usage and cost, and the function's recent logs.

## What it costs

Hosted agents are charged to your organization's credits by the compute they use: run time at the function's memory, and the number of runs. Your monthly credit grant is spent first, then purchased credits. **Settings > Billing** lists compute charges for the current period.

> [!WARNING]
>
> When your credits run out, hosted agents stop starting new runs until you buy more.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.