> For the complete documentation index, see [llms.txt](https://jig.gitbook.io/sley/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jig.gitbook.io/sley/start/readme.md).

# Sley

Turn tangled workflow control flow into a small, explicit graph of ordinary Python or TypeScript functions.

<div align="center"><picture><source srcset="https://raw.githubusercontent.com/jigmd/sley/main/media/sley-wordmark-reverse.svg" media="(prefers-color-scheme: dark)"><img src="https://raw.githubusercontent.com/jigmd/sley/main/media/sley-wordmark.svg" alt="Sley" width="320"></picture></div>

## Complex workflows. Obvious code.

Sley turns tangled workflow logic into code your team can scan and change with confidence. A workflow rarely starts tangled. It gets there one condition, callback, counter, and fallback at a time, until the work still makes sense but its shape no longer does.

Sley puts that shape back in front of you. Write ordinary functions, connect the paths they may take, and run the graph. Branching, fan-out, joins, retries, and nested workflows stay visible, the final state comes back directly, and your application remains ordinary Python or TypeScript.

## Small by design

* A **node** is one ordinary synchronous or asynchronous function.
* A **link** makes one allowed next step visible.
* `emit()` chooses one or more paths.
* A **Flow** waits for those paths and `run()` returns their final shared state.

That small model is the point. Sley owns in-process graph execution. Your code keeps validation, storage, services, UI, and every domain decision.

Use Sley when branching and synchronization have made a workflow's shape hard to see. Keep ordinary calls, conditions, loops, `asyncio.gather`, or `Promise.all` while they still explain the workflow clearly.

## Learn to think in graphs

These docs do more than teach method names. You will begin with no graph-runtime vocabulary and finish able to:

* choose node boundaries that keep work readable;
* model decisions, loops, fan-out, and fan-in without hiding control;
* decide what belongs in shared state, branch input, and terminal output;
* place scope, concurrency, retry, and recovery boundaries deliberately;
* recognise graph designs that are doing too much;
* test and explain a workflow from its observable behavior.

The judgment transfers beyond Sley. The examples simply give you a small, runnable place to build it.

## Start with one file

```bash
pip install sley
```

```bash
npm install @jigging/sley
```

The [Quickstart](/sley/start/quickstart.md) takes one file from installation to a completed run with visible output. No service, account, API key, or application framework is required.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://jig.gitbook.io/sley/start/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
