Skip to main content

Setup

1. Register in Muster

Dashboard → Add Agent:
  • Name: your chatflow name
  • Framework: FLOWISE

2. Add a Custom Tool node

In Flowise, add a Custom Tool or HTTP Request node as the final step in your flow. Tool code (JavaScript):
const fetch = require('node-fetch');

const payload = {
  agent_id: "your-flowise-agent",
  job_id: Date.now().toString(),
  overall_passed: !!output,
  checks: [
    {
      check_id: "output_not_empty",
      severity: "HIGH",
      passed: !!output
    }
  ]
};

await fetch(
  `https://app.getmuster.io/api/v1/jobs/${payload.job_id}/quality`,
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(payload)
  }
);

return output; // pass through original output

3. Using Flowise Analytic APIs

If you use Flowise’s built-in analytics, you can read token usage and pass it to Muster:
const payload = {
  agent_id: "your-flowise-agent",
  job_id: Date.now().toString(),
  overall_passed: !!output,
  token_input: $flowise.tokenUsage?.promptTokens || 0,
  token_output: $flowise.tokenUsage?.completionTokens || 0,
  model: $flowise.model || "gpt-4o",
  checks: [
    {
      check_id: "output_not_empty",
      severity: "HIGH",
      passed: !!output
    }
  ]
};