Skip to content

Bedrock Runtime: InvokeModel not supported #281

Closed

Description

@scttfrdmn

Summary

Substrate's Bedrock Runtime plugin does not implement the InvokeModel operation. Calls to /model/{modelId}/invoke return:

BedrockRuntimePlugin: unsupported path /model/anthropic.claude-sonnet-4-20250514-v1:0/invoke

Context

The quick-suite-claws project's plan tool handler calls bedrock-runtime:InvokeModel to generate query plans via an LLM. Integration tests that exercise the plan→excavate pipeline fail because Substrate doesn't emulate this endpoint.

Affected tests (8 failures in CI):

  • test_v1_collaboration.py::TestTeamIdOnPlans (2 tests) — plan creation with team_id
  • test_v1_collaboration.py::TestSharePlan (4 tests) — plan sharing + excavation
  • test_runner.py::TestWatchRunner (2 tests) — watch runner executing locked plans

All pass when run against real AWS Bedrock.

Expected behavior

InvokeModel at /model/{modelId}/invoke should accept a JSON body with prompt or messages and return a stubbed/canned response. The response doesn't need to be a real LLM completion — a deterministic fixture response is sufficient for integration testing.

Minimum viable implementation

A stub that:

  1. Accepts POST to /model/{modelId}/invoke
  2. Returns a valid InvokeModelResponse with a canned body (e.g. {"completion": "SELECT * FROM table"})
  3. Supports the contentType/accept headers

This would unblock all claws integration tests and any other project using Bedrock for LLM inference in their test suites.

Workaround

Currently these tests are allowed to fail in CI. The test job (lint + CDK synth) passes; only the integration job fails.

Activity

  1. scttfrdmn commented on Apr 10, 2026

    @scttfrdmn
    OwnerAuthor

    Update after testing v0.58.1

    The unsupported path error is resolved — InvokeModel now responds. However, the response body format doesn't match what Anthropic Claude models return via the Messages API.

    Expected response body format (Anthropic Claude on Bedrock):

    {
      "content": [{"type": "text", "text": "...generated text..."}],
      "stop_reason": "end_turn",
      "usage": {"input_tokens": 100, "output_tokens": 50}
    }

    What claws expects: response["body"].read() → JSON with content[].type == "text" blocks (line 164-186 in tools/plan/handler.py).

    The stub needs to return a response body that matches this Anthropic Messages API format. Currently getting "Failed to parse model response" because result.get("content", []) returns no text blocks.

    Could the stub return a canned response like:

    {
      "content": [{"type": "text", "text": "{\"query\": \"SELECT 1\", \"output_schema\": {}}"}],
      "stop_reason": "end_turn"
    }
  2. scttfrdmn commented on Apr 10, 2026

    @scttfrdmn
    OwnerAuthor

    Ignore my previous comment about the response format — that's wrong. Bedrock InvokeModel is model-agnostic; the request/response body is opaque bytes defined by each model provider. Substrate can't and shouldn't hardcode Anthropic's Messages API schema.

    The right fix is on the claws side: collaboration tests should mock bedrock_runtime for LLM calls (same as the plan handler's own unit tests already do) rather than expecting Substrate to return a valid Anthropic response.

    This issue can be closed — InvokeModel support in v0.58.1 is working as expected. The remaining test failures are a test design problem on the claws side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions