Download cdk/docs/harness_local_stack.md from seanpedrickcase/document_redaction: direct link, hf CLI and curl.
- Browser
- Download file 3.91 kB
-
https://huggingface.co/spaces/seanpedrickcase/document_redaction/resolve/main/cdk/docs/harness_local_stack.md
- Command line
-
hf download hf://spaces/seanpedrickcase/document_redaction/cdk/docs/harness_local_stack.md
-
curl -L -o harness_local_stack.md https://huggingface.co/spaces/seanpedrickcase/document_redaction/resolve/main/cdk/docs/harness_local_stack.md
Minimal AgentCore Harness stack (local app.py)
Use this when you want only the Bedrock AgentCore Harness and its supporting AWS resources—not ECS, VPC, Cognito, or the production redaction stack. Your machine runs app.py; AWS runs the agent loop; inline tools execute in your local Python process.
What gets created
| Resource | Purpose |
|---|---|
AWS::BedrockAgentCore::Harness |
Agent loop, Bedrock model, inline tool names (implementations are local), S3 skill |
| Skills S3 bucket | doc-redaction-harness skill for the harness execution role |
| Staging S3 bucket | Presigned URLs for optional parallel page review (stage_page_review_bundles) |
| IAM managed policy | InvokeHarness + staging-bucket S3 for your developer principal |
Bucket names default to doc-redact-harness-skills-<region>-<account> and doc-redact-harness-stage-<region>-<account> (override in config/harness_local.env).
Prerequisites
- AWS CDK CLI on PATH (
npm install -g aws-cdk; on Windows the script looks forcdk.cmd, or falls back tonpx aws-cdk) - Python deps from
cdk/requirements.txt cdk bootstrap aws://ACCOUNT/REGIONonce per account/region- Bedrock access to the harness model (default
anthropic.claude-sonnet-5; override withAGENTCORE_HARNESS_MODEL_ID) - Local app:
boto3>=1.44.3, Tesseract/Poppler as for normal redaction
Deploy
From the repository root (recommended):
python cdk/deploy_harness_local.py --profile YOUR_PROFILE --yes
Optional: merge stack outputs into config/app_config.env:
python cdk/deploy_harness_local.py --profile YOUR_PROFILE --yes --write-app-config
Manual CDK (from cdk/):
export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
export AWS_REGION=eu-west-2
cdk deploy DocRedactionHarnessLocal -a "python app_harness_local.py"
Copy cdk.json.harness_local.example to cdk.json if you want a dedicated output directory (cdk.out.harness_local) without touching the main app's cdk.json.
Inline tools: CDK sets Harness Tools: []. Schemas are sent on each InvokeHarness from app.py (tools/agentcore_harness_tools.json), with allowedTools: ["*"] so invoke-time inline functions reach the model (builtins-only AllowedTools on the resource is not enough). If inline tools are registered on the Harness Tools property, AgentCore runs them on the VM (Unknown tool, no client handoff). Redeploy after CDK changes: deploy_harness_local.py --yes.
After deploy
- IAM — In the IAM console, attach managed policy
DocRedactionHarnessLocalInvoker-<region>to the user or role your AWS CLI / SSO session uses locally (outputLocalInvokerPolicyName). - App config — Set (or use
--write-app-config):USE_AGENTCORE=TrueAGENTCORE_HARNESS_ARN(outputRedactionHarnessArn)AGENTCORE_REGIONAGENTCORE_HARNESS_S3_STAGING_PREFIX(outputHarnessStagingPrefix)AGENTCORE_HARNESS_ENABLE_PAGE_REVIEW=True(orFalseto skip subagent page review)
- Run the app and use the AI agent redaction instructions box on the Redact tab.
Configuration
Copy config/harness_local.env.example to cdk/config/harness_local.env to override harness name, model id, iteration limits, bucket names, or lifecycle days on the staging bucket.
Teardown
python cdk/deploy_harness_local.py --profile YOUR_PROFILE --destroy --yes
Skills and staging buckets use RemovalPolicy.DESTROY and auto_delete_objects for dev convenience.
Related
- Main-app harness design: agent-redact/agentcore/OPTIONS.md (Option 3)
- Full production harness (same harness helper, inside
RedactionStack):ENABLE_AGENTCORE_HARNESSincdk_install.py