Skip to content

Orchestrator prompt not attached: falls back to description, losing context #38

Description

@AmitAvital1

Current behavior

OrchestratorNode.__call__ builds the orchestrator's prompt from the wrong field, and only uses one of the two prompt files:

https://github.com/extra-org/extra/blob/main/src/agent_engine/engine/langgraph/nodes.py#L535

base_prompt = load_file(self._base_dir, self._spec.prompts.system) or self._spec.description

Per the documented contract (docs/PROMPT_RENDERING.md), an orchestrator node has two distinct, complementary prompt files:

Field Purpose Required
system node behavior/persona no
orchestrator routing instructions yes

Both are meant to be attached to the LLM call. Instead, the code only ever reads .system and falls back to the one-line YAML description when it's empty — .orchestrator (the required routing-instructions file) is never read at all, and .system and .orchestrator are never combined.

Since most orchestrator configs (see examples/enterprise-knowledge-assistant/agents.yaml) set both system and orchestrator files, in practice: system.md content silently replaces orchestrator.md content, and the routing instructions the orchestrator actually needs are dropped entirely, with no error or warning.

For contrast, AgentNode (nodes.py:187) correctly uses self._spec.prompts.system, since agents only have one prompt field (system). Looks like this orchestrator branch was copy-pasted from the agent branch without accounting for the orchestrator's two-prompt shape.

Steps to reproduce

  1. Define an orchestrator node in agent.yml with a description, a prompts.system file, and a prompts.orchestrator file, e.g.:
    orchestrators:
      research_router:
        description: "Routes research queries"
        prompts:
          system: prompts/research_router/system.md
          orchestrator: prompts/research_router/orchestrator.md
  2. Put distinct, identifiable content in each file (e.g. persona text in system.md, routing rules in orchestrator.md).
  3. Run the graph and inspect the system prompt actually sent to the orchestrator's LLM call (or log base_prompt in OrchestratorNode.__call__).
  4. Observe only system.md's content appears (or description, if system isn't set) — orchestrator.md's routing instructions never appear anywhere in the prompt.

Goal

OrchestratorNode.__call__ should load both self._spec.prompts.system and self._spec.prompts.orchestrator and combine them into the final prompt (plus _ORCHESTRATOR_CONTRACT), not read one instead of the other. description should remain only as a last-resort fallback when neither prompt file is configured.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions