earendil-works/pi · error · Error
Agent run produced no assistant text.
Error message
Agent run produced no assistant text.
What it means
An assistant message exists but getLastAssistantText returned empty, so the eval has no output to score. Fires when the run ended without producing textual content (tool-only turns, empty completion).
Solutions
- Retry the run; some turns legitimately end without text
- Adjust the eval prompt or harness to request a textual answer
- Check whether the model is emitting only non-text parts
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/evals/src/pi-harness.ts:105 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24).
Data as JSON: /api/errors/a5e1e0d30a1f400b.
Report an issue: GitHub.
Appendix: source
Thrown at packages/evals/src/pi-harness.ts:105
return events;
}
async function promptAgent(session: AgentSession, input: string, signal: AbortSignal | undefined): Promise<string> {
signal?.throwIfAborted();
const previousMessageCount = session.messages.length;
await session.prompt(input);
const assistant = session.messages
.slice(previousMessageCount)
.reverse()
.find((message) => message.role === "assistant");
if (!assistant) throw new Error("Agent run completed without an assistant message.");
if (assistant.stopReason !== "stop") {
throw new Error(
assistant.errorMessage ?? `Agent run ended with unexpected stop reason: ${assistant.stopReason}.`,
);
}
const output = session.getLastAssistantText();
if (!output) throw new Error("Agent run produced no assistant text.");
return output;
}
async function runPiCodingAgent<TOutput extends JsonValue>(
input: PiCodingAgentInput,
signal: AbortSignal | undefined,
setArtifact: HarnessContext["setArtifact"],
options: PiCodingAgentHarnessOptions | PiCodingAgentHarnessWithOutput<TOutput>,
): Promise<SimpleHarnessResult<string | TOutput>> {
const startedAt = performance.now();
signal?.throwIfAborted();
const selection = resolveModelSelection(options.model);
const modelRuntime = await ModelRuntime.create();
const model = modelRuntime.getModel(selection.provider, selection.id);
if (!model) throw new Error(`Eval model not found: ${selection.provider}/${selection.id}`);
const root = await mkdtemp(join(tmpdir(), "pi-eval-"));
const cwd = join(root, "workspace");View on GitHub (pinned to 4af9d21d3b)