Skip to content

Conversation

@Chesars
Copy link
Contributor

@Chesars Chesars commented Oct 3, 2025

Summary

Makes the action parsing regex configurable.

Changes

  • Add action_regex field to AgentConfig
  • Update parse_action() to use self.config.action_regex
  • Add documentation with XML example

Usage

agent:
  action_regex: "<action>(.*?)</action>"
  system_template: |
    Use <action> tags for commands.
    <action>ls -la</action>

No breaking changes.

Resolves #144

Allow users to customize action parsing by setting the `action_regex`
field in AgentConfig. This enables support for different output formats
like XML tags instead of markdown code blocks.

Changes:
- Add `action_regex` field to AgentConfig with default markdown pattern
- Update `parse_action()` to use `self.config.action_regex`
- Add documentation in yaml_configuration.md with XML example

Fixes SWE-agent#144
Copy link
Member

@klieret klieret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this, especially for also taking care of documentation.

So far we never needed this, but I guess with minimax2 absolutely refusing to do the triple-backtick formatting, this becomes relevant, so let me merge this.

It would also allow us to avoid issues with mini not being able to edit readme files that contain ```bash by switching to another regex without breaking backwards compatibility

@klieret klieret merged commit 3620913 into SWE-agent:main Nov 21, 2025
5 checks passed
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/minisweagent/agents/default.py 97.46% <100.00%> (+0.03%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Chesars
Copy link
Contributor Author

Chesars commented Nov 21, 2025

Thank you for this, especially for also taking care of documentation.

So far we never needed this, but I guess with minimax2 absolutely refusing to do the triple-backtick formatting, this becomes relevant, so let me merge this.

It would also allow us to avoid issues with mini not being able to edit readme files that contain ```bash by switching to another regex without breaking backwards compatibility

Hi Kilian. You’re right, and I didn’t know that Minimax2 require another output format for bash commands and it’s true that it will improve mini to edit files in Markdown like ```bash. Thanks to you!

@Chesars Chesars deleted the feat/configurable-action-regex branch November 21, 2025 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow to change action parsing to XML

2 participants