feat(export): build exported harness agents with Strands Harness - #2486
Open
amhegazy-mp4 wants to merge 1 commit into
Open
amhegazy-mp4 wants to merge 1 commit into
amhegazy-mp4 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2486 +/- ##
=========================================
Coverage 97.39% 97.40%
=========================================
Files 642 642
Lines 46807 46854 +47
=========================================
+ Hits 45590 45638 +48
+ Misses 1217 1216 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Exported agents now reproduce how the harness runtime builds agents: strands_harness.create_harness() with its defaults off and each capability passed explicitly, instead of a bare Strands Agent with hand-written tools. The construction lives in a generated harness_runtime.py module. - Built-in tools: sandbox-routed shell, Strands Harness read/write/edit, and markdown web_fetch, each gated by allowedTools. - Plugins: todos (todo_write) and a context offloader (retrieve_offloaded_content) that never evicts entries. - Subagent tool: a generalist child that can use the parent's built-in and MCP tools and gets only the plugins it selects. - One invocation budget, passed in the invocation state, is shared by the agent and its subagents; a limit ends the invocation with max_iterations_exceeded or max_output_tokens_exceeded. With the subagent tool enabled, usage is reported once per invocation, including the subagents'; otherwise per model call. - MCP tools are prefixed with their server name so they cannot collide with the built-ins. - Defaults when unset: the Strands Harness contract prompt and summarization truncation; Bedrock Converse models cache prompts and tools unless the model parameters already place a cache point. - Pins strands-agents ~= 1.57.1 and strands-harness == 0.1.2.
amhegazy-mp4
force-pushed
the
feat/strands-harness-export-refactor
branch
from
September 30, 2026 21:18
6b26693 to
4c46a27
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
agentcore export harnessnow builds the exported agent the way the harness runtime does:strands_harness.create_harness()with its defaults turned off and each capability passed explicitly, instead of a bare StrandsAgentwith hand-written tools. The construction lives in a new generated module,harness_runtime.py.shell, the Strands Harnessread/write/edit, andweb_fetchin markdown mode, each gated byallowedTools(file_operationsstill grantsread/write/edit).todo_write(todos) andretrieve_offloaded_content(a context offloader that keeps large tool results on disk per session and never evicts them).subagenttool delegates to a generalist child that can use the agent's built-in and MCP tools, gets only the plugins it selects, has no session manager, and cannot delegate further.maxIterations/maxTokensend the invocation withmax_iterations_exceeded/max_output_tokens_exceeded. With the subagent tool enabled, usage is reported once per invocation including subagents; otherwise per model call.<server>_<tool>), as in the harness, so they cannot collide with the built-ins.summary_ratio0.3,preserve_recent_messages10). Bedrock Converse models cache the system prompt and tools unless the model parameters already place a cache point.strands-agents ~= 1.57.1andstrands-harness == 0.1.2.Known differences from the harness: shell and file tools run on the runtime host rather than in a container sandbox, offloaded results have no per-session size cap, and tool names are not shortened to fit Bedrock's 64-character limit.
Related Issue
Closes #2485
Documentation PR
Not applicable.
Type of Change
Testing
bun testbun run test:e2e, or explained why they are not applicable: there are no export end-to-end tests. Instead I rendered 14 harness shapes (all built-ins with limits, none, subagent only, each plugin alone, inline functions with and without MCP and a timeout, S3 skills, memory, no truncation); each passespyflakesandpy_compileand builds an agent against the pinned packages. I also ran exports against Bedrock with a local MCP server:@mcp/toolfiltering, subagent delegation with context offloading, the shared iteration limit, a timeout cancelling a running subagent, and an inline function handoff.bun run typecheckbun run lint:checkbun run format:checkbun run buildsrc/assets/, I updated affected snapshots withbun test <test-file> --update-snapshotsand committed them (no snapshots changed)Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.