Skip to content

M1: System Prompt Passthrough for OpenAI-Compatible API #650

@kovtcharov

Description

@kovtcharov

Priority: P0 — Blocks all webapp integrations

Effort: Small (1-2 days)

Problem

The OpenAI API's /v1/chat/completions endpoint ignores or overrides system role messages from the client. Each agent class generates its own system prompt via _get_system_prompt(), and the client has no way to inject custom context (e.g., product documentation, company knowledge base, domain-specific instructions).

Deliverable

When a client sends a system message in the messages array, GAIA should honor it. Two modes:

  • Append (default): Client's system message is appended to the agent's built-in system prompt. The agent retains its core behavior (tool use, reasoning patterns) while gaining the client's additional context.
  • Override: If a request header or parameter signals override mode, the client's system message replaces the agent's default entirely. For advanced integrations that want full control.

Files to change

  • src/gaia/api/openai_server.py — detect and forward system messages
  • src/gaia/agents/base/agent.py_build_messages() to merge or replace system prompt

Acceptance criteria

  • Client can send {"role": "system", "content": "You are a helpful assistant for XYZ..."} and the agent's responses reflect that context
  • Agent's core tool-calling behavior is preserved in append mode
  • Existing behavior unchanged when no system message is provided

Context

Full milestone plan: docs/plans/webapp-integration.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    domain:surfacesAgent UI, Telegram, WhatsApp, Slack/Discord, mobileenhancementNew feature or requesttrack:consumer-appHermes-competitor consumer product — mobile-first, voice + messaging + memory + skills

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions