# PAI Retro

Pending AI's Retrosynthesis Engine capability, engineered for high-throughput synthetic feasibility analysis, combines well-curated and diverse datasets to rapidly identify complex multi-step synthetic routes for broad regions of chemical space.

See the **capability** page for more information:

{% content-ref url="/pages/1h5TxpTFc56h802JWFzt" %}
[Retrosynthesis](/capabilities/retrosynthesis.md)
{% endcontent-ref %}

***

## Workflow Summary

Pending AI's Retrosynthesis engine runs behind a queue-based environment for each specific engine. An [**engine**](/api-reference/pai-retro/retrosynthesis-engines.md) and set of [**building block libraries**](/api-reference/pai-retro/building-block-libraries.md), containing molecules used to terminate a synthetic route, must be provided when submitting a query.&#x20;

On submission, a [**job**](/api-reference/pai-retro/synthesis-jobs.md) `id` is provided and then used to poll for results until it is completed, at which point results should be retrieved and saved per query. A similar workflow is made available through [**batch-based**](/api-reference/pai-retro/batch-screening.md) submission to provide a faster screening interface on larger collections of query molecules.

{% @mermaid/diagram content="stateDiagram-v2
a: Inspect Retrosynthesis Engines
b: Inspect Building Block Libraries
c: Submit a Retrosynthesis Query Molecule
d: Retrieve a Status for the Query
e: Retrieve Synthesis Routes for the Query
note right of c: Select engines and libraries as configuration parameters.
note right of d: Repeat until status changes to **completed**.
\[*] --> a
\[*] --> b
\[*] --> c
c --> d
d --> e
e --> \[*]: Further Processing
" %}

See the available [Guides](/developer-tools/guides.md) for more implementation possibilities when integrating with existing drug discovery pipelines.

***

## Frequently Asked Questions

<details>

<summary>Q: Why do some molecules take significantly longer than others for retrosynthesis?</summary>

A: The total time until the results of a retrosynthesis job are ready to be retrieved is dependent on the queue wait time and synthesis processing.&#x20;

* Queues are affected by other jobs shared by an engine when too many requests are made in a given time.
* Processing time can be affected by optional parameters such as the number of routes requested or processing timeout.&#x20;

Some molecules may also fail to find any synthetic routes which means the engine will run longer trying to exhaust all reasonable expandable reaction templates.

</details>

<details>

<summary>Q: Why do results contains fewer synthetic routes than requested?</summary>

A: Configuration specifies a *maximum number of routes* to be found during retrosynthesis, results are limited due to a number of facts such as other optional parameters that enforce diversity, the complexity of a structure, the allowed time limit for a job, and the existence of chemically viable synthetic routes.

</details>

<details>

<summary>Q: What happens if one job fails within a batch?</summary>

A: When an individual query molecule fails (due to an invalid SMILES structure or unexpected processing error), the batch will continue processing until all other jobs are completed. A batch summary can be retrieve storing a success flag per job to help screen any unhandled query molecules from within the batch.

</details>

<details>

<summary>Q: What is the maximum size for a batch submission?</summary>

A: Currently Pending AI offers a batch limit of 100,000 which should be created with multiple `POST /batches` and `PUT /batches` requests due to the size of retrosynthesis result data. Use multiple batches if a screening campaign contains more query molecules.

</details>


---

# Agent Instructions: 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:

```
GET https://docs.pending.ai/api-reference/pai-retro.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
