Agents Build
AWSOfficialCreated by aws-agentcore
- Skill
- Workflow
- Cloud and DevOps
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The agents-build skill provides a structured workflow for adding advanced features to existing AgentCore projects. It acts as a central hub for configuring infrastructure and functional capabilities, such as cross-session memory, VPC connectivity, multi-agent delegation, and sandboxed code execution. The skill ensures project integrity by verifying the environment, checking for existing project configurations, and guiding the user through the appropriate implementation path based on their specific requirements.
What it does
- Adds cross-session memory to maintain user context.
- Configures VPC networking for secure access to private resources.
- Enables multi-agent systems with orchestrator-specialist patterns.
- Integrates browser and code interpreter tools for enhanced agent capabilities.
- Facilitates the migration of existing Bedrock Agents to AgentCore.
- Handles resource removal and project teardown.
When to use it
- When you need to expand an existing agent's functionality.
- When setting up private network connectivity for your agent.
- When transitioning from a single-agent to a multi-agent architecture.
- When you need to add sandboxed code execution or web browsing capabilities.
- When you need to clean up or remove specific agent resources.
Advantages
- Provides a consistent, guided workflow for complex configuration tasks.
- Prevents common errors by validating project context and naming conventions.
- Reduces manual setup time for infrastructure-heavy features like VPCs.
- Centralizes documentation and implementation steps for diverse agent capabilities.
Usage examples
- “add memory to my agent”
- The skill reads the project configuration and provides the necessary steps to implement cross-session memory storage.
- “I need to add a code interpreter to my agent”
- The skill guides you through the integration of the AgentCore Code Interpreter tool for sandboxed Python or JS execution.
- “how do I set up VPC connectivity?”
- The skill loads the VPC reference documentation and walks you through configuring subnets and security groups for your agent.
- “tear down my agent”
- The skill initiates the resource removal workflow to safely destroy the specified agent deployment.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/aws/agents-build/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip agents-build.zip -d .agents/skills
Documentation by aws-agentcore
build
Add capabilities to your AgentCore agent project.
When to use
Adding cross-session memory to your agent
Calling your deployed agent from a web app, mobile app, or backend service
Configuring VPC networking for private resources (RDS, internal APIs)
Building multi-agent systems with orchestrator/specialist patterns
Migrating an existing Bedrock Agent to AgentCore
Adding the Browser tool so the agent can navigate websites
Adding the Code Interpreter so the agent can execute code in a sandbox
Adding AgentCore Payments so the agent can pay for x402- or MPP-protected APIs, tools, or content
Removing resources from your project or tearing down a deployment
Do NOT use for:
Connecting to external tools/APIs via Gateway (OpenAPI specs, Lambda, MCP servers, credentials, policies) → use
agents-connectScaffolding a new project → use
agents-get-startedDeploying → use
agents-deploy
Input
$ARGUMENTS can be:
A capability: "memory", "integrate", "vpc", "multi-agent", "migrate", "browser", "code-interpreter", "payments", "teardown"
A description of what they want: "remember user preferences", "call from React app", "scrape a website", "run pandas in the agent", "delete my agent", "clean up resources"
Empty — the skill will determine the workflow from context
Process
Step 0: Verify CLI version
Run agentcore --version. This skill requires v0.9.0 or later.
If older: "Run agentcore update to get the latest version."
Step 1: Read project context
Read agentcore/agentcore.json to understand the current project — framework, existing resources, agent configuration.
If agentcore/agentcore.json is not found:
Check if the developer is in the wrong directory. Look for
agentcore/agentcore.jsonin parent directories (up to 3 levels). If found, tell them: "Found an AgentCore project at<path>. Are you working in that project?"If no project exists anywhere nearby, ask what capability they wanted to add. Then offer two paths:
"I can walk you through creating a project first and then adding CAPABILITY — want to do that?" (run the get-started flow inline, then continue with the build workflow)
"If you already have a project elsewhere,
cdinto it and try again."
Do not just say "go use agents-get-started" and stop — that loses the developer's context about what they actually wanted to do.
Step 2: Determine the workflow
Important disambiguation — before routing to a build reference, check if the prompt is actually a connect or debug concern:
If the phrase mentions external APIs, Lambda functions, OpenAPI specs, gateways, credentials, MCP servers, or policies → this is
agents-connect, not buildIf the developer says something is broken (wrong answers, errors, tool failures) → this is
agents-debug, not buildBuild is for adding new capabilities to a working project, not fixing broken ones
Based on the developer's prompt and $ARGUMENTS, load the appropriate reference:
| Developer intent | Reference to load |
|---|---|
| Add memory, remember things, user preferences, cross-session | references/memory.md |
| Call agent from app, invoke from code, streaming, SDK client, agent URL, execute shell in session | references/integrate.md |
| VPC, private network, RDS, internal API, subnet, security group | references/vpc.md |
| Multi-agent, orchestrator, specialist, A2A, delegation, agent handoff | references/multi-agent.md |
| Custom headers from caller to agent, header allowlist, tenant ID/correlation ID/trace propagation | references/request-headers.md |
| Migrate Bedrock Agent, import agent, move to AgentCore | references/migrate.md |
| Browser tool, web navigation, form filling, scraping, Nova Act, Playwright, live view | references/browser.md |
| Code Interpreter, execute code, sandbox, run Python/JS/TS, data analysis in agent, pandas | references/code-interpreter.md |
| Payments, pay for x402 or MPP content, 402 Payment Required, Machine Payments Protocol, WWW-Authenticate: Payment, microtransactions, paid API/tool, payment manager/connector | references/payments.md |
| Delete agent, remove resource, tear down, clean up, destroy, start fresh | references/teardown.md |
| Change model, switch model, use Haiku/Sonnet/Nova, different model | Inline — see "Changing the model" below |
If the developer asks about the difference between local dev and deployed (e.g., "why does my memory work after deploy but not locally?"), load references/local-vs-deployed.md alongside the specific workflow reference.
Read the matching file into context and follow its Process section step by step — do not summarize.
If the intent is ambiguous, ask the developer which capability they want to add.
Changing the model
The model is configured in app/<AgentName>/model/load.py (scaffolded by agentcore create). To change it:
Open
app/<AgentName>/model/load.pyChange the
model_idparameter in theBedrockModel()constructor
# Default (scaffolded by CLI)
return BedrockModel(model_id="global.anthropic.claude-sonnet-4-5-20250929-v1:0")
# Switch to Haiku for cost savings
return BedrockModel(model_id="us.anthropic.claude-3-5-haiku-20241022-v1:0")
# Switch to Nova Lite
return BedrockModel(model_id="amazon.nova-lite-v1:0")Cross-region inference profile prefixes (us., eu., apac., global.) control where inference runs. Use global. for maximum throughput, or a geographic prefix for data residency. Not all models support all prefixes — check the Bedrock inference profiles docs.
After changing the model:
Verify the model is enabled in your region: AWS Console → Amazon Bedrock → Model access
For cross-region profiles, enable in all destination regions
If using
agents-harden, update the IAM policy to scope to the new model ARNRun
agentcore devto test locally, thenagentcore deployto update the deployed agent
No agentcore.json change is needed — the model is configured in code, not in the project config.
Pre-flight: validate any --name before generating the CLI command
Whichever reference you load, most end up producing an agentcore add <resource> --name <something> command. The CLI fails late on invalid names — you'll see the error after walking through prompts, not before running the command. Validate up front:
| Resource | Max chars | Allowed | Starts with |
|---|---|---|---|
Agent (add agent) | 48 | alphanumeric + _ | letter |
| Memory, gateway, gateway-target, credential, evaluator, online-eval, policy, policy-engine, payment-manager, payment-connector | 48 | alphanumeric + _ | letter |
Count the characters before constructing the command. If the name is over the limit or contains hyphens, dots, or spaces, push back: "<name> is N characters / uses -, which the CLI rejects. How about <suggestion>?" Never run the command with an invalid name hoping the CLI message will be clear.
Note: agentcore create --name (the project name) has a stricter 23-char limit and does not allow underscores. That's covered in agents-get-started; if you see the developer re-running create, flag the 23-char limit specifically.
Output
Depends on the workflow — see the loaded reference for specific outputs.
Quality criteria
The correct reference was loaded based on the developer's intent
All output follows the loaded reference's quality criteria
Cross-references to other skills (agents-connect, agents-deploy) are included where relevant
Files
- ATTRIBUTION.mdAdded by AutoGineer1011 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md8.9 KiB
- references/browser.md10.0 KiB
- references/code-interpreter.md8.9 KiB
- references/integrate.md19.1 KiB
- references/local-vs-deployed.md4.2 KiB
- references/memory.md27.7 KiB
- references/migrate.md5.5 KiB
- references/multi-agent.md16.2 KiB
- references/payments.md71.4 KiB
- references/request-headers.md6.8 KiB
- references/teardown.md5.3 KiB
- references/vpc.md12.5 KiB
- scripts/process_payment_tool.pyScript7.0 KiB
- scripts/setup_payment_user.pyScript5.3 KiB
scripts/process_payment_tool.py
"""Framework-agnostic payment tool for AgentCore Payments (x402 and MPP).
Copy this file into your agent project and register `x402_fetch` as a tool in
whatever framework you use (Strands, LangGraph, OpenAI Agents SDK, etc.). The
core logic is pure Python with no framework dependency.
Flow:
request -> detect 402 -> PaymentManager.generate_payment_header (the SDK
validates the 402, selects the network, processes the payment, and builds the
version-aware v1/v2 proof header) -> retry with a fresh client.
Transient settlement: the SDK builds a valid header, but the merchant's
on-chain settlement is occasionally transient and the paid retry still returns
402. The SDK does not make the merchant HTTP call (it only builds the header),
so it cannot retry that — this tool re-runs the settle+replay flow up to
X402_MAX_PAYMENT_ATTEMPTS times before giving up. A single idempotency token
(client_token) is reused across all attempts of one fetch, so ProcessPayment is
idempotent: every retry replays the SAME on-chain authorization/nonce. That
recovers a not-yet-settled transient failure, and if the merchant actually did
settle but still returned 402, the replay simply reverts on-chain (nonce already
used) rather than charging the user a second time.
Control-plane resources (payment manager/connector) are created by the AgentCore
CLI; the per-user instrument/session are created by setup_payment_user.py. This
tool only consumes them, via these environment variables:
PAYMENT_MANAGER_ARN payment manager ARN (from deployed-state.json)
PAYMENT_INSTRUMENT_ID per-user wallet ID (from setup_payment_user.py)
PAYMENT_SESSION_ID per-conversation session (from setup_payment_user.py)
PAYMENT_USER_ID end-user identity (required)
AWS_REGION region (default us-west-2)
X402_MAX_PAYMENT_ATTEMPTS transient-402 retry cap (default 5)
"""
import ipaddress
import json
import os
import socket
import uuid
from urllib.parse import urlparse
import httpx
from bedrock_agentcore.payments import PaymentManager
PAYMENT_MANAGER_ARN = os.getenv("PAYMENT_MANAGER_ARN")
PAYMENT_INSTRUMENT_ID = os.getenv("PAYMENT_INSTRUMENT_ID")
PAYMENT_SESSION_ID = os.getenv("PAYMENT_SESSION_ID")
PAYMENT_USER_ID = os.environ.get("PAYMENT_USER_ID") # required — no insecure default
REGION = os.getenv("AWS_REGION", "us-west-2")
# Transient on-chain settlement can leave the paid retry at 402 even though the
# header was valid; re-settle (fresh header + idempotency token) up to this many times.
MAX_PAYMENT_ATTEMPTS = int(os.getenv("X402_MAX_PAYMENT_ATTEMPTS", "5"))
# AgentCore Payments data-plane client (SDK). Created when configured.
_manager = PaymentManager(payment_manager_arn=PAYMENT_MANAGER_ARN, region_name=REGION) if PAYMENT_MANAGER_ARN else None
def _validate_url(url):
"""Return an error string if the URL is not HTTPS or targets a private/internal IP."""
parsed = urlparse(url)
if parsed.scheme != "https":
return "Only HTTPS URLs are supported for payment requests"
try:
for _family, _, _, _, sockaddr in socket.getaddrinfo(parsed.hostname, parsed.port or 443):
ip = ipaddress.ip_address(sockaddr[0])
if ip.is_private or ip.is_loopback or ip.is_link_local:
return "Cannot fetch private/internal network addresses"
except socket.gaierror:
return "Cannot resolve hostname"
return None
def _settle_and_retry(url, method, response, client_token):
"""Build the payment header from a 402 response via the SDK, then replay the request.
The SDK's generate_payment_header does the whole settle workflow (validate the
402, pick the network, ProcessPayment, build the v1 `X-PAYMENT` / v2
`PAYMENT-SIGNATURE` proof) and returns {header_name: header_value}. We pass a
STABLE client_token (the same one for every attempt of a single fetch) so
ProcessPayment is idempotent — each retry replays the same authorization/nonce
and can never double-charge.
Returns the retry httpx.Response. Raises on a header-generation failure.
"""
payment_header = _manager.generate_payment_header(
payment_instrument_id=PAYMENT_INSTRUMENT_ID,
payment_session_id=PAYMENT_SESSION_ID,
user_id=PAYMENT_USER_ID,
client_token=client_token,
payment_required_request={
"statusCode": response.status_code,
"headers": dict(response.headers),
"body": response.text,
},
)
# Retry with a FRESH client so cookies from the 402 response don't contaminate it.
with httpx.Client(verify=True) as client:
return client.request(method, url, headers=payment_header, timeout=30)
def x402_fetch(url, method="GET"):
"""Fetch a URL, automatically settling any x402 402 Payment Required response.
Returns a JSON string with status_code, body, and (on payment) payment_made.
"""
url_error = _validate_url(url)
if url_error:
return json.dumps({"error": url_error})
if not PAYMENT_USER_ID:
return json.dumps({"error": "PAYMENT_USER_ID environment variable is required"})
response = httpx.request(method, url, timeout=30)
if response.status_code != 402:
return json.dumps({"status_code": response.status_code, "body": response.text})
if not _manager:
return json.dumps({
"status_code": 402,
"error": "No payment configuration. Set PAYMENT_MANAGER_ARN.",
"body": response.text,
})
# One idempotency token for the whole fetch: every retry replays the SAME
# authorization/nonce, so a transient 402 can be re-settled without ever double-charging.
client_token = str(uuid.uuid4())
for attempt in range(1, MAX_PAYMENT_ATTEMPTS + 1):
try:
retry_response = _settle_and_retry(url, method, response, client_token)
except Exception as e: # noqa: BLE001 - surface any payment failure (incl. typed SDK errors) to the agent
return json.dumps({"status_code": 402, "error": f"Payment header generation failed: {e}"})
if retry_response.status_code != 402:
# Success (2xx) or a non-transient error — return it; payment_made reflects the actual status.
return json.dumps({
"status_code": retry_response.status_code,
"body": retry_response.text,
"payment_made": 200 <= retry_response.status_code < 300,
"payment_attempts": attempt,
})
# Transient post-payment 402 — retry with the same idempotency token (same
# authorization/nonce), giving settlement another chance without double-charging.
response = retry_response
return json.dumps({
"status_code": 402,
"error": f"Paid and retried {MAX_PAYMENT_ATTEMPTS} times but the merchant still returned 402 "
"(transient on-chain settlement). Try again shortly.",
"body": response.text,
"payment_made": False,
"payment_attempts": MAX_PAYMENT_ATTEMPTS,
})
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Declares allowed tools, Needs an MCP server, Needs Python
Security
What our scanner noticed· Low risk
- Instructions that use the network
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- aws-agentcore
- Publisher
- AWS (Official)
- Source
- aws/agent-toolkit-for-aws · plugins/aws-agents/skills/agents-build · commit 0a218f8
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by aws-agentcore or AWS.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download agents-build.zip