> ## Documentation Index
> Fetch the complete documentation index at: https://milford.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Run your first flow through the HTTP server in a few minutes.

This page runs a flow that needs no API key, then adds a model. It uses the published npm packages. To run from a clone instead, see [installation](/installation).

## Prerequisites

* Node.js 22 or later, with npm or pnpm.

## Run a flow

<Steps>
  <Step title="Create the config file">
    In an empty directory, create `milford.config.yaml`. It lists the flows to load and the token that callers must send.

    ```yaml milford.config.yaml theme={null}
    flows:
      - { file: ./flows/hello.json }
    server:
      port: 8080
      auth: { tokens: ["${MILFORD_TOKEN}"] }
    ```
  </Step>

  <Step title="Create a flow">
    A flow is a graph of nodes. This one takes a name and returns a greeting.

    ```json flows/hello.json theme={null}
    {
      "id": "hello",
      "nodes": [
        { "id": "in", "type": "input" },
        { "id": "greet", "type": "prompt", "config": { "template": "Hello {{input.name}}!" } },
        { "id": "out", "type": "output" }
      ],
      "edges": [{ "from": "in", "to": "greet" }, { "from": "greet", "to": "out" }]
    }
    ```
  </Step>

  <Step title="Start the server">
    <CodeGroup>
      ```bash npm theme={null}
      MILFORD_TOKEN=change-me npx @milfordai/server milford.config.yaml
      ```

      ```bash pnpm theme={null}
      MILFORD_TOKEN=change-me pnpm dlx @milfordai/server milford.config.yaml
      ```
    </CodeGroup>

    The server loads and checks every flow before it listens, and prints the number of flows it loaded.
  </Step>

  <Step title="Run the flow">
    ```bash theme={null}
    curl -s localhost:8080/v1/flows/hello/run \
      -H "authorization: Bearer change-me" \
      -d '{"input": {"name": "Ann"}}'
    ```

    The response holds the result of every node and the flow `output`, here `"Hello Ann!"`.
  </Step>
</Steps>

## Add a model

A `decision` node asks a provider a typed question and returns a value your graph can branch on. Add a provider to `milford.config.yaml`:

```yaml theme={null}
providers:
  - { id: main-llm, type: anthropic, apiKey: "${ANTHROPIC_API_KEY}", model: claude-sonnet-5 }
```

Then add a decision node to a flow. A low-confidence answer becomes `none_of_these`:

```json theme={null}
{ "id": "team", "type": "decision", "config": {
    "provider": "main-llm", "kind": "choice",
    "prompt": "Which team should handle this message?",
    "options": ["billing", "technical", "sales"],
    "state": "{{input.text}}", "minConfidence": 0.6 } }
```

Edges with a `when` condition route on the answer. See [decisions](/concepts/decisions) and [flows](/concepts/flows). Switching the provider to an OpenAI-compatible server or a local classifier is a config change.

## Use the library instead

<CodeGroup>
  ```bash npm theme={null}
  npm install @milfordai/core @milfordai/providers
  ```

  ```bash pnpm theme={null}
  pnpm add @milfordai/core @milfordai/providers
  ```
</CodeGroup>

```ts theme={null}
import { createEngine, defaultRegistry, flow } from "@milfordai/core";
import { registerProviders } from "@milfordai/providers";

const engine = createEngine({
  registry: registerProviders(defaultRegistry()),
  providers: [{ id: "main", type: "anthropic", apiKey: process.env.ANTHROPIC_API_KEY!, model: "claude-sonnet-5" }],
  flows: [
    flow("summarize")
      .node("sum", "llm", { provider: "main", preset: "summarize", prompt: "{{input.text}}" })
      .node("out", "output")
      .edge("sum", "out")
      .build(),
  ],
});
if (!engine.ok) throw new Error(engine.error);

const result = await engine.value.run("summarize", { text: "..." });
```

`createEngine` and `run` return results instead of throwing. Check `ok` before you read `value`.

## Next steps

<Columns cols={2}>
  <Card title="Flows" icon="workflow" href="/concepts/flows">How the executor walks a graph.</Card>
  <Card title="Providers" icon="plug" href="/providers/overview">OpenAI-compatible, Anthropic, Jev and your own classifier.</Card>
  <Card title="MCP" icon="blocks" href="/guides/mcp">Expose flows as tools to LLM clients.</Card>
  <Card title="Deployment" icon="container" href="/reference/deployment">Docker, limits and offline use.</Card>
</Columns>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.