#19One model, three roles — route by promptEasy

One model, three roles — route by prompt

Background

The planner, executor, and synthesiser are the same LLM given different system prompts. The agent picks the mode by inspecting the system prompt:

  • contains "planner" or "decompose"plan
  • contains "synthesiser" or "synthesize"synthesize
  • otherwise → react (the step-by-step executor)

Problem statement

Implement llm_mode(system_prompt) returning which role the prompt selects.

Input

  • system_prompt — the system message string.

Output

Returns "plan", "synthesize", or "react".

Examples

Example 1

Input:  "You are a research planner. Decompose the question..."
Output: "plan"

Example 2

Input:  "You are a research assistant that works step by step."
Output: "react"

Constraints

  • Case-insensitive substring checks.
  • "planner"/"decompose""plan"; "synthesiser"/"synthesize""synthesize"; else "react".
  • Check plan before synthesize before defaulting to react.

Notes

  • "Multi-agent" here means different prompts and tools behind one interface — not different models.
Python
Loading...

▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.

  • Reference example: planner prompt routes to plan
  • Sample: synthesiser prompt routes to synthesize
  • Reference: default executor prompt routes to react