Polimorf Docs
API Reference

Deployed assistants

POST /runtime/assistants/:slug and /stream — run an assistant your team published, sending only the input.

Run an assistant your team has published and deployed in the dashboard. The provider, model, and prompt come from the published version's frozen snapshot — you send only the input. When your team publishes a new version, your running application picks it up with no code change and no redeploy.

POST /runtime/assistants/:slug

Runs the assistant's current deployed version and returns the complete result.

Path parameters

ParameterDescription
slugThe assistant's slug, as shown in the dashboard.

Request body

FieldTypeRequiredDescription
inputstringyesThe runtime input to run the deployed version against.
variablesobjectnoValues for the version's declared prompt variables. Values are string, number, or boolean.
environmentstringnoDeployment environment slug. Defaults to production.

You do not send a provider, model, or messages here — those are fixed by the published version. That is what lets your team change the model or rewrite the prompt without a client change.

Example request

curl https://api.polimorf.app/runtime/assistants/support \
  -H "Authorization: Bearer $POLIMORF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "How do I cancel my subscription?",
    "variables": { "plan": "pro", "locale": "en-US" },
    "environment": "production"
  }'

Response

Identical to an ad-hoc generation:

{
  "message": { "role": "assistant", "content": "To cancel, open…" },
  "finishReason": "stop",
  "usage": { "inputTokens": 31, "outputTokens": 22, "totalTokens": 53 }
}

A slug that is not deployed to the target environment returns 404 (ASSISTANT_NOT_FOUND or DEPLOYMENT_NOT_FOUND).

With the SDK

const result = await client.assistant('support').run({
  input: 'How do I cancel my subscription?',
  variables: { plan: 'pro' },
});

console.log(result.message.content);

Streaming

POST /runtime/assistants/:slug/stream

Identical request body, streamed as Server-Sent Events:

for await (const event of client.assistant('support').stream({
  input: 'Give me three onboarding tips.',
})) {
  if (event.type === 'delta') process.stdout.write(event.content);
}

A non-2xx response before the stream opens (for example, 404 when the slug is not deployed) throws a PolimorfApiError; a terminal provider error arrives as an error event. See Streaming.