Export harness to code
Export harness to code takes a managed harness configuration and generates the equivalent agent as editable Python source code using the Strands framework. The generated agent is a normal AgentCore runtime agent: you own the code, can modify it freely, and deploy it like any other agent. The generated agent mirrors the harness’s model, tools, skills, memory, execution limits, and filesystem mounts.
When to Use Export
Use export when you have a working harness and want to:
-
Customize beyond what the harness config allows - add custom tool logic, change the agent loop, inject middleware/hooks, or integrate libraries the harness doesn’t expose
-
Own the code - move from a declarative config to source code you control, review, and version like the rest of your application.
-
Graduate a prototype - start fast with a harness, then export when you’re ready to invest in a hand-maintained agent.
If the harness configuration already does everything you need, you don’t have to export - keep running it as a harness.
What is supported today
-
Framework - Strands, with other frameworks like Claude Agents SDK coming soon
-
Language - Python only
-
Source - The harness must be part of an AgentCore CLI project
-
Build types - CodeZip (default) and Container
Harness features carried into the generated agent:
-
Model provider and config (Bedrock, OpenAI, Gemini - including model ID and API key references)
-
Tools - Remote MCP tools, Gateways, inline function tools, AgentCore Browser, AgentCore Code Interpreter, built-in
shellandfile_operationstools -
Memory
-
Execution limits
-
Conversation truncation
-
Skills (Path, S3, Git)
-
Filesystem mounts (session storage, EFS, S3) for VPC harnesses
-
Authorizer configuration
CLI Usage
Command Syntax
Example
Options
| Flag | Description | Default |
|---|---|---|
|
|
Name of the harness to export |
Required |
|
|
Name for the generated runtime agent |
|
|
|
Build type: |
|
|
|
Output results as JSON |
False |
Examples
Basic export with defaults:
Example
After export
Deploy the generated runtime agent using the AgentCore CLI.
Example
The exported agent is added as a normal runtime, so it deploys alongside the rest of your AgentCore CLI project.
EXPORT_NOTES.md
After every export, EXPORT_NOTES.md is written listing items requiring manual follow-up. Export writes notes to EXPORT_NOTES.md in the agent directory listing each item, why it needs attention, and exactly what to do. Always read EXPORT_NOTES.md before deploying.
Deployment Options
After exporting, you can deploy your agent to multiple hosting environments:
-
AgentCore Runtime (managed) - Use
agentcore deployto host in the AgentCore Runtime, which manages infrastructure, scaling, and credential provisioning automatically. -
Self-hosted - Deploy the generated Python agent anywhere that supports Python 3.12+:
-
AWS services: Lambda, ECS/Fargate, EC2
-
Kubernetes clusters
-
On-premise servers
-
Any containerized environment
-