> For the complete documentation index, see [llms.txt](https://robodex.gitbook.io/robodex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://robodex.gitbook.io/robodex-docs/product-api/exports-evolutions.md).

# Exports And Evolutions

## Exports route

Export behavior lives in `apps/api/routes/exports.py`.

The route group handles:

* compiling a stored design,
* returning stored artifacts,
* exporting MJCF,
* exporting print-oriented files,
* returning procurement reports.

## Compile design

`POST /designs/{design_id}/compile`:

1. loads the stored design,
2. converts it to `RobotDesignIR` through `_design_to_ir()`,
3. calls `compile_to_mjcf(ir)`,
4. builds UI scene data,
5. saves artifacts back to `workspace_store`.

Current conversion can use defaults if detailed morphology data is missing. That makes it useful for smoke testing, but not a substitute for a complete mechanical design pipeline.

## Retrieve artifacts

`GET /designs/{design_id}/artifacts` returns saved artifact payloads such as:

* MJCF XML,
* UI scene data,
* export metadata.

## MuJoCo export

`POST /designs/{design_id}/export/mujoco` ensures the design has been compiled and returns an artifact path like:

```
artifacts/{design_id}/robot.mjcf
```

## Print export

`POST /designs/{design_id}/export/print` uses CAD helpers to write print-oriented files under:

```
data/exports/{design_id}
```

## Procurement

`GET /designs/{design_id}/procurement` resolves components and returns a procurement report. This connects generated robot concepts to component-slot planning.

## Evolutions route

Evolution behavior lives in `apps/api/routes/evolutions.py`.

The route can:

* create an evolution job,
* draft a `program.md`,
* approve the program,
* run a background evolution loop,
* stop an evolution,
* mark the best result,
* list iteration history.

## Evolution work directories

Evolution artifacts are written under `EVOLUTION_ARTIFACTS_DIR` when set, or a local default under `/tmp/il_ideation/evolutions`.

## Background loop

The evolution loop uses:

* `EvolutionConfig`,
* a CLI/Gemini orchestrator,
* optional legacy clip lookup,
* Modal dispatch for trials,
* iteration persistence.

It is separate from the immediate prompt-to-body agent loop path. Treat it as a longer-running product workflow.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://robodex.gitbook.io/robodex-docs/product-api/exports-evolutions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
