Skip to main content

Output routing

Kheish separates internal output persistence from external delivery.

Local output

Every daemon-produced answer is first recorded locally in the daemon’s own output stream and session records. This ensures the output exists even if an external delivery fails.

Rich retained outputs

When a run creates daemon-owned media, the visible reply still needs one final persisted output step. Current pattern:
  1. call one generator such as generate_audio, generate_image, or edit_image
  2. keep the returned daemon asset ids
  3. call emit_output to publish the visible answer and attach those assets
Generated assets only become visibly inline or deliverable when the final emit_output includes asset parts or sets include_artifacts_inline = true.

Reply targets

Output routing is driven by reply targets. A run can inherit or override reply targets from:
  • the explicit request
  • the session defaults
  • connector-derived routing
When output is produced, Kheish resolves reply targets in this order:
  1. an explicit output override
  2. the run snapshot
  3. the session defaults
This is why session reply-target edits are prospective only. They affect future work and future fallback delivery, but they do not rewrite reply targets already captured by an existing run or delivery item.

Generic output plugins

External delivery is handled through a generic output plugin model. Output plugins receive normalized response envelopes and can deliver them to one or more external systems.

Queued delivery

Connector-backed output delivery is not purely synchronous. Kheish uses a persisted delivery queue with retries, so transient failures do not silently discard outbound responses.

Current output surfaces

Today, the daemon can keep output local and route it through queued plugins for:
  • HTTP
  • Slack
  • Telegram
This is why output routing is an operational subsystem, not a presentation detail. Read Connectors and reply targets for the durable model behind connector-owned routes, session defaults, and run snapshots.