🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

sun-parliament

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sun-parliament

A skill-first multi-agent deliberation engine that simulates a parliament of expert personas

latest
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

Sun Parliament

Multi-agent deliberation engine. One call gets you a structured debate among expert personas — with disagreement tracking, minority reports, and budget controls.

Designed as a skill: invoke it from an agent workflow, import it as a library, or run it from the CLI.

Installation

npm install sun-parliament

Requires Node >= 18 and at least one LLM provider API key.

When to Use Sun Parliament

Use it when you need multiple perspectives before deciding — architecture choices, risk reviews, planning under uncertainty, security-sensitive designs.

Don't use it for simple factual questions, pure writing tasks, or anything where a single expert answer is sufficient. Micro mode on a writing prompt reaches consensus in one round with zero disagreements — the debate adds nothing.

Quick Start

SDK

import { debate } from "sun-parliament";

const response = await debate({
  prompt: "Should we use microservices or a monolith?",
  mode: "fast",
  taskType: "strategy",
});

// Use the result
console.log(response.finalAnswer);
console.log(response.decisionType);    // "consensus" | "majority" | "split" | "uncertain"
console.log(response.minorityReport);  // dissenting views, if any
console.log(response.warnings);        // safety/security concerns raised during debate

CLI

# Quick question — micro mode, 2-3 seats, 1 round
sun-parliament ask "What's the best approach to rate limiting?"

# Planning — fast mode, structured steps
sun-parliament plan "Migration plan from monolith to microservices"

# Critical review — find problems and risks
sun-parliament review "Our proposed auth schema" --mode balanced

# Full debate with trace
sun-parliament debate "Should we pivot?" --mode fast --trace full --json

# See what seats would be selected without running a debate
sun-parliament inspect "How to handle API key rotation?" --mode fast

Defaults and Mode Selection

These defaults are backed by benchmark data (10 prompts × 3 modes: micro/fast/balanced, Anthropic Claude, 2026-04-02). Deep mode was not benchmarked.

CommandDefault ModeCostLatencyWhy This Default
askmicro1.6x baseline16sBest value. 3+ disagreements on average at minimal cost overhead.
planfast6.5x baseline34sPlanning needs deeper conflict surfacing. 10+ disagreements on average.
reviewfast6.5x baseline34sReviews benefit from more critical perspectives.
debatebalanced13.3x baseline37sExplicit full deliberation. 5 seats, 18+ disagreements, 70% minority reports.

Security auto-upgrade: Prompts containing security/auth/credential keywords auto-upgrade from micro to fast. This ensures SecurityPrivacySeat is included — it can't fit in micro's 2-seat chamber.

When to override:

  • Use --mode fast on ask when the question has real tradeoffs
  • Use --mode micro on review when you want a quick sanity check, not a deep critique
  • Avoid balanced unless you specifically want 5+ perspectives — it costs 13x baseline with diminishing returns vs fast
  • deep mode is implemented but not benchmarked in v0.1.0. Budget limits (60k tokens / 60s) are enforced. Use at your own cost discretion.

Provider Support

ProviderStatusKey Variable
AnthropicLive-validated + benchmarkedANTHROPIC_API_KEY
OpenAILive-validatedOPENAI_API_KEY
FLOCKLive-validated (OpenAI-compatible)FLOCK_API_KEY
Google AIImplemented, not live-validatedGOOGLE_API_KEY
FederatedLive-validated (Anthropic+OpenAI, FLOCK+Anthropic)Multiple keys

Set at least one key. The system auto-detects available providers. Anthropic, OpenAI, and FLOCK are all live-validated individually and in federated/supreme combinations. Google adapter is implemented but not live-tested (no key available).

FLOCK uses the OpenAI-compatible API format with x-litellm-api-key header auth. Model must be specified explicitly:

FLOCK_API_KEY=sk-...
FLOCK_MODEL=your-model-name               # required — no default
FLOCK_BASE_URL=https://api.flock.io/v1    # default, can be overridden

To force a specific primary provider:

SUN_PARLIAMENT_PRIMARY_PROVIDER=openai

Output Language

Internal debate is always in English for reasoning quality. Output language is configurable — the final synthesis step renders the result in the requested language.

# CLI
sun-parliament ask "What is the best database for this use case?" --language zh

# SDK
debate({ prompt, outputLanguage: "zh" })

Supported: any BCP-47 language code (en, zh, zh-CN, ja, es, fr, ko, etc.). English output (en) is the default — no translation step is added.

What gets translated: finalAnswer, warnings, minorityReport, openQuestions, debateSummary, transcript output.

What stays English: Internal seat statements, disagreement records, trace artifacts. These are reasoning internals, not user-facing output.

Execution Profiles

Mode controls how many seats debate. Profile controls which models they use. These are independent knobs.

ProfileBehaviorWhen to Use
availableSeats follow their fallback chain with whatever providers existDefault. Works with any single provider.
federatedOpenAISeat/ClaudeSeat/GeminiSeat prefer their native family; others use primaryWhen you have multiple API keys and want provider-native seat diversity
supremeAll debate seats + synthesis run on one operator-designated provider (SUN_PARLIAMENT_SUPREME_PROVIDER, defaults to primary)When you want all seats on one provider for uniform quality
# CLI
sun-parliament ask "question" --profile supreme

# SDK
debate({ prompt, mode: "fast", executionProfile: "supreme" })

With only one API key, all three profiles produce the same assignments — every seat deterministically falls back to that provider.

Configuration

Environment Variables

ANTHROPIC_API_KEY=sk-ant-...                        # Provider keys (at least one required)
OPENAI_API_KEY=sk-...
FLOCK_API_KEY=sk-...                                 # FLOCK provider key
FLOCK_MODEL=your-model-name                          # FLOCK model (required, no default)
FLOCK_BASE_URL=https://api.flock.io/v1               # FLOCK base URL (default shown)
SUN_PARLIAMENT_PRIMARY_PROVIDER=anthropic            # Force primary provider
SUN_PARLIAMENT_SUPREME_PROVIDER=flock                # Override supreme model selection
SUN_PARLIAMENT_EXECUTION_PROFILE=available           # Default profile
SUN_PARLIAMENT_DEFAULT_MODE=fast                     # Override default mode
SUN_PARLIAMENT_DEFAULT_TRACE=summary                 # none | summary | full
SUN_PARLIAMENT_DEFAULT_OUTPUT_LANGUAGE=en             # Output language (e.g. zh, ja, es)
SUN_PARLIAMENT_MAX_TOKENS=15000                      # Global token budget cap
SUN_PARLIAMENT_MAX_LATENCY_MS=20000                  # Global latency cap

Config File

Optional sun-parliament.config.json in your working directory:

{
  "primaryProvider": "anthropic",
  "supremeProvider": "anthropic",
  "defaults": { "mode": "fast", "executionProfile": "available", "trace": "summary", "outputLanguage": "en" },
  "budgetOverrides": { "maxTokens": 15000, "maxLatencyMs": 20000 }
}

Environment variables take priority over file config.

Response Structure

Every call returns a ParliamentResponse:

FieldTypeAlways PresentDescription
finalAnswerstringYesThe synthesized answer
decisionType"consensus" | "majority" | "split" | "uncertain"YesHow the parliament resolved
activatedSeatsstring[]YesWhich seats participated
whyTheseSeatsstringYesRouting rationale
minorityReportstringNoDissenting views (absent on consensus)
openQuestionsstring[]NoUnresolved disagreements
warningsstring[]NoSafety/security concerns raised
debateSummarystringWhen trace != "none"Per-round summary
traceArtifactobjectWhen trace == "full"Full deliberation trace with rounds, statements, disagreements

Answer Modes

Control the synthesis format with answerMode:

ModeOutput ShapeBest For
answerDirect response (default)General questions
memoSituation / Options / Analysis / RecommendationDecision memos
planGoal / Steps / Dependencies / RisksImplementation planning
reviewVerdict / Strengths / Issues / Risks / RecommendationsCode and design review
transcriptFormatted debate with per-seat contributionsUnderstanding the deliberation

Serverless Deployment

import { handleRequest } from "sun-parliament";

export default async function handler(req) {
  return handleRequest({ method: req.method, body: await req.json() });
}

POST a ParliamentRequest JSON body, get back a ParliamentResponse. Includes CORS headers, input validation, and structured error responses.

Full Parliament (33 seats)

All 33 seats are production-grade and invokable. Default modes select a subset; full parliament is explicit opt-in.

CategorySeats
ProceduralSpeaker
Model RepresentativesOpenAISeat, ClaudeSeat, GeminiSeat
Computing FoundationsTuringSeat, KnuthSeat, DijkstraSeat, ShannonSeat
Modern ComputingDistributedSystemsSeat, MLSystemsSeat, HumanComputerInteractionSeat, SecurityPrivacySeat
PhilosophyAristotleSeat, KantSeat, NietzscheSeat
MathematicsEuclidSeat, GaussSeat, VonNeumannSeat
PhysicsNewtonSeat, EinsteinSeat, FeynmanSeat
Economics & StrategySmithSeat, KeynesSeat, StrategySeat
Psychology & CognitionKahnemanSeat, JungSeat, CognitiveScienceSeat
Product & OperationsProductStrategySeat, OperatorSeat, DesignCommunicationSeat
Civic & EthicsLawGovernanceSeat, EthicsHumanImpactSeat, CitizenPragmatistSeat

Full Parliament Mode

Activate all 33 seats for maximum deliberation breadth:

sun-parliament debate "question" --full-parliament
debate({ prompt, fullParliament: true, trace: "full" })
MetricFull Parliament (measured)
Seats32 (+ Speaker)
Rounds1 (default)
Avg tokens~247,000
Avg latency~44s
Avg disagreements133
Estimated cost~$1.50/run
Budget cap300k tokens / 120s

Full parliament runs 1 round by default — 32 voices in a single round already produce 100+ disagreements. Budget limits apply between rounds; a single parallel round may use the full cap.

When to use: Consequential decisions where you want every disciplinary angle — architecture with compliance implications, strategic pivots, security-critical designs.

When not to use: Everyday questions. The cost is ~300x baseline. Default modes (micro/fast/balanced) are better for routine work.

CLI Reference

sun-parliament ask <prompt>       Quick deliberation (micro)
sun-parliament debate <prompt>    Full debate with trace (balanced)
sun-parliament plan <prompt>      Planning-biased (fast)
sun-parliament review <prompt>    Critical review (fast)
sun-parliament seats              List available seats
sun-parliament inspect <prompt>   Show routing without running debate

Options:
  --mode <mode>           micro | fast | balanced | deep
  --full-parliament       Activate all 33 seats (high cost, explicit opt-in)
  --profile <profile>     available | federated | supreme
  --language <code>       Output language (e.g. zh, ja, es). Internal debate stays English.
  --task <type>           general | writing | planning | analysis | coding | strategy | ethics
  --answer <mode>         answer | memo | plan | review | transcript
  --trace <level>         none | summary | full
  --seat <seats...>       Include specific seats
  --exclude-seat <seats>  Exclude specific seats
  --json                  Machine-readable JSON output
  --short / --long        Control output length
  --seed <value>          Reproducibility seed
  --max-tokens <n>        Override token budget
  --max-latency-ms <n>    Override latency budget

License

MIT

Keywords

ai

FAQs

Package last updated on 02 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts