DEV Community

Cover image for Porting an ADK Research and Judge Loop to Strands on Bedrock AgentCore, With A2A 1.x
xbill Subscriber for AWS Community Builders

Posted on

Porting an ADK Research and Judge Loop to Strands on Bedrock AgentCore, With A2A 1.x

This article provides a step by step guide to porting a Google ADK multi-agent system to Strands Agents on Amazon Bedrock. A researcher searches the web, a judge passes or fails the research for up to three rounds, and a content builder turns the approved research into a course. Each agent is its own A2A service on Amazon Bedrock AgentCore Runtime, and the original web app runs unchanged on Amazon ECS Express Mode.

Repository: https://github.com/xbill9/strands-bedrock-research-loop


What Is Being Ported?

The source is the course creator in multi-agent-loop, an update of Google's ADK 2.0 and A2A codelab. Four ADK services: a researcher with google_search, a judge with a Pydantic output schema, a content builder, and an orchestrator that wires them together with SequentialAgent and LoopAgent.

The port keeps the prompts word for word, keeps the judge's JudgeFeedback schema, keeps the three-round limit, and keeps the web app's frontend file for file. Everything underneath changes:

ADK on Google Cloud Strands on AWS
SequentialAgent(LoopAgent(...), content_builder) One Strands GraphBuilder graph
output_schema=JudgeFeedback structured_output_model=JudgeFeedback
google_search Amazon Nova Web Grounding (nova_grounding)
RemoteA2aAgent Strands A2AAgent
gemini-3-flash-preview us.amazon.nova-2-lite-v1:0
Cloud Run AgentCore Runtime and ECS Express Mode

At This Point You Should Have

  • An AWS account with Amazon Bedrock access to Amazon Nova 2 Lite in us-east-1.
  • The AWS CLI signed in (aws login works; the containers get its short-lived session).
  • Docker.
  • Python 3 with pip, to build the AgentCore code package.
  • make. The repository wraps every step below in one target.

Why Strands From a Pull Request?

The ADK version runs on a2a-sdk 1.x. Released Strands pins the 0.3 line:

1.67.0 2026-11-25 ['a2a-sdk<0.4.0,>=0.3.0; extra == "a2a"']
a2a-sdk 0.3.26 2026-04-09
a2a-sdk 1.0.0 2026-04-20
a2a-sdk 1.3.1 2026-11-17
Enter fullscreen mode Exit fullscreen mode

a2a-sdk 1.0 replaced the Pydantic types with protobuf types, so TextPart, DataPart and FilePart became one Part, and the message method became SendMessage. Strands has the migration written in harness-sdk PR #3923, open since 2026-08-21. This port runs that pull request at a pinned commit:

PR 3923 OPEN opened 2026-08-21T17:34:58Z head 95477761ec3837f68ddf540bf5e766cf431fcaf1
Enter fullscreen mode Exit fullscreen mode

Step 1 — Build Strands From the Pull Request

One base image carries Strands from the pinned commit and a2a-sdk 1.3.1. The version is set by hand because the build reads it from git tags the fork does not have.

FROM python:3.14-slim
RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
ARG STRANDS_SHA=95477761ec3837f68ddf540bf5e766cf431fcaf1
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_STRANDS_AGENTS=1.66.0+pr3923 \
    SETUPTOOLS_SCM_PRETEND_VERSION=1.66.0+pr3923 \
    PYTHONUNBUFFERED=1
RUN pip install --no-cache-dir \
      "strands-agents[a2a] @ git+https://github.com/waitasecant/harness-sdk@${STRANDS_SHA}#subdirectory=strands-py" \
      "a2a-sdk[http-server]>=1.3.1,<2" uvicorn fastapi boto3
Enter fullscreen mode Exit fullscreen mode

What the image holds:

python 3.14.10
strands-agents 1.66.0+pr3923
a2a-sdk 1.3.1
boto3 1.44.12
fastapi 0.165.0
uvicorn 0.54.0
Enter fullscreen mode Exit fullscreen mode

Step 2 — Port the Judge: Same Prompt, Same Schema

The judge moves over with one renamed argument. ADK's instruction is Strands' system_prompt, and ADK's output_schema is Strands' structured_output_model. The Pydantic class is copied as is.

class JudgeFeedback(BaseModel):
    """Structured feedback from the Judge agent."""

    status: Literal["pass", "fail"] = Field(
        description="Whether the research is sufficient ('pass') or needs more work ('fail')."
    )
    feedback: str = Field(
        description="Detailed feedback on what is missing or needs clarification if status is 'fail'. If 'pass', a brief confirmation."
    )


judge = Agent(
    name="judge",
    model=model(),
    description="Evaluates research findings for completeness and accuracy.",
    system_prompt="""
    You are a strict editor and fact-checker.
    ...
    """,
    structured_output_model=JudgeFeedback,
    callback_handler=None,
)
Enter fullscreen mode Exit fullscreen mode

The judge's reply text is the JSON of that object, so the verdict crosses A2A as plain text and the orchestrator parses status out of it, the same way ADK's EscalationChecker did.


Step 3 — Replace google_search With Nova Web Grounding

Amazon Nova has a built-in web search tool, nova_grounding, turned on with a systemTool entry in the Converse request. Nova runs the search on the server side and returns the answer with citations:

secs 4.8 stop end_turn usage {'inputTokens': 142, 'outputTokens': 177, 'totalTokens': 319}
['toolUse'] {"toolUse": {"toolUseId": "...", "name": "nova_grounding", "input": {"query": "AWS Nitro Sandboxes announcement November 2026"}, "type": "server_tool_use"}}
['toolResult'] {"toolResult": {"toolUseId": "...", "content": [{"text": "[HIDDEN]"}], "status": "success", "type": "nova_grounding_result"}}
['text'] {"text": "On November 9, 2026, AWS announced ..."}
['citationsContent'] {"citationsContent": {"citations": [{"location": {"web": {"url": "https://aws.amazon.com/about-aws/whats-new/2026/11/nitro-sandboxes-eks-ecs-ec2/", ...
Enter fullscreen mode Exit fullscreen mode

The researcher wraps that call in an ordinary Strands tool, which returns the grounded text and a list of the cited URLs:

@tool
def web_search(query: str) -> str:
    """Search the web and return a grounded answer with its source URLs.

    Args:
        query: What to look up.
    """
    resp = _bedrock.converse(
        modelId=MODEL_ID,
        messages=[{"role": "user", "content": [{"text": query}]}],
        toolConfig={"tools": [{"systemTool": {"name": "nova_grounding"}}]},
    )
    text, urls = [], []
    for block in resp["output"]["message"]["content"]:
        if "text" in block:
            text.append(block["text"])
        for c in block.get("citationsContent", {}).get("citations", []):
            url = c.get("location", {}).get("web", {}).get("url")
            if url and url not in urls:
                urls.append(url)
    return "".join(text) + "\n\nSources:\n" + "\n".join(f"- {u}" for u in urls)
Enter fullscreen mode Exit fullscreen mode

🔎 Tip: Strands Runs Bedrock Server-Side Tools as Local Tools

Passing nova_grounding straight to a Strands agent through BedrockModel(additional_args={"toolConfig": ...}) fails. Strands sees the toolUse block, changes the stop reason, and looks for a local tool of that name. The model keeps searching, and Strands then sends the citations back in a shape Bedrock refuses:

python 3.14.10
WARNING:strands.event_loop.streaming:original_stop_reason=<end_turn>, new_stop_reason=<tool_use> | overriding stop reason due to toolUse blocks in response
ERROR:strands.tools.executors._executor:tool_name=<nova_grounding>, available_tools=<[]> | tool not found in registry
ERROR:strands.tools.executors._executor:tool_name=<nova_grounding>, available_tools=<[]> | tool not found in registry
ERROR:strands.tools.executors._executor:tool_name=<nova_grounding>, available_tools=<[]> | tool not found in registry
ERROR:strands.tools.executors._executor:tool_name=<nova_grounding>, available_tools=<[]> | tool not found in registry
botocore.errorfactory.ValidationException: An error occurred (ValidationException) when calling the ConverseStream operation: This model doesn't support the citationsContent.content field for assistant messages. Remove citationsContent.content and try again.
Enter fullscreen mode Exit fullscreen mode

Strands' pull request for Bedrock system tools (#1318) was closed on 2026-07-28 with the comment "Closing stale PR". The @tool wrapper in Step 3 keeps the server-side call inside one Converse request, where Strands never sees it.


Step 4 — Port the Content Builder and Give It Room

The content builder is a prompt and a model, so it ports in a few lines. One setting matters: a whole course does not fit in Nova 2 Lite's default output limit. The same research, the same prompt, with and without an explicit limit:

python 3.14.10 | model us.amazon.nova-2-lite-v1:0
default limit: MaxTokensReachedException: Model stopped generating due to maximum token limit. ...
max_tokens=10000: stop=end_turn output_tokens=2313 secs=13.1
Enter fullscreen mode Exit fullscreen mode

Every agent's model gets the explicit limit:

MAX_TOKENS = int(os.environ.get("MAX_TOKENS", "10000"))


def model() -> BedrockModel:
    return BedrockModel(model_id=MODEL_ID, region_name=REGION, max_tokens=MAX_TOKENS)
Enter fullscreen mode Exit fullscreen mode

Step 5 — Rebuild the Loop as a Strands Graph

ADK expresses the loop with three orchestration agents. Strands expresses it as one graph with conditional edges:

def build_graph():
    b = GraphBuilder()
    b.add_node(remote("researcher", "http://localhost:8001/"), "researcher")
    b.add_node(remote("judge", "http://localhost:8002/"), "judge")
    b.add_node(remote("content_builder", "http://localhost:8003/"), "content_builder")
    b.add_edge("researcher", "judge")
    b.add_edge("judge", "researcher", condition=failed)
    b.add_edge("judge", "content_builder", condition=passed)
    b.add_edge("researcher", "content_builder", condition=passed)
    b.set_entry_point("researcher")
    b.set_max_node_executions(2 * MAX_ROUNDS + 1)
    b.reset_on_revisit(True)
    return b.build()
Enter fullscreen mode Exit fullscreen mode

Each remote agent is a Strands A2AAgent, which is a graph node like any local agent. A node's input is the original task plus the output of every finished upstream node whose edge condition holds, so on a fail the researcher receives the judge's feedback, and on a pass the content builder receives both the research and the verdict. The extra researcher → content_builder edge is what hands it the research.


🔎 Tip: Cap the Rounds in the Edge Condition

set_max_node_executions counts every node run, and when the graph reaches it the run ends as FAILED. ADK's LoopAgent ends cleanly after its last round. To match it, the fail edge counts the judge's runs itself:

def failed(state) -> bool:
    """Loop back only while rounds remain: ADK's LoopAgent stops after max_iterations."""
    return verdict(state) == "fail" and judge_runs(state) < MAX_ROUNDS
Enter fullscreen mode Exit fullscreen mode

After the third fail, no edge out of the judge holds, and the graph completes with no course.


Step 6 — Run It Locally

make local builds both images, exports the AWS session for the containers, and starts the three agents and the web app with Docker Compose:

make local
Enter fullscreen mode Exit fullscreen mode

One run of the orchestrator on "Curling":

status=Status.COMPLETED total_s=16.4 order=['researcher', 'judge', 'content_builder']
  researcher          6.3 s
  judge               1.1 s
  content_builder     8.9 s
judge_verdict=pass
Enter fullscreen mode Exit fullscreen mode

The web app at http://localhost:8000 is the ADK frontend with a new backend. It runs the graph in process and turns the graph's node start and stop events into the progress lines the frontend already reads:

progress 🔍 Researcher is gathering information... (round 1)
progress ⚖️ Judge is evaluating findings... (round 1)
progress ⚖️ Judge verdict: pass
progress ✍️ Content Builder is writing the course...
result # Comprehensive Curling Course  ## Introduction to Curling ...
Enter fullscreen mode Exit fullscreen mode

Step 7 — Test the Fail Path

A judge that passes everything leaves the loop untested. tests/fail_judge.py is a stand-in judge that fails every submission, and make test points the orchestrator at it:

make test
Enter fullscreen mode Exit fullscreen mode
status=Status.COMPLETED total_s=31.2 order=['researcher', 'judge', 'researcher', 'judge', 'researcher', 'judge']
  researcher          7.2 s
  judge               0.7 s
  researcher         12.6 s
  judge               0.7 s
  researcher          9.4 s
  judge               0.5 s
judge_verdict=fail

(no course: the judge never passed the research)
Enter fullscreen mode Exit fullscreen mode

Three rounds, a clean stop, and no course. The researcher's searches follow the judge's feedback, which asked for more detail on the rules:

INFO:researcher:web_search query='Curling' sources=6 secs=3.8
INFO:researcher:web_search query='curling rules detailed explanation' sources=5 secs=3.7
INFO:researcher:web_search query='curling rules detailed explanation' sources=5 secs=6.1
Enter fullscreen mode Exit fullscreen mode

Step 8 — Serve Each Agent on AgentCore Runtime

AgentCore's A2A contract is a server on port 9000, A2A at /, and a /ping health check. The Strands A2A server covers the first two; one route adds the third:

on_agentcore = os.environ.get("ON_AGENTCORE") == "1"
port = 9000 if on_agentcore else port
public_url = os.environ.get("PUBLIC_URL", f"http://localhost:{port}/")
server = A2AServer(agent=agent, host="0.0.0.0", port=port, http_url=public_url, serve_at_root=True)
app = server.to_fastapi_app()

@app.get("/ping")
def ping():
    return {"status": "Healthy"}
Enter fullscreen mode Exit fullscreen mode

AgentCore runs ARM64. infra/build_zip.sh builds the Strands wheel from the pinned commit and installs everything for manylinux aarch64 and Python 3.14 (PYTHON_3_14) into one code package, so no ARM64 Docker build is needed. infra/deploy_agents.sh uploads it and creates three runtimes with serverProtocol: A2A and IAM inbound auth. What AgentCore reports for them:

srl_researcher  READY   V2  PYTHON_3_14 A2A-Version
srl_judge   READY   V2  PYTHON_3_14 A2A-Version
srl_content_builder READY   V2  PYTHON_3_14 A2A-Version
Enter fullscreen mode Exit fullscreen mode

The agent card must advertise the runtime's own invocation URL, because the A2A client sends its messages to the URL in the card. That URL contains the runtime ARN, so each runtime is created first and then updated with PUBLIC_URL set.


🔎 Tip: Allowlist the A2A-Version Header

An a2a-sdk 1.x client sends A2A-Version: 1.0 with every call, and an a2a-sdk 1.x server treats a call without that header as version 0.3. AgentCore passes only allowlisted request headers through to the runtime. With the allowlist removed from the researcher, every call is refused, and with it back the runtime accepts them:

srl_researcher-KG3wumEycS READY allowlist: None
node_id=<researcher>, error=<A2A version '0.3' is not supported by this handler. Expected version '1.0'.> | node failed
srl_researcher-KG3wumEycS READY allowlist: ['A2A-Version']
Enter fullscreen mode Exit fullscreen mode

The setting on each runtime:

--request-header-configuration '{"requestHeaderAllowlist": ["A2A-Version"]}'
Enter fullscreen mode Exit fullscreen mode

The same loop through AgentCore, called from a laptop. This time the judge failed the first round and passed the second:

status=Status.COMPLETED total_s=34.6 order=['researcher', 'judge', 'researcher', 'judge', 'content_builder']
  researcher          6.5 s
  judge               6.5 s
  researcher          7.2 s
  judge               1.3 s
  content_builder    13.0 s
judge_verdict=pass
Enter fullscreen mode Exit fullscreen mode

Step 9 — Sign the Calls and Put the Web App on ECS Express Mode

Every call to an AgentCore runtime carries a SigV4 signature. The orchestrator reuses the signer from Strands to Strands over A2A on Bedrock AgentCore and hands it to A2AAgent as its HTTP client:

region = arn.split(":")[3]
http, _ = signed_client(boto3.Session(region_name=region), region, timeout=300.0)
return A2AAgent(endpoint=runtime_url(arn, region), name=name, client_config=ClientConfig(httpx_client=http))
Enter fullscreen mode Exit fullscreen mode

infra/deploy_ui.sh pushes the web app image to Amazon ECR and runs it on ECS Express Mode. The task role may call InvokeAgentRuntime and GetAgentCard on the three runtimes and nothing else. Express Mode prints an HTTPS endpoint, and the whole deployment is one command:

make deploy
make url
Enter fullscreen mode Exit fullscreen mode
=== 3/4 ECS Express Mode service ===
=== 4/4 endpoint ===
https://sr-1ba486a6fd3b4b38aaa010d72429617c.ecs.us-east-1.on.aws
Enter fullscreen mode Exit fullscreen mode

One course requested through that endpoint, as the browser sees the stream:

progress 🔍 Researcher is gathering information... (round 1)
progress ⚖️ Judge is evaluating findings... (round 1)
progress ⚖️ Judge verdict: fail
progress 🔍 Researcher is gathering information... (round 2)
progress ⚖️ Judge is evaluating findings... (round 2)
progress ⚖️ Judge verdict: pass
progress ✍️ Content Builder is writing the course...
result # Comprehensive Course: Mastering the Sport of Curling ...
Enter fullscreen mode Exit fullscreen mode

🔎 Tip: A Remote Failure Arrives as a Reply

When a remote agent fails, A2AAgent returns the text Agent execution failed as an ordinary reply, and the graph reports success. A content builder started with MAX_TOKENS=200 fails on its side, and the graph still completes; only the orchestrator's own check on that text reports it:

content builder started with MAX_TOKENS=200
status=Status.COMPLETED total_s=9.2 order=['researcher', 'judge', 'content_builder']
  researcher          6.6 s
  judge               1.1 s
  content_builder     1.5 s
judge_verdict=pass
content_builder FAILED on the remote side
Enter fullscreen mode Exit fullscreen mode

The content builder's own log holds the cause, raise MaxTokensReachedException(. The web app makes the same check and shows an error.


Compare and Contrast: ADK or Strands?

ADK 2 Strands (PR #3923)
Loop LoopAgent plus an escalation agent Graph with conditional edges
Round limit max_iterations ends cleanly Count rounds in the edge condition
Structured judge output_schema structured_output_model
Web search google_search, a native tool nova_grounding inside a @tool
A2A 1.x Released Unmerged pull request
Hosting Cloud Run AgentCore Runtime and ECS Express Mode

So, Which One?

🥇 For a loop of remote agents, the Strands graph says more in less code: three nodes and four edges replace three orchestration agents, and the routing is plain Python. 🥈 ADK's LoopAgent is the shorter route when the round limit is all the logic there is. On AWS today, Strands with A2A 1.x means running an unmerged pull request; the released Strands with a2a-sdk 0.3 is the choice for anything long-lived.


Teardown

The web app is public with no sign-in, and every course is billed to the account. One command removes the ECS service, the three runtimes, the ECR repository, the code bucket and both IAM roles:

make destroy
Enter fullscreen mode Exit fullscreen mode
deleted ECS service srl-web
deleted runtime srl_researcher-KG3wumEycS
deleted runtime srl_judge-BGS7R9CY4i
deleted runtime srl_content_builder-3ifzo86lPV
deleted ECR repo srl-web
deleted code bucket
deleted role srl-web-task
deleted role srl-agentcore-exec
Enter fullscreen mode Exit fullscreen mode

Summary

The goal of this article was to port an ADK research, judge and course loop to Strands on Amazon Bedrock. The key to the solution was a Strands graph over three A2A agents on AgentCore Runtime, with Nova Web Grounding standing in for Google Search. The results were:

  • 🟢 The judge's prompt and Pydantic schema carried over unchanged, and its verdict crossed A2A as JSON text.
  • 🟢 One graph replaced SequentialAgent, LoopAgent and the escalation agent; the fail path ran three rounds in 31.2 s and stopped with no course.
  • 🟢 Through AgentCore Runtime the loop took 34.6 s for two rounds and a course, and the public web app ran a two-round course end to end.
  • ❌ Strands treats Bedrock's nova_grounding as a missing local tool; it works inside a @tool that calls Converse.
  • ❌ AgentCore drops the A2A-Version header unless it is allowlisted, and a2a-sdk 1.x then refuses every call as version 0.3.
  • ⚠️ A2A 1.x in Strands comes from an unmerged pull request, and a failed remote agent comes back as a successful reply.

Scope: one AWS account in us-east-1 on 2026-11-27, Amazon Nova 2 Lite (us.amazon.nova-2-lite-v1:0) for all three agents, Python 3.14 everywhere (3.14.10 in the containers, PYTHON_3_14 on AgentCore, platform V2), Strands built from harness-sdk commit 95477761 with a2a-sdk 1.3.1. Each timing is a single run on "Curling": the local runs in Docker on one laptop, the AgentCore run called from the same laptop. The model's searches and verdicts vary between runs, so the times and round counts will too.

The strategy for porting an ADK multi-agent loop to Strands on Bedrock was validated with an incremental step by step approach.


References

Top comments (2)

Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

Keeping the prompts word for word is the honest control here — it isolates the framework as the only variable, which most ports never bother to do. The pinned-PR detail is the part that would bite in production: running Strands from an unmerged PR at a pinned commit is fine for a guide, but it's a dependency with no release cadence. Did the three-round judge loop behave the same on Nova 2 Lite as on Gemini Flash, or did the model swap change the fail/pass rate?

Collapse
 
princejain756 profile image
Prince Jain •

The requestHeaderAllowlist catch for A2A-Version on AgentCore Runtime saves a lot of head scratching. AgentCore stripping non-allowlisted headers so an a2a-sdk 1.x server downgrades the call to 0.3 and rejects it is the exact failure that burns an hour before you look at runtime config.

We ran into two sibling snags wiring Bedrock AgentCore and A2A 1.0/0.3 in LiteLLM recently. First, message/send and message/stream signed cleanly over SigV4, while task calls like tasks/get, tasks/cancel, and tasks/resubscribe initially missed the provider path and fell back to plain unsigned forwarding. Second, once you put auth metadata on agent cards, a2a-sdk 1.0 protobuf parsing rejects flat 0.3 securitySchemes and security fields unless they wrap into oneof entries and securityRequirements (with apiKey in renamed to location), which tripped me up on persisted cards.

On the 3-runtime loop, did you need X-Amzn-Bedrock-AgentCore-Runtime-Session-Id in requestHeaderAllowlist for multi-round retries, or did each researcher and judge round run fine as a stateless SendMessage call?