---
title: "Asks the agent to change a lambda"
method: POST
path: "/lambdas/{privateKey}/agent/start"
tags: ["Changes"]
---

# Asks the agent to change a lambda

`POST /lambdas/{privateKey}/agent/start`

## Request

- Base URL: `https://genhttp.dev/api/v1`
- URL: `https://genhttp.dev/api/v1/lambdas/{privateKey}/agent/start`
- Auth: none declared

The change is queued and runs in the background; `GET …/agent` follows it. The prompt is logged in full, so the
operator knows what people ask for, and cut past 2000 characters. A request that is not about changing the
application is declined, and the result says why.

## Path parameters

- `privateKey` string, required

## Request body

- ChangeRequest: What should be different about a lambda.
  - `Prompt` string, nullable: What to change, in the words of whoever wants it, in any language - at least three characters, cut past 2000
  - `Deploy` boolean: Whether to merge the change and put it online once it works (the default), rather than leave it in its feature for the owner to try first
  - `Model` string, nullable: Which of the offered models makes it: left out or `opus` for the default one, `fable` for the second, where one is offered
  - `Password` string, nullable: The password for the second model
  - `Language` string, nullable: The language of whoever asks, as a code like `de` or `pt-pt`, for the agent to answer in where the prompt does not tell
  - `Feature` string, nullable: The key of a feature to go on with; left out, the agent starts a new one

## Response `202`

The change was taken on.

- AgentState: Whether a change can be asked for, and the change under way or the last one.
  - `Available` boolean: Whether changes can be asked for: there is an agent, and the operator has not switched the box off
  - `PerDay` integer: How many builds and changes one address may ask for in a day
  - `Left` integer: How many of those this caller has left today
  - `SecondModel` boolean: Whether a second model is on offer, behind a password
  - `Job` ChangeProgress: A change the agent was asked for, and how it is getting on.
    - `Id` string: What the agent knows it by
    - `State` string: `queued`, `running`, `done`, `failed` or `cancelled`
    - `Prompt` string: What was asked for
    - `Deploy` boolean: Whether it was asked to merge the change and put it online
    - `Model` string: Which of the offered models is making it
    - `Before` integer, nullable: The version that was online when it was asked for
    - `Steps` AgentStep[]: What it has done so far
      - `At` integer: Seconds into the run
      - `Kind` string: What it did: `say`, `guide`, `demos`, `read`, `logs`, `create`, `write`, `check`, `deploy`, `upload`, `delete`, `list`, `feature` (started one), `update` (changed a feature's notes or base), `merge`, `discard` (deleted a feature), `data` (switched a kind of data on), `records` (read the database), `secrets` (listed the secrets) or `other`
      - `Text` string, nullable: What the agent said, for a step of kind `say`
      - `Tool` string, nullable: The tool, for a step of kind `other`
      - `Files` string[], nullable: The files written or read
      - `Removed` string[], nullable: The files a write removed
      - `Whole` boolean, nullable: Whether a write replaced every file rather than some
      - `Path` string, nullable: The workspace path of an upload or a removal
      - `Done` boolean, nullable: Whether the tool has answered
      - `Version` integer, nullable: The version read, saved, merged into, put online, or made a feature's base
      - `Online` boolean, nullable: Whether a write or a deployment went online - at the preview address, for a feature
      - `Errors` integer, nullable: How many errors the compiler found
      - `Problems` integer, nullable: How many errors the log holds
      - `Problem` string, nullable: Why the platform refused the step, in its words
      - `Feature` string, nullable: The name of the feature the step was about
      - `Preview` boolean, nullable: Whether the step was about a feature rather than the lambda itself
      - `Data` string, nullable: The kind of data a step of kind `data` switched on: `database`, `secrets` or `workspace`
    - `Result` ChangeResult: How a change ended, from what the tools answered rather than from what the model said about them.
      - `Ok` boolean: Whether it saved anything - into a feature, or as a version
      - `Version` integer, nullable: The newest version it saved, merging included
      - `Online` integer, nullable: The version it put online, if it put one there
      - `Deployed` boolean, nullable: Whether it put a version online
      - `Compiles` boolean, nullable: Whether the last code it compiled compiles, where it is known
      - `Before` integer, nullable: The version that was online when it started - to put back, if the change is not wanted
      - `Unchanged` boolean, nullable: Whether it saved nothing
      - `Cancelled` boolean, nullable: Whether somebody stopped it
      - `Reason` string, nullable: What cut it short: `timeout`, `turns` (it used up its steps) or `unauthorised`; `declined` where the agent would not make the change at all
      - `Summary` string, nullable: What the agent said at the end, for the owner - or, where it declined, why
      - `Error` string, nullable: What went wrong, in English
      - `Detail` string, nullable: What went wrong, in the words of whatever it went wrong in
      - `Feature` string, nullable: The key of the feature the change was left in, where it was not merged
      - `FeatureName` string, nullable: What that feature is called
      - `Preview` boolean, nullable: Whether that feature's preview is online, to be tried
      - `Declined` boolean, nullable: Whether the agent would not make the change; `summary` says why
    - `Waiting` integer: Its place in the queue; zero once it runs
    - `Seconds` integer: How long it has been running, in seconds
    - `Limit` integer, nullable: How long it may run, in seconds; absent when there is no clock on it
    - `Feature` string, nullable: The key of the feature it was asked to go on with; absent when it starts one of its own

## Other responses

- `400`: The prompt says too little, or there is no such model.
- `403`: The lambda is a demo, which anybody may read and nobody may change. Create a lambda of your own from it instead: `POST /lambdas` with the demo's id as `template`.
- `404`: No lambda has this editor key, it has no such feature to go on with, or this installation takes no changes from here.
- `409`: A change of this lambda is under way already. Wait for it, or stop it first.
- `429`: This address asked for as many builds and changes today as one may.
- `503`: The agent is not answering. Nothing was counted.

---

[API](https://skmtc.dev/genhttp/apis/genhttp-lambda-api.md) · [All operations](https://skmtc.dev/genhttp/apis/genhttp-lambda-api/llms.txt) · [OpenAPI document](https://skmtc.dev/genhttp/apis/genhttp-lambda-api/revisions/8b36699e03df?raw)
