Skip to main content

Advisor sessions

Full diagnosis path: classify → agent tool loop → diagnosis (or pause for manager answers).

Redoc: Advisor tag.
Worked example: Live test run.

Start

POST /api/advisor/sessions

{ "problem_statement": "sales are down across the board" }

201 body (data):

FieldMeaning
session_idOpaque id
statusdiagnosing | awaiting_manager | concluded | …
playbook_idsSelected playbooks
hypothesis_boardLive board (hypothesis_id, status, evidence_note)
pending_questionsPresent when status is awaiting_manager
diagnosisPresent when concluded
verify_afterYYYY-MM-DD verification date
query_count / ask_countCaps usage
stopWhy the loop returned: concluded | awaiting_manager | max_turns | model_stop
classify{ playbook_ids, source } from the classifier

Diagnosis object

{
"finding": "…",
"confidence": "confirmed | likely_unconfirmed",
"evidence": ["…"],
"actions": [
{
"rec_id": "lapsed-customer-winback",
"summary": "…",
"effort": "low",
"expected_impact": "…"
}
],
"verification": {
"check_after_days": 14,
"probe_ids": ["dd-01"]
}
}

Get

GET /api/advisor/sessions/{id} — snapshot only (does not re-run the agent).

Resume (after ask_manager)

When status === "awaiting_manager":

POST /api/advisor/sessions/{id}/answers

{
"answers": [
{ "probe_id": "q1", "answer": "We ran a DoorDash promo last month" }
]
}

Returns the same session view after the loop continues.

409 if the session is not awaiting answers.

Status lifecycle

intake → diagnosing ─┬─► awaiting_manager ─(answers)─► diagnosing ─► …
└─► concluded (+ diagnosis, verify_after)

Caps (defaults)

CapDefaultFile
query_data calls8src/application/agent/constants.ts
ask_manager calls3same
LLM turns / run24same

Mock vs live behavior

Adapter setTypical start result
All mockOften concluded in one request (scripted tools)
OpenAI investigateMay ask manager; use resume
QueryCraft queryReal SQL/rows inside query_data

Not built yet

  • Scheduled verification job (~14 days)
  • Notify webhook when verification is due
  • SSE streaming of tool events (sync JSON only today)