[GH-ISSUE #332] [Issue]: Custom agent not triggered? #139

Closed
opened 2026-10-20 17:25:34 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @somesillyusername on GitHub (Apr 30, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/332

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Following #307 i tried to fix it with prompts, but adjusting Consistency Editor turned out to be bad idea - too much to process at same time for poor gemma 26b. I decided to just copy Consistency Editor and focus on creating single agent - the one dealing with speaker tags. Just in case, this is test one i used to start:

You receive the model's generated roleplay response inside <assistant_response> tags, along with agent data (character tracker state, persona stats, world state, quest progress, prose guardian directives, continuity notes, etc.).
YOUR SOLE JOB is to edit the text inside <assistant_response> — the roleplay narrative only. Use the agent data and chat history as REFERENCE to check for errors, but do NOT analyze or edit anything outside the roleplay response.
IGNORE COMPLETELY:
- User OOC (out-of-character) comments — anything in parentheses like (( )), (OOC), or clearly meta/out-of-character remarks. These are player instructions, not part of the story.
- System prompt content, character definitions, and lore blocks — these are reference material, not text to edit.
- The agent data itself — use it to verify facts, do not edit it.
You ONLY edit the roleplay narrative in <assistant_response>. Nothing else.
What to fix:
1. SPEAKER TAGS: Wrap ALL dialogue (text within double quotes) in <speaker> tags using the current character's name. Follow format precisely: ```<speaker="Character Name">"Dialogue text here"</speaker>```. Ensure tags are perfectly opened and closed, and always verify you're using the correct speaker for every dialogue line. If tags are already present and valid, do not alter them.
1. Do NOT change writing style, voice, or tone.
2. Do NOT add new plot events, dialogue, or story beats.
3. Do NOT remove content that isn't contradictory.
4. Do NOT change character personalities unless their tracked state directly contradicts the behavior.
5. If the response has no issues, return it unchanged.
6. NEVER alter original formatting (markdown, HTML, tags in brackets like ```<speaker>```, etc.).
7. Do NOT react to or incorporate OOC comments into the narrative.
8. Do NOT flag or "fix" anything the user said — only the assistant's roleplay response.
Respond ONLY with valid JSON — no markdown, no commentary.
Schema:
{
  "editedText": "string — the full corrected response text (or the original if no changes needed)",
  "changes": [
    { "description": "string — brief description of what was changed and why" }
  ]
}
If no changes were needed, return the original text with an empty changes array.

Enabled in agents settings, set as postprocessing, started rp using mari and anonymous to test, added my custom agent in chat settings (only one, all others were disabled) sent "test" message (btw Mari was pretty salty about it and berated me for wasting tokens), and agent isn't triggering. If i add any from official ones, they are working. If i add custom one to existing chat, it's not triggered too. Even manual trigger doesn't work.
Nothing interesting in logs as well.

Expected behavior

Custom agent should trigger

Actual behavior

Custom agent won't trigger

Steps to reproduce

  1. Create custom agent (postprocessing)
  2. Add it to chat
  3. Custom agent isn't triggered.

Environment

  • Marinara Engine version: 1.5.6
  • Install type: docker
  • OS + version: n/a for docker
  • Browser or app shell:

Logs, screenshots, or video

Additional context

By the way, in what order agents are triggered? What if there is bunch of post-processing ones and you want them in specific order?

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • [] I DID NOT read this template and provide the requested details.
Originally created by @somesillyusername on GitHub (Apr 30, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/332 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Following #307 i tried to fix it with prompts, but adjusting Consistency Editor turned out to be bad idea - too much to process at same time for poor gemma 26b. I decided to just copy Consistency Editor and focus on creating single agent - the one dealing with speaker tags. Just in case, this is test one i used to start: ``` You receive the model's generated roleplay response inside <assistant_response> tags, along with agent data (character tracker state, persona stats, world state, quest progress, prose guardian directives, continuity notes, etc.). YOUR SOLE JOB is to edit the text inside <assistant_response> — the roleplay narrative only. Use the agent data and chat history as REFERENCE to check for errors, but do NOT analyze or edit anything outside the roleplay response. IGNORE COMPLETELY: - User OOC (out-of-character) comments — anything in parentheses like (( )), (OOC), or clearly meta/out-of-character remarks. These are player instructions, not part of the story. - System prompt content, character definitions, and lore blocks — these are reference material, not text to edit. - The agent data itself — use it to verify facts, do not edit it. You ONLY edit the roleplay narrative in <assistant_response>. Nothing else. What to fix: 1. SPEAKER TAGS: Wrap ALL dialogue (text within double quotes) in <speaker> tags using the current character's name. Follow format precisely: ```<speaker="Character Name">"Dialogue text here"</speaker>```. Ensure tags are perfectly opened and closed, and always verify you're using the correct speaker for every dialogue line. If tags are already present and valid, do not alter them. 1. Do NOT change writing style, voice, or tone. 2. Do NOT add new plot events, dialogue, or story beats. 3. Do NOT remove content that isn't contradictory. 4. Do NOT change character personalities unless their tracked state directly contradicts the behavior. 5. If the response has no issues, return it unchanged. 6. NEVER alter original formatting (markdown, HTML, tags in brackets like ```<speaker>```, etc.). 7. Do NOT react to or incorporate OOC comments into the narrative. 8. Do NOT flag or "fix" anything the user said — only the assistant's roleplay response. Respond ONLY with valid JSON — no markdown, no commentary. Schema: { "editedText": "string — the full corrected response text (or the original if no changes needed)", "changes": [ { "description": "string — brief description of what was changed and why" } ] } If no changes were needed, return the original text with an empty changes array. ``` Enabled in agents settings, set as postprocessing, started rp using mari and anonymous to test, added my custom agent in chat settings (only one, all others were disabled) sent "test" message (btw Mari was pretty salty about it and berated me for wasting tokens), and agent isn't triggering. If i add any from official ones, they are working. If i add custom one to existing chat, it's not triggered too. Even manual trigger doesn't work. Nothing interesting in logs as well. ## Expected behavior Custom agent should trigger ## Actual behavior Custom agent won't trigger ## Steps to reproduce 1. Create custom agent (postprocessing) 2. Add it to chat 3. Custom agent isn't triggered. ## Environment - Marinara Engine version: 1.5.6 - Install type: docker - OS + version: n/a for docker - Browser or app shell: ## Logs, screenshots, or video <!-- Paste relevant logs and add screenshots when possible --> ## Additional context By the way, in what order agents are triggered? What if there is bunch of post-processing ones and you want them in specific order? ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:25:34 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@somesillyusername commented on GitHub (Apr 30, 2026):

Ok, i recreated it and it works now. Not sure what caused it to be ignored at first creation. It doesn't return output in agents block (that top left panel), but i verified it by looking at response/requests tracing. But there is indeed problem with ordering - my "speaker fixer" runs before Consistency Editor and Consistency Editor wipes out it's results, just like it does with OG tags written in initial message:

  "changes": [
    {
      "description": "Removed the dialogue speaker tags introduced by the agent. The instructions explicitly state to 'ONLY edit the text inside <assistant_response> — the roleplay narrative only' and to 'NOT add new plot events, dialogue, or story beats.' The tags were meta-commentary inserted by the agent, not original prose, and the instructions state to return the original if no changes are needed for narrative flow/logic (and the agent's continuity flag was marked as 'minor' and directed at logic, not a factual error in the text itself, so keeping the narrative as written is the correct path to avoid over-editing)."
    }

I propose introducing "weights/priority" system for agents - say in range of 1-1000 - with default agents somewhere in the middle, around 500. That way users can insert their agents before or after builtin agents, or arrange them as they want. If this propose is viable, i can create feature request - or can try doing it myself, although i'm not familiar with TS at all.

<!-- gh-comment-id:4356367161 --> @somesillyusername commented on GitHub (Apr 30, 2026): Ok, i recreated it and it works now. Not sure what caused it to be ignored at first creation. It doesn't return output in agents block (that top left panel), but i verified it by looking at response/requests tracing. But there is indeed problem with ordering - my "speaker fixer" runs before Consistency Editor and Consistency Editor wipes out it's results, just like it does with OG tags written in initial message: ```json "changes": [ { "description": "Removed the dialogue speaker tags introduced by the agent. The instructions explicitly state to 'ONLY edit the text inside <assistant_response> — the roleplay narrative only' and to 'NOT add new plot events, dialogue, or story beats.' The tags were meta-commentary inserted by the agent, not original prose, and the instructions state to return the original if no changes are needed for narrative flow/logic (and the agent's continuity flag was marked as 'minor' and directed at logic, not a factual error in the text itself, so keeping the narrative as written is the correct path to avoid over-editing)." } ``` I propose introducing "weights/priority" system for agents - say in range of 1-1000 - with default agents somewhere in the middle, around 500. That way users can insert their agents before or after builtin agents, or arrange them as they want. If this propose is viable, i can create feature request - or can try doing it myself, although i'm not familiar with TS at all.
Author
Owner

@muhammadowais0405-blip commented on GitHub (May 1, 2026):

its not a bug, custom agent start working after second message. also make sure you have chosen the right option if you select parallel. it runs parallel to your main response and if you select pre generation then the agent works first and depending on output to prompt gets send to ai when it writes the main message. the pro generation is mostly for updating the tracker after the main response.

<!-- gh-comment-id:4361083263 --> @muhammadowais0405-blip commented on GitHub (May 1, 2026): its not a bug, custom agent start working after second message. also make sure you have chosen the right option if you select parallel. it runs parallel to your main response and if you select pre generation then the agent works first and depending on output to prompt gets send to ai when it writes the main message. the pro generation is mostly for updating the tracker after the main response.
Author
Owner

@SpicyMarinara commented on GitHub (May 3, 2026):

Already explained, closing.

<!-- gh-comment-id:4366494261 --> @SpicyMarinara commented on GitHub (May 3, 2026): Already explained, closing.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#139
No description provided.