#25Parse the planner's sub-question listEasyAgentic AI
Parse the planner's sub-question list
Background
The Planner returns a numbered list of sub-questions as plain text. The agent parses it into a Python list: each line that starts with a digit and contains ". " becomes a sub-question (with the "N. " prefix removed).
for line in text.strip().splitlines():
line = line.strip()
if line and line[0].isdigit() and ". " in line:
questions.append(line.split(". ", 1)[1].strip())
Problem statement
Implement parse_plan(text) returning the list of sub-question strings.
Input
text— the planner's raw numbered-list output.
Output
Returns a list of strings: the text after "N. " for each numbered line, in order. Non-numbered lines are ignored.
Examples
Example 1
Input: "1. What benchmark did AlphaCode use?\n2. What was its training data?"
Output: ["What benchmark did AlphaCode use?", "What was its training data?"]
Example 2 — preamble ignored
Input: "Here is the plan:\n1. First\n2. Second"
Output: ["First", "Second"]
Constraints
- Keep only lines whose first character is a digit and that contain
". ". - Strip the
"N. "prefix and surrounding whitespace. - Preserve order; skip blank/non-numbered lines.
Notes
- A clean list is the agent's checklist — every item becomes one executor, guaranteeing coverage.
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: two numbered items
- •Sample: preamble line is ignored
- •Reference: two-digit numbering works