> For the complete documentation index, see [llms.txt](https://docs.dispach.moeenmahmud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dispach.moeenmahmud.com/reference/http/dispach-agent-server/create-an-agent-from-answers-or-from-a-template-and-adopt-it-into-this-host-live.md).

# Create an agent, from answers or from a template, and adopt it into this host, live.

```json
{"openapi":"3.1.0","info":{"title":"Dispach agent server","version":"0.1.3"},"servers":[{"url":"http://localhost:7420","description":"Local server. Replace this with the URL of your deployment."}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"An operator key or the configured token."}}},"paths":{"/v1/agents":{"post":{"summary":"Create an agent, from answers or from a template, and adopt it into this host, live.","responses":{"201":{"description":"created; `adopted` is empty with an `error` if it is not running"},"401":{"description":"No credential, or one this server does not accept."},"403":{"description":"neither a loopback bind nor an authenticated admin credential"},"501":{"description":"this server has no provisioner"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"answers":{"code":"provision_answers_required","hint":"Send { \"answers\": { \"name\": \"milo\", … } }. Every step you leave out takes its default, exactly as `init --yes` does with flags; GET /v1/provision lists them.","description":"A subset of the wizard's steps, as strings. `GET /v1/provision` lists every step with its prompt, default and choices. Send this or `template`, not both.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","code":"provision_answer_invalid","hint":"Answers arrive as strings from the terminal and from here, and are validated per step. Send the value as a string — including a boolean-looking choice, whose values are named in GET /v1/provision.","description":"One answer. Always text, whatever the step's type looks like."}},"template":{"code":"provision_template_invalid","hint":"Send the template's name as a string. GET /v1/templates lists what this server has.","description":"Create the agent from a template in this server's sandbox instead of from answers. Needs `name`; takes `vars`.","type":"string","minLength":1},"name":{"code":"provision_name_required","hint":"Send { \"template\": \"…\", \"name\": \"Acme store\" }. The id every route keys on is derived from it.","description":"The new agent's name, with `template`. Its slug becomes the id; the template sees both as {{agent.name}} and {{agent.id}}.","type":"string"},"vars":{"code":"template_value_invalid","hint":"Send { \"vars\": { \"store\": \"Acme\" } }, every value a string. GET /v1/templates lists each template's variables.","description":"Values for the template's declared variables. A secret variable's value goes to the agent's .env and is never returned.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string","code":"template_value_invalid","hint":"Template values are one line of text, sent as strings.","description":"One variable's value."}}}}}}}}}}}
```
