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
Context
Full milestone plan: docs/plans/webapp-integration.md
Priority: P0 — Blocks all webapp integrations
Effort: Small (1-2 days)
Problem
The OpenAI API's
/v1/chat/completionsendpoint ignores or overridessystemrole 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
systemmessage in themessagesarray, GAIA should honor it. Two modes:Files to change
src/gaia/api/openai_server.py— detect and forward system messagessrc/gaia/agents/base/agent.py—_build_messages()to merge or replace system promptAcceptance criteria
{"role": "system", "content": "You are a helpful assistant for XYZ..."}and the agent's responses reflect that contextContext
Full milestone plan:
docs/plans/webapp-integration.md