Skip to content

Fix/cache handling#36

Open
MohamedAkbarally wants to merge 7 commits intomainfrom
fix/cache_handling
Open

Fix/cache handling#36
MohamedAkbarally wants to merge 7 commits intomainfrom
fix/cache_handling

Conversation

@MohamedAkbarally
Copy link
Copy Markdown
Contributor

@MohamedAkbarally MohamedAkbarally commented Mar 14, 2026

Changes

This PR improves how Stirrup handles structured assistant/tool output.

It adds MCP image support, extends image handling to WebP, adds assistant message metadata and generated ids, and fixes interrupt caching so partial runs are only cached when cache_on_interrupt is enabled.

Features

MCP image output support

Preserves structured image content returned from MCP tools instead of flattening tool output to text, so image results can flow through the agent/message pipeline correctly.

Relevant files:

  • src/stirrup/tools/mcp.py
  • src/stirrup/core/models.py
  • tests/test_mcp_image_smoke.py
  • tests/test_agent.py

WebP support

Adds image/webp support to image content handling and expands test coverage around image-preserving tool execution.

Relevant files:

  • src/stirrup/core/models.py
  • tests/test_mcp_image_smoke.py
  • tests/test_agent.py

Assistant message metadata and ids

Adds metadata support on AssistantMessage, forwards that metadata through OpenAI-style message serialization, and generates ids for assistant messages.

Relevant files:

  • src/stirrup/core/models.py
  • src/stirrup/clients/utils.py
  • tests/test_clients_utils.py

Cache handling fix

Makes teardown respect cache_on_interrupt, so interrupted or incomplete runs are only written to cache when that behavior is explicitly enabled.

Relevant files:

  • src/stirrup/core/agent.py

Tests

Adds regression coverage for MCP image handling, assistant metadata serialization, generated assistant ids, and image-preserving tool execution.

Relevant files:

  • tests/test_agent.py
  • tests/test_clients_utils.py
  • tests/test_mcp_image_smoke.py

Comment thread src/stirrup/tools/mcp.py
Comment thread src/stirrup/tools/mcp.py
Copy link
Copy Markdown
Collaborator

@declanjackson declanjackson left a comment

Choose a reason for hiding this comment

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

lgtm, just left a couple small comments

@MohamedAkbarally MohamedAkbarally marked this pull request as ready for review April 1, 2026 05:59
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.

2 participants