LINKORA
OverviewQuickstart

Render

Using Linkora with Render Workflows

Linkora handles model access and routing. Render Workflows handles the execution around those calls: queuing, retries, and parallel task runs.

This guide deploys a small prompt batch. One task receives a list of prompts and fans out one retriable task run per prompt. Each run calls Linkora's Auto Router and returns both the answer and the concrete model Linkora selected.

flowchart TD
  prompts[Prompts] --> fanout[Render Workflow<br/>fan-out]
  fanout --> run1[Task run 1]
  fanout --> run2[Task run 2]
  fanout --> runN[Task run N]
  run1 --> auto[Linkora<br/>Auto Router]
  run2 --> auto
  runN --> auto
  auto --> answers[Answers<br/>+ model IDs]

Each prompt becomes its own task run. Render provisions compute for those runs on demand and deprovisions it when they finish, so the fan-out does not require a pre-provisioned worker pool.

Render Workflow tasks do not expose HTTP ports. In a user-facing application, a Render Web Service receives the request and triggers the workflow. This guide starts with the workflow itself so you can deploy and verify the model pipeline first.

Prerequisites

You will need:

1. Create a workflow project

Use render workflows init to scaffold Render's Hello World starter, then add the official Linkora Client SDK.

@linkora/sdk is ESM-only. Use "type": "module" in package.json (or another ESM-compatible setup). CommonJS require() is not supported.
render workflows init \
  --confirm \
  --language node \
  --template hello-world \
  --dir linkora-workflow

cd linkora-workflow
npm install @linkora/sdk@^1.1.22

The scaffold includes the Render SDK, creates a .env.example file and Git repository, and prints commands for local development and deployment.

2. Add your Linkora key

Copy the scaffolded environment file:

cp .env.example .env

Replace its contents with:

LINKORA_API_KEY=sk-or-v1-...
LINKORA_MODEL=linkora/auto
LINKORA_APP_TITLE="Render Workflows Example"

The scaffold excludes .env from Git. Do not commit API keys. The Render CLI loads .env automatically during local Workflow development.

If a public application will trigger this workflow, also set APP_URL to that application's URL. Linkora uses APP_URL and LINKORA_APP_TITLE for app attribution.

Use linkora/auto for Linkora's Auto Router. The linkora/auto-beta slug is the early-access track where new routing behavior lands first; see Auto Router.

3. Define the workflow

Replace the generated task file with the following code.

The inner task makes one Linkora request and retries failures. The outer task fans out across every prompt. Render runs each chained task separately, so a slow or retried model call does not prevent the other calls from running.

import { Linkora } from '@linkora/sdk';
import { task } from '@renderinc/sdk/workflows';

const apiKey = process.env.LINKORA_API_KEY;

if (!apiKey) {
  throw new Error('LINKORA_API_KEY is required');
}

const linkora = new Linkora({
  apiKey,
  httpReferer: process.env.APP_URL,
  appTitle: process.env.LINKORA_APP_TITLE ?? 'Render Workflows Example',
});

function contentToText(content: unknown): string {
  if (typeof content === 'string') {
    return content;
  }

  if (!Array.isArray(content)) {
    return '';
  }

  return content
    .flatMap((item) => {
      if (typeof item !== 'object' || item === null) {
        return [];
      }
      if ('text' in item && typeof item.text === 'string') {
        return [item.text];
      }
      if ('refusal' in item && typeof item.refusal === 'string') {
        return [item.refusal];
      }

      return [];
    })
    .join('\n');
}

const callLinkora = task(
  {
    name: 'callLinkora',
    retry: {
      maxRetries: 3,
      waitDurationMs: 1000,
      backoffScaling: 2,
    },
  },
  async function callLinkora(prompt: string) {
    const response = await linkora.responses.send({
      responsesRequest: {
        model: process.env.LINKORA_MODEL ?? 'linkora/auto',
        input: prompt,
        stream: false,
      },
    });

    if (!('output' in response)) {
      throw new Error('Expected a non-streaming response');
    }

    // Do not return failed or truncated output as a successful workflow result.
    if (response.status !== 'completed') {
      throw new Error(
        response.error?.message ??
          `Linkora response ended as ${response.status}`,
      );
    }

    const message = [...response.output].reverse().find((item) => item.type === 'message');

    return {
      prompt,
      model: response.model,
      answer: message?.type === 'message' ? contentToText(message.content) : '',
    };
  },
);

const runPromptBatch = task(
  { name: 'runPromptBatch' },
  async function runPromptBatch(prompts: string[]) {
    return Promise.all(prompts.map((prompt) => callLinkora(prompt)));
  },
);

Auto Router can choose a different model for each independent prompt. Keeping response.model in every result makes that routing decision visible.

A retried task can repeat a billable API call if the first request succeeded but the task failed before returning its result. For production workflows with external side effects, add application-level idempotency or checkpointing.

4. Test the workflow locally

Start Render's local Workflow server:

render workflows dev -- npm start

In another terminal, start the batch task:

render workflows start runPromptBatch \
  --local \
  --input='[["Explain retries in one sentence.", "Write a haiku about databases."]]'

The outer JSON array contains the task's arguments. The inner array is the prompts argument.

The command returns a task-run ID. Inspect the completed run with:

render workflows tasks runs show --local TASK_RUN_ID

A successful result contains one entry per prompt:

[
  {
    "prompt": "Explain retries in one sentence.",
    "model": "<model selected by Linkora>",
    "answer": "<generated response>"
  },
  {
    "prompt": "Write a haiku about databases.",
    "model": "<model selected by Linkora>",
    "answer": "<generated response>"
  }
]

5. Deploy the workflow to Render

Commit the project and push it to GitHub, GitLab, or Bitbucket. From the project directory, create the Workflow service with the Render CLI.

--repo . reads the remote URL from the Git repository. --env-file .env adds the Linkora configuration to the Render service without committing the file.

render workflows create \
  --name linkora-workflow \
  --repo . \
  --runtime node \
  --build-command "npm install" \
  --run-command "npm start" \
  --env-file .env \
  --output text

Render pulls the repository, builds the Workflow service, and registers both tasks. You can also create the service in the Render Dashboard by selecting New > Workflow and using the same build and run commands.

6. Run the deployed workflow

Start the deployed batch with its full task slug:

render workflows start linkora-workflow/runPromptBatch \
  --input='[["Summarize eventual consistency.", "Name three uses for embeddings."]]'

Inspect the returned task-run ID:

render workflows tasks runs show TASK_RUN_ID

You can also open the Workflow service in the Render Dashboard to inspect the parent run, each chained model call, retries, logs, results, and the concrete model selected for every prompt.

Run render workflows tasks list and select the workflow, or copy the full task slug from the task page in the Render Dashboard.

7. Trigger the workflow from an application

The CLI is the quickest way to verify the deployment. A web service can start the same task through the Render SDK. Set RENDER_API_KEY in the web service or application environment, not in the Workflow service unless the Workflow itself needs to call the Render API.

import { Render } from '@renderinc/sdk';

async function main() {
  const render = new Render();

  const startedRun = await render.workflows.startTask(
    'linkora-workflow/runPromptBatch',
    [['Summarize eventual consistency.', 'Name three uses for embeddings.']],
  );

  const finishedRun = await startedRun.get();
  console.log(finishedRun.results);
}

main().catch(console.error);

Keep the web service focused on HTTP, authentication, and returning progress to the client. Put the Linkora calls in Workflow tasks so they can continue after the original request ends, retry independently, and fan out on demand.

Use a shared environment group when the web service and Workflow service need the same Linkora configuration.

Deploy a complete example

Answer Arena is a TypeScript application that combines a Render Web Service, Render Postgres, Render Workflows, and Linkora. It fans out model configurations, streams progress to the browser, and records model, cost, and evaluation results.

Resources