Skip to content

yggdrasil.loki.planning

planning

Structured agent planning — tasks, personas, and required skills.

Replaces the old free-form routing dict with a small, stable class hierarchy:

  • :class:AgentTask — the classification of a request: its category, the persona to embody (data engineer, analyst, software engineer, trader, confessor, companion, …), the required skills, and data/time-series flags.
  • :class:AgentPlan — an :class:AgentTask plus the execution decision: the action to take, an optional specialist agent, and a source URL.

:class:AgentPlan is mapping-compatible (plan["action"] / plan.get(...)) so it drops in wherever the old dict was used, while giving callers typed fields, a persona system prompt, and to_dict().

AgentTask dataclass

AgentTask(
    text: str,
    category: str = "chat",
    persona: str = "assistant",
    required_skills: tuple[str, ...] = (),
    data: bool = False,
    timeseries: bool = False,
    why: str = "",
)

The classification of a request — what kind of work, by whom, with what.

persona_prompt

persona_prompt() -> Optional[str]

The system prompt that makes the agent embody :attr:persona.

AgentPlan dataclass

AgentPlan(
    text: str,
    category: str = "chat",
    persona: str = "assistant",
    required_skills: tuple[str, ...] = (),
    data: bool = False,
    timeseries: bool = False,
    why: str = "",
    action: str = "reason",
    specialist: Optional[str] = None,
    url: Optional[str] = None,
    skill: Optional[str] = None,
    skill_kwargs: dict = dict(),
)

Bases: AgentTask

An :class:AgentTask plus how to execute it (mapping-compatible).

persona_prompt

persona_prompt() -> Optional[str]

The system prompt that makes the agent embody :attr:persona.

classify_persona

classify_persona(text: str) -> str

Best-matching persona for text by signal hits ("assistant" default).

skills_for

skills_for(category: str, *, data: bool = False) -> tuple[str, ...]

Required skills for a category (data requests always include tabular).