Supercharging nyxCore: Introducing Expert Personas & Multi-Provider LLM Comparison
We've just rolled out two powerful new features for nyxCore: Workflow Personas for injecting expert context into your AI steps, and Multi-Provider A/B Comparison for evaluating LLMs side-by-side. Discover how these enhancements make your AI workflows smarter, more flexible, and more robust.
The world of AI is moving at lightning speed, and for nyxCore, our goal is to empower developers and users with the most flexible and intelligent tools to build incredible AI-driven workflows. This past development session was a sprint to integrate two game-changing features that push nyxCore further: Workflow Personas and Multi-Provider LLM A/B Comparison.
We're thrilled to announce that these features are now live on our development branch, ready for testing and integration. Let's dive into what they are, why they matter, and how we brought them to life.
Bringing Expertise to Your AI: Workflow Personas
Imagine not just giving an LLM a prompt, but giving it a role. What if your AI could "think" like a marketing strategist, a technical writer, or a legal expert, right from the start of a workflow? That's the power of Workflow Personas.
What it is: Workflow Personas allow you to define pre-configured "expert identities" – essentially, specialized system prompts – that can be injected into every step of your workflow. Instead of just a generic "You are a helpful AI assistant," you can now prepend your step's system prompt with something like:
## Expert: Marketing Strategist
You are a seasoned marketing strategist with 15 years of experience in digital campaigns. Your goal is to identify target audiences and craft compelling messaging that drives engagement.
## Expert: Technical Writer
You are an experienced technical writer, specializing in clear, concise, and accurate documentation for developers. Your focus is on precision and ease of understanding.
Why it matters:
- Enhanced Context: Provides a deeper, more consistent context for the LLM, leading to more relevant and higher-quality outputs.
- Domain-Specific Reasoning: Encourages the LLM to adopt a specific persona's perspective, improving the quality of reasoning for specialized tasks.
- Workflow Consistency: Ensures that a particular "mindset" is applied throughout a complex workflow, maintaining tone and focus.
How we built it: At a high level, implementing personas involved:
- Schema Extension: Adding
personaIds(an array of UUIDs) to theWorkflowmodel inprisma/schema.prismato link workflows to chosen personas. - Persona Management: Creating a new
personasRouterin tRPC to handle listing and retrieving persona definitions. - Engine Integration: The core logic lives in
src/server/services/workflow-engine.ts. A newloadPersonaSystemPrompts()function fetches the system prompts for selected personas, formats them, and prepends them to the workflow step's own system prompt before sending it to the LLM. - User Interface: A new multi-select persona picker was added to the workflow creation page, and persona badges now appear in the workflow settings panel for quick visibility.
The Ultimate LLM Showdown: Multi-Provider A/B Comparison
Choosing the right LLM for a specific task can be tricky. Cost, performance, quality, and even subtle stylistic differences can make or break a workflow. Our new Multi-Provider A/B Comparison feature takes the guesswork out of it.
What it is: For any given step in your nyxCore workflow, you can now select multiple LLM providers (e.g., OpenAI, Anthropic, Google, Ollama) and have the workflow engine execute that same step against all selected providers simultaneously. Their outputs are then presented side-by-side as alternatives for you to compare and choose from.
Why it matters:
- Informed Decisions: Directly compare outputs from different models using the exact same input, allowing you to pick the best performer for your needs.
- Cost Optimization: Evaluate cost-effectiveness without sacrificing quality.
- Reduced Vendor Lock-in: Easily switch between providers or use different providers for different steps based on their strengths.
- Prompt Engineering Aid: Quickly iterate on prompts by seeing how different models interpret and respond to them.
How we built it: This was a more involved change, touching several critical parts of the system:
- Schema Extension: Added
compareProviders(an array of provider names) toWorkflowStepinprisma/schema.prisma. - tRPC Workflow Updates: Modified
stepConfigSchemaand thecreate/updatemutations for workflows and steps to handle the newcompareProvidersfield. TheestimateCostmutation now intelligently multiplies the cost based on the number of providers selected for comparison. - Engine Forking: The most significant change was in
src/server/services/workflow-engine.ts. Inside theexecuteStep()function, ifcompareProvidershas more than one entry, the engine now "forks" execution, running the step once for each specified provider. The results are then aggregated and presented as alternatives. - User Interface: A new multi-toggle "Compare Providers" option was added to the
SortableStepCardcomponent, allowing users to easily select which providers to compare for that specific step. This also intelligently syncs with thegenerateCountfield. On the workflow detail page, alternative cards now display provider and model badges, and step headers show a "N providers" badge to indicate comparison mode.
Challenges & Lessons Learned
No significant feature release is without its bumps in the road. Here are a few "aha!" moments and solutions from this session:
- Type Safety vs. Zod Enums:
- Problem: We initially tried to use a generic
string[]forcompareProvidersin our frontendStepConfigtype. However, our Zod schema on the backend was strictlyz.array(z.enum(["anthropic", "openai", "google", "ollama"])). This led to TypeScript errors becausestring[]isn't assignable to a union literal array. - Lesson: When working with Zod schemas and strict types, ensure your frontend types mirror the exact literal unions defined in your schema. We resolved this by defining a literal union type (e.g.,
type Provider = "anthropic" | "openai" | "google";) and usingProvider[]in our frontend types. This enforces strict type checking from end to end.
- Problem: We initially tried to use a generic
- Missing Default Values:
- Problem: When adding
compareProviderstostepConfigSchema, we forgot to include it in the default step configuration for new workflows. This causedTS2741errors about missing properties. - Lesson: Always remember to update default values for new fields, especially when they are non-optional or have specific default requirements, to maintain type completeness and prevent runtime errors. Adding
compareProviders: []to the defaultstepConfigfixed this.
- Problem: When adding
- Dev Server Shenanigans:
- Problem: During rapid development, I attempted to run two
nyxCoredev servers simultaneously (an older branch and the new one) on the same port, leading to unpredictable caching issues and style conflicts. - Lesson: A clean slate is often the fastest path forward. When encountering strange behavior, especially with frontend frameworks, kill all processes on the relevant port (
lsof -ti:3000 | xargs kill -9), clear your.nextcache, and perform a fresh restart. This ensures you're working with a completely rebuilt and consistent environment.
- Problem: During rapid development, I attempted to run two
The Journey to Done
This session culminated in a robust set of changes across the entire stack:
- Database Schema: Updated
prisma/schema.prismato supportWorkflow.personaIdsandWorkflowStep.compareProviders. - Backend Logic: New tRPC router for
personas, significant updates toworkflows.tsfor handling new fields in mutations, andworkflow-engine.tsfor persona prompt injection and multi-provider execution forking. - Frontend UI: Integrated new persona pickers, multi-provider toggles, and display badges in the dashboard.
- Type Safety: Updated
constants.tsand various component types to reflect the new data structures.
The entire feature set is now committed as aa37799 on main, with the dev server running clean and ready for action.
What's Next?
With these foundational pieces in place, our immediate next steps involve rigorous testing:
- UI Verification: Ensuring all styles render correctly after the cache clear.
- Data Seeding: Adding test personas to the database for comprehensive manual testing.
- Functional Testing:
- Creating a workflow with multiple personas and verifying their system prompts in the output.
- Setting up a step with
compareProvidersfor different LLMs and confirming side-by-side alternatives. - Testing alternative selection and workflow continuation.
- Verifying backward compatibility for
generateCount(temperature variations) withoutcompareProviders. - Checking that
personaIdsandcompareProvidersare correctly preserved during workflow duplication.
These new features significantly enhance nyxCore's capabilities, offering unprecedented control and insight into your AI workflows. We're excited to see how they empower our users to build even more sophisticated and intelligent applications!