Skip to content
For agents
Browse guides

Build a team app with an agent

Download a working equipment request form, connect PostgreSQL, deploy it and give your team access.

Open Markdown

Give your team a private page where someone can request a monitor, keyboard or desk lamp. The Equipment requests example includes a Next.js form, a server route and a PostgreSQL table. A signed-in person gets a receipt and can see the last 20 requests they made. The code and its lockfile are in the example source ZIP.

Try a change

Unzip the download in a new directory. Look at app/request-form.jsx for the item picker, app/api/requests/route.js for input validation and app/database.js for the schema and queries. These are ordinary source files you can review and bring into your own repository.

For a small first task, ask your agent to change the receipt text and leave the list of allowed items alone. A larger change, such as adding a fourth item, also needs a database migration for the table’s check constraint. Tell the agent how you will check the result before it writes code.

Run the project locally with Node 24 and npm. From the extracted equipment-requests directory, run the following commands.

Shell
npm ci
npm run build
PORT=3000 HOSTNAME=127.0.0.1 npm start

Open http://127.0.0.1:3000. The local page shows the layout. The request form needs a verified workspace identity. To test source changes in an isolated Linux machine, open a sandbox workbench with a suitable template and an approved package-registry policy. Bring the tested files back to your source folder.

Give the agent a workspace identity

An owner or admin approves the agent’s device sign-in. Use a separate CLI profile and run the commands below in that agent’s shell. A person can follow the same steps from their own signed-in CLI. Hosted steps need a provisioned workspace and an app machine with space for the app and its database. Connect a coding agent.

Shell
smolcloud project "Office tools"

Copy the project’s returned id into PROJECT_ID. Create the app and database, then copy their returned IDs into APP_ID and DATABASE_ID. For a project that already has these resources, use the existing IDs.

Shell
PROJECT_ID=PASTE_PROJECT_ID
smolcloud app "$PROJECT_ID" "Equipment requests"
smolcloud database "$PROJECT_ID" "Equipment history"
Shell
APP_ID=PASTE_APP_ID
DATABASE_ID=PASTE_DATABASE_ID
smolcloud database connect "$APP_ID" "$DATABASE_ID"
smolcloud capabilities "$APP_ID"

The agent can connect a database it created to an app it administers. The app’s backend receives DATABASE_URL at runtime. The gateway supplies the caller’s identity. The example uses that identity when selecting rows. App permissions · Database connections.

Deploy the reviewed folder

In the app’s configuration, set the HTTP port to 3000 and the health path to /api/health for the included Dockerfile. From the extracted source directory, deploy the current folder.

Shell
smolcloud deploy "$APP_ID" . --result v1

Read status and save operation_id as DEPLOYMENT_ID. On succeeded, use the serving app address. On approval_required, show the owner the requested action in Deployments. On running, inspect or resume the same deployment. The last healthy version serves while an update builds. Deploy a private app.

Shell
DEPLOYMENT_ID=PASTE_OPERATION_ID
smolcloud inspect "$DEPLOYMENT_ID" --result v1
smolcloud request "$APP_ID" /api/health

Check a real request

Open the app from a signed-in workspace account with Can use. Choose Keyboard, submit it, then refresh. With PostgreSQL connected, you should see a Saved receipt and the request in your history. Demo receipt means this deployment has no database connection. Check Connections, then confirm that the running revision received its database settings.

The example below shows the saved receipt and the same person’s request history. Open the image for a larger view.

Equipment requests after saving a desk lamp, with a keyboard and desk lamp in the user’s history.

To exercise the same form handler from a connected agent with Can use, save this JSON as request.json.

JSON
{ "item": "Keyboard" }
Shell
smolcloud request "$APP_ID" /api/requests --method POST --body ./request.json

A successful response includes a receipt and the caller’s user ID. A new POST creates a new request. If the response is interrupted, check that identity’s history before submitting again.

Share it and look after it

Open Share, give the people or group who need the tool Can use, and send the app’s HTTPS address. Ask a colleague to open it under their own sign-in. They can submit a request and see their own history. The private app keeps running independently of the agent’s shell or sandbox.

Use smolcloud logs "$DEPLOYMENT_ID" build for build failures and smolcloud logs "$DEPLOYMENT_ID" runtime for errors in the running app. For a bad revision, choose Roll back code in Deployments. The current database and its rows stay in place, so check that the earlier code understands the current schema. Roll back an app.

If the tool later needs attachments, connect a bucket and deploy the app to receive its storage settings. If it needs to summarize requests, approve a model and budget for its backend. Each capability has a separate grant. Bucket storage · Call a model · Workspace security.