
Strands Agent
- 3 installs
- 12 repo stars
- Updated June 8, 2026
- aws-samples/sample-claude-code-plugins-for-startups
strands-agent is a Claude skill that scaffolds and builds AI agents with the Strands Agents SDK on Amazon Bedrock AgentCore in TypeScript or Python.
About
Scaffolds and builds AI agents using the Strands Agents SDK deployed on Amazon Bedrock AgentCore. It clarifies language and agent purpose, sets up memory modes, wires in built-in OpenTelemetry tracing and Strands Evals, and deploys via the AgentCore CLI. A developer uses it to start a greenfield agent project in TypeScript or Python.
- Scaffolds AI agents with the Strands Agents SDK on Amazon Bedrock AgentCore
- Ships observability (OpenTelemetry), Strands Evals, and AgentCore CLI deployment from day one
- Supports both TypeScript and Python agent projects
Strands Agent by the numbers
- 3 all-time installs (skills.sh)
- Ranked #13,657 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 28, 2026 (Skillselion catalog sync)
strands-agent capabilities & compatibility
Needs an AWS account with Bedrock model access and AWS credentials; default model is Claude Sonnet via Bedrock
- Capabilities
- agent scaffold · agent evals · agent memory · observability setup
- Works with
- aws · anthropic
- Use cases
- orchestration · testing
- Pricing
- Bring your own API key
What strands-agent says it does
Scaffold and build AI agents using the Strands Agents SDK with Bedrock AgentCore.
Strands has OpenTelemetry built in. Every agent invocation, model call, and tool execution emits OTel spans automatically.
Ship evals from day one. Strands Evals provides LLM-as-a-Judge evaluation with 9+ built-in evaluators
npx skills add https://github.com/aws-samples/sample-claude-code-plugins-for-startups --skill strands-agentAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 3 |
|---|---|
| repo stars | ★ 12 |
| Last updated | June 8, 2026 |
| Repository | aws-samples/sample-claude-code-plugins-for-startups ↗ |
What it does
Scaffold and deploy a new AI agent on Amazon Bedrock AgentCore using the Strands SDK in TypeScript or Python.
Who is it for?
Starting a greenfield Strands agent on Bedrock AgentCore with observability and evals wired in
Skip if: Non-Bedrock agent frameworks or teams without AWS Bedrock model access
When should I use this skill?
Creating new agent projects, building greenfield AgentCore applications, or prototyping agents with Strands
What you get
A scaffolded Strands agent with the right memory mode, OTel tracing, a Strands Evals suite, and AgentCore CLI deployment
- Scaffolded TypeScript or Python agent project
- OpenTelemetry tracing setup
- Strands Evals suite
By the numbers
- Strands Evals provides 9+ built-in evaluators
- STM memory retains conversation history for 30 days
- Session idle timeout defaults to 900s (15 min)
Files
You are building an AI agent using the Strands Agents SDK deployed on Amazon Bedrock AgentCore.
First: Clarify Language
Before writing any code, ask the user:
TypeScript or Python? (TypeScript is recommended for new projects — it has strong typing, good DX, and first-class Strands support. Python is fully supported too.)
Default to TypeScript if the user doesn't have a preference.
Process
1. Clarify the agent's purpose — one sentence. If it needs "and", consider multiple agents. 2. Clarify language preference (TS preferred, Python supported) 3. Identify the tools the agent needs (keep to 3-5 for a PoC) 4. Decide on memory needs: no memory, STM only, or STM+LTM 5. Scaffold the project using the patterns in references/ 6. Include observability setup (OTel tracing is built in — just configure the endpoint) 7. Include an eval scaffold using Strands Evals (even for TS agents, evals are Python) 8. Include deployment instructions using the AgentCore CLI
Quick PoC Path: AgentCore CLI
For the fastest path to a working deployed agent, use the AgentCore Starter Toolkit CLI. It handles configuration, deployment, memory provisioning, and invocation.
# Install the toolkit
pip install bedrock-agentcore-starter-toolkit
# Configure your agent
agentcore configure --entrypoint agent.py --name my-agent
# Deploy to AWS (uses CodeBuild, no Docker needed)
agentcore deploy
# Invoke it
agentcore invoke '{"prompt": "Hello!"}'
# Check status
agentcore status
# Tear down when done
agentcore destroy --forceSee references/agentcore-cli.md for the full CLI reference.
TypeScript Project Setup
mkdir my-agent && cd my-agent
npm init -y
npm pkg set type=module
npm install @strands-agents/sdk
npm install --save-dev @types/node typescriptSee references/typescript-patterns.md for complete TypeScript agent patterns.
Python Project Setup
mkdir my-agent && cd my-agent
python -m venv .venv && source .venv/bin/activate
pip install strands-agents bedrock-agentcoreSee references/python-patterns.md for complete Python agent patterns.
Observability & Tracing
Strands has OpenTelemetry built in. Every agent invocation, model call, and tool execution emits OTel spans automatically. You just configure where to send them.
- AgentCore deployed agents: OTel is enabled by default → CloudWatch Logs, X-Ray traces, GenAI dashboard
- Local development: Set
OTEL_EXPORTER_OTLP_ENDPOINTto route to Jaeger, Grafana, Langfuse, etc. - Disable:
agentcore configure --disable-otel
See references/agentcore-integrations.md for full setup, third-party backends, and trace attribute configuration.
Evaluation with Strands Evals
Ship evals from day one. Strands Evals provides LLM-as-a-Judge evaluation with 9+ built-in evaluators:
- OutputEvaluator: Custom rubric-based quality scoring
- TrajectoryEvaluator: Did the agent use the right tools in the right order?
- HelpfulnessEvaluator: 7-point helpfulness scale
- FaithfulnessEvaluator: Is the response grounded in context? (anti-hallucination)
- HarmfulnessEvaluator: Safety check
- ToolSelectionAccuracyEvaluator / ToolParameterAccuracyEvaluator: Tool-level correctness
- GoalSuccessRateEvaluator: Did the user achieve their goal across a full session?
- ActorSimulator: Simulates realistic multi-turn users for conversation testing
pip install strands-agents-evalsEvals are Python-only. Even for TypeScript agents, write your eval suite in Python.
See references/agentcore-integrations.md for eval code patterns, trace-based evaluation, multi-turn simulation, and auto-generated test cases.
Memory Decision Guide
| Scenario | Memory Mode | Notes |
|---|---|---|
| Stateless tool-calling agent | NO_MEMORY | Simplest, cheapest |
| Multi-turn conversation within a session | STM_ONLY | 30-day retention, stores conversation history |
| Personalization across sessions | STM_AND_LTM | Extracts preferences, facts, summaries across sessions |
Memory is opt-in. Start without it, add when you need it.
Gotchas
- AgentCore CLI is Python-only for deployment — even if your agent is TypeScript, the
agentcoreCLI itself is a Python tool. Your TS agent runs in a container. - TypeScript agents need containerized deployment — use
--deployment-type containerwhen configuring TS agents with the AgentCore CLI - Default model is Claude Sonnet — Strands defaults to
global.anthropic.claude-sonnet-4-5-20250929-v1:0via Bedrock. You need model access enabled in your AWS account. - AWS credentials required — Strands uses Bedrock by default. Ensure
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEYare set, or use IAM roles. - Tool count matters — more tools = more reasoning steps = slower + more expensive. Keep PoCs to 3-5 tools.
- Zod is included —
@strands-agents/sdkbundles Zod for TypeScript tool input validation. No separate install needed. - Memory provisioning takes time — STM: ~30-90s, LTM: ~120-180s. The CLI waits for ACTIVE status.
- `agentcore destroy` deletes everything — including memory resources. Use
--dry-runfirst. - Session lifecycle — idle timeout defaults to 900s (15min). Set
--idle-timeoutand--max-lifetimeduring configure if you need longer sessions. - VPC config is immutable — once deployed with VPC settings, you can't change them. Create a new agent config instead.
- OTel is on by default in AgentCore — traces go to CloudWatch/X-Ray. Disable with
--disable-otelif you don't want it. - Strands Evals is Python-only — even for TypeScript agents, write evals in Python. The eval framework uses the same Bedrock models as your agent.
- Evals cost money — each LLM-as-a-Judge evaluation invokes a model. Use
callback_handler=Nonein eval task functions to suppress console output. - Memory batching requires close() — if using
batch_size > 1, you MUST use awithblock or callclose()or buffered messages are lost.
Output
When scaffolding a new agent project, generate: 1. Complete project structure with all files 2. Agent entrypoint with at least one custom tool 3. Observability setup (OTel endpoint config, env vars) 4. Eval scaffold (evals/ directory with at least one test case using Strands Evals — Python, even for TS agents) 5. README with setup, deployment, observability, and eval instructions 6. .gitignore appropriate for the language 7. Deployment commands (local dev + AgentCore cloud)
AgentCore CLI Quick Reference
Install: pip install bedrock-agentcore-starter-toolkit
Core Workflow
# 1. Configure
agentcore configure --entrypoint agent.py --name my-agent
# 2. Deploy
agentcore deploy # Cloud (CodeBuild, no Docker)
agentcore deploy --local # Local (needs Docker/Finch/Podman)
agentcore deploy --local-build # Build local, deploy to cloud
# 3. Invoke
agentcore invoke '{"prompt": "Hello!"}'
agentcore invoke '{"prompt": "Continue"}' --session-id abc123
# 4. Check status
agentcore status
agentcore status --verbose
# 5. Stop session (save costs)
agentcore stop-session
# 6. Tear down
agentcore destroy --dry-run # Preview
agentcore destroy --force # No confirmationConfigure Options
| Flag | Description |
|---|---|
--entrypoint, -e | Python file of agent (required) |
--name, -n | Agent name |
--deployment-type, -dt | direct_code_deploy (default) or container |
--runtime, -rt | Python version: PYTHON_3_10 through PYTHON_3_13 |
--disable-memory, -dm | Skip memory setup |
--disable-otel, -do | Disable OpenTelemetry |
--idle-timeout, -it | Seconds before idle termination (60-28800, default 900) |
--max-lifetime, -ml | Max instance lifetime seconds (60-28800, default 28800) |
--region, -r | AWS region |
--non-interactive, -ni | Skip prompts, use defaults |
--vpc | Enable VPC networking (requires --subnets and --security-groups) |
Memory Configuration
Memory is opt-in. Three modes:
| Mode | Description |
|---|---|
NO_MEMORY | Default. No memory resources. |
STM_ONLY | Short-term memory. 30-day retention. Conversations within sessions. |
STM_AND_LTM | Short-term + Long-term. Extracts preferences, facts, summaries across sessions. |
# Interactive — prompts for memory setup
agentcore configure --entrypoint agent.py
# Explicitly disable
agentcore configure --entrypoint agent.py --disable-memory
# Non-interactive (STM only by default)
agentcore configure --entrypoint agent.py --non-interactiveMemory Management
agentcore memory create my_memory # Create STM
agentcore memory create my_memory --strategies '[{"semanticMemoryStrategy": {"name": "Facts"}}]' --wait # With LTM
agentcore memory list # List all
agentcore memory status <memory-id> # Check status
agentcore memory delete <memory-id> --wait # DeleteDeploy Options
| Flag | Description |
|---|---|
--local, -l | Build and run locally (needs Docker) |
--local-build, -lb | Build locally, deploy to cloud |
--image-tag, -t | Custom image tag for versioning |
--auto-update-on-conflict, -auc | Update existing agent instead of failing |
--env, -env | Environment variables (KEY=VALUE) |
Gateway (MCP Gateway)
agentcore gateway create-mcp-gateway --name MyGateway
agentcore gateway create-mcp-gateway-target --gateway-arn <arn> --gateway-url <url> --role-arn <role>
agentcore gateway list-mcp-gateways
agentcore gateway delete-mcp-gateway --name MyGateway --forceIdentity (OAuth / JWT)
# AWS JWT (secretless M2M auth)
agentcore identity setup-aws-jwt --audience https://api.example.com
# Cognito (user auth)
agentcore identity setup-cognito
agentcore identity setup-cognito --auth-flow m2m
# Credential providers
agentcore identity create-credential-provider --name MyProvider --type github --client-id <id> --client-secret <secret>
# Cleanup
agentcore identity cleanup --agent my-agent --forceUseful Patterns
# List configured agents
agentcore configure list
# Set default agent
agentcore configure set-default my-agent
# Deploy with semantic versioning
agentcore deploy --image-tag $(git describe --tags --always)
# Deploy with env vars
agentcore deploy --env API_KEY=abc123 --env DEBUG=true
# Import existing Bedrock Agent to AgentCore
agentcore import-agentAgentCore Integrations: Observability, Evals, Tracing, Memory
Observability & Distributed Tracing
Strands has OpenTelemetry (OTel) baked in. Traces are emitted automatically for every agent invocation, model call, and tool execution. You just need to tell it where to send them.
Enable Tracing (Python)
Set the OTLP endpoint and Strands starts exporting traces:
# Send to any OTLP-compatible collector (Jaeger, Grafana, etc.)
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
# For AgentCore deployed agents, OTEL is enabled by default
# Disable with: agentcore configure --disable-otelStrands automatically creates spans for:
- Agent invocations (full request lifecycle)
- Model calls (input/output tokens, latency, model ID)
- Tool executions (tool name, input, output, duration)
- Error states and retries
Enable Tracing (TypeScript)
// TypeScript uses the same OTel environment variables
// Set OTEL_EXPORTER_OTLP_ENDPOINT before starting your agent
// Strands TS SDK emits spans automaticallyAgentCore Native Observability
When deployed to AgentCore, you get observability out of the box:
- CloudWatch Logs: Agent session transcripts at
/aws/bedrock-agentcore/runtimes/<agent-name> - X-Ray Traces: Distributed traces across agent → model → tool calls
- CloudWatch Metrics: Invocation count, latency, errors (namespace:
bedrock-agentcore) - GenAI Observability Dashboard: Token usage, model latency, cost — linked from
agentcore status
# Tail agent logs
aws logs tail /aws/bedrock-agentcore/runtimes/<agent-name>-DEFAULT \
--region us-east-1 --since 5m --follow
# Check agent metrics
aws cloudwatch get-metric-statistics \
--namespace bedrock-agentcore \
--metric-name Invocations \
--start-time $(date -v-1d +%Y-%m-%dT%H:%M:%S) \
--end-time $(date +%Y-%m-%dT%H:%M:%S) \
--period 3600 --statistics SumThird-Party Observability Backends
Strands OTel traces are vendor-neutral. Route them to any backend:
| Backend | How | Notes |
|---|---|---|
| CloudWatch + X-Ray | Default on AgentCore | Zero config, GenAI dashboard included |
| Langfuse | Set OTLP endpoint to Langfuse collector | LLM-native: cost per trace, prompt versioning |
| Grafana | OTel collector → Grafana Cloud | Rich dashboards, alerting |
| Datadog | OTel collector → Datadog | APM integration, anomaly detection |
| Elastic | OTel collector → Elastic APM | Full-stack correlation |
| Arize Phoenix | openinference-instrumentation-strands-agents | OpenInference format, trace visualization |
Trace Attributes
Strands enriches spans with GenAI semantic conventions. Opt in to experimental attributes:
# Enable experimental GenAI attributes
export OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental,gen_ai_tool_definitionsThis adds:
gen_ai.system: Model providergen_ai.request.model: Model IDgen_ai.usage.input_tokens/gen_ai.usage.output_tokens: Token countsgen_ai.conversation.id: Session correlation- Tool definition schemas in spans
---
Evaluation with Strands Evals
Strands Evals is a dedicated evaluation framework with LLM-as-a-Judge built in. Install separately:
pip install strands-agents-evalsNote: Strands Evals is Python-only as of now. Even if your agent is TypeScript, write your evals in Python.
Built-in Evaluators
| Evaluator | Level | What It Measures |
|---|---|---|
OutputEvaluator | Response | Custom rubric-based quality scoring |
TrajectoryEvaluator | Trajectory | Tool selection sequence and efficiency |
HelpfulnessEvaluator | Response | 7-point helpfulness scale |
FaithfulnessEvaluator | Response | Grounded in context (anti-hallucination) |
HarmfulnessEvaluator | Response | Safety check (binary) |
ToolSelectionAccuracyEvaluator | Tool | Was the right tool chosen? |
ToolParameterAccuracyEvaluator | Tool | Were tool parameters correct? |
GoalSuccessRateEvaluator | Session | Did the user achieve their goal? |
InteractionsEvaluator | Multi-agent | Quality of agent-to-agent interactions |
Quick Eval Example
from strands import Agent
from strands_evals import Case, Experiment
from strands_evals.evaluators import OutputEvaluator, TrajectoryEvaluator
from strands_evals.extractors import tools_use_extractor
# Define test cases
cases = [
Case(
name="order-lookup",
input="Where is my order #ORD-789?",
expected_output="Should include order status and tracking info",
expected_trajectory=["lookup_order"],
),
]
# Define evaluators
output_eval = OutputEvaluator(
rubric="""
Score 1.0 if the response includes order status and tracking number.
Score 0.5 if it includes status but no tracking.
Score 0.0 if it doesn't address the order.
""",
include_inputs=True,
)
trajectory_eval = TrajectoryEvaluator(
rubric="Verify the agent used the lookup_order tool with the correct order ID.",
include_inputs=True,
)
# Task function — connects your agent to the eval framework
def my_task(case):
agent = Agent(tools=[lookup_order], callback_handler=None)
result = agent(case.input)
trajectory = tools_use_extractor.extract_agent_tools_used_from_messages(agent.messages)
return {"output": str(result), "trajectory": trajectory}
# Run
experiment = Experiment(cases=cases, evaluators=[output_eval, trajectory_eval])
reports = experiment.run_evaluations(my_task)
reports[0].run_display()Trace-Based Evaluation (Using OTel Spans)
For deeper analysis, evaluate using captured OTel traces:
from strands_evals.telemetry import StrandsEvalsTelemetry
from strands_evals.mappers import StrandsInMemorySessionMapper
from strands_evals.evaluators import HelpfulnessEvaluator
telemetry = StrandsEvalsTelemetry().setup_in_memory_exporter()
def task_with_traces(case):
telemetry.in_memory_exporter.clear()
agent = Agent(
tools=[lookup_order],
trace_attributes={
"gen_ai.conversation.id": case.session_id,
"session.id": case.session_id,
},
callback_handler=None,
)
response = agent(case.input)
spans = telemetry.in_memory_exporter.get_finished_spans()
session = StrandsInMemorySessionMapper().map_to_session(spans, session_id=case.session_id)
return {"output": str(response), "trajectory": session}
experiment = Experiment(cases=cases, evaluators=[HelpfulnessEvaluator()])
reports = experiment.run_evaluations(task_with_traces)Multi-Turn Simulation
Test multi-turn conversations with simulated users:
from strands_evals import Case, ActorSimulator
case = Case(
input="I need to return a damaged item",
metadata={"task_description": "Successfully initiate a return"},
)
user_sim = ActorSimulator.from_case_for_user_simulator(case=case, max_turns=10)
agent = Agent(tools=[lookup_order, initiate_return])
user_message = case.input
while user_sim.has_next():
agent_response = agent(user_message)
user_result = user_sim.act(str(agent_response))
user_message = str(user_result.structured_output.message)
# Then evaluate the full session with GoalSuccessRateEvaluatorAuto-Generate Test Cases
from strands_evals.generators import ExperimentGenerator
from strands_evals.evaluators import OutputEvaluator
generator = ExperimentGenerator(input_type=str, output_type=str, include_expected_output=True)
experiment = await generator.from_context_async(
context="A customer service agent for an e-commerce platform",
task_description="Handle order inquiries, returns, and product questions",
num_cases=20,
evaluator=OutputEvaluator,
num_topics=4,
)
experiment.to_file("generated_evals")Eval Strategy
| Phase | What to Eval | Evaluators | Frequency |
|---|---|---|---|
| Dev | Output quality, tool usage | OutputEvaluator, TrajectoryEvaluator | Every prompt change |
| Pre-prod | Full suite + faithfulness + safety | All + HarmfulnessEvaluator | Every PR / deploy |
| Production | Offline traces + goal success | GoalSuccessRateEvaluator, HelpfulnessEvaluator | Daily / on model updates |
---
Memory Integration
See python-patterns.md for the code patterns. Key decisions:
Memory Modes
| Mode | What It Stores | Use Case |
|---|---|---|
NO_MEMORY | Nothing | Stateless tool agents |
STM_ONLY | Conversation history within sessions (30-day retention) | Multi-turn chat |
STM_AND_LTM | STM + extracted preferences, facts, summaries across sessions | Personalization |
LTM Strategies
When using STM_AND_LTM, configure strategies for what to extract:
strategies = [
{"summaryMemoryStrategy": {"name": "SessionSummarizer", "namespaceTemplates": ["/summaries/{actorId}/{sessionId}/"]}},
{"userPreferenceMemoryStrategy": {"name": "PreferenceLearner", "namespaceTemplates": ["/preferences/{actorId}/"]}},
{"semanticMemoryStrategy": {"name": "FactExtractor", "namespaceTemplates": ["/facts/{actorId}/"]}},
]- summaryMemoryStrategy: Summarizes sessions for quick recall
- userPreferenceMemoryStrategy: Extracts user preferences (likes sushi, prefers TypeScript)
- semanticMemoryStrategy: Extracts factual information (user's name, company, role)
Memory with AgentCore CLI
# Interactive — prompts for memory setup
agentcore configure --entrypoint agent.py
# Create memory manually
agentcore memory create my_memory --strategies '[{"semanticMemoryStrategy": {"name": "Facts"}}]' --wait
# Check memory status (must be ACTIVE before use)
agentcore memory status <memory-id>Memory with Batching (High-Throughput)
For agents with many messages per session, batch memory writes:
from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig
from bedrock_agentcore.memory.integrations.strands.session_manager import AgentCoreMemorySessionManager
config = AgentCoreMemoryConfig(
memory_id=MEMORY_ID,
session_id=SESSION_ID,
actor_id=ACTOR_ID,
batch_size=10, # Buffer 10 messages before flushing
)
# MUST use context manager or call close() to flush remaining buffer
with AgentCoreMemorySessionManager(config, region_name="us-east-1") as session_manager:
agent = Agent(session_manager=session_manager)
agent("Hello!")
agent("Tell me about AWS")
# Buffered messages auto-flushed on exitStrands Agent — Python Patterns
Minimal Agent
from strands import Agent
agent = Agent(
system_prompt="You are a helpful assistant."
)
response = agent("What can you help me with?")
print(response)Agent with Custom Tools
from strands import Agent, tool
@tool
def lookup_order(order_id: str) -> str:
"""Look up an order by ID. Returns order status, items, and shipping info."""
# Replace with your actual data source
return f"Order {order_id}: shipped, tracking TRK-12345"
agent = Agent(
system_prompt="You are a customer service agent. Help users check their orders.",
tools=[lookup_order],
)
response = agent("Where is my order #ORD-789?")
print(response)AgentCore Deployment Entrypoint
# agent.py — AgentCore-compatible entrypoint
import os
from strands import Agent, tool
from bedrock_agentcore.runtime import BedrockAgentCoreApp
app = BedrockAgentCoreApp()
@tool
def lookup_order(order_id: str) -> str:
"""Look up an order by ID."""
return f"Order {order_id}: shipped, tracking TRK-12345"
@app.entrypoint
async def invoke(payload, context):
agent = Agent(
model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
tools=[lookup_order],
)
response = await agent.invoke_async(payload.get("prompt", ""))
return {"response": str(response.message)}AgentCore with Memory
# agent.py — with AgentCore memory integration
import os
from strands import Agent, tool
from bedrock_agentcore.runtime import BedrockAgentCoreApp
from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig
from bedrock_agentcore.memory.integrations.strands.session_manager import AgentCoreMemorySessionManager
app = BedrockAgentCoreApp()
MEMORY_ID = os.getenv("BEDROCK_AGENTCORE_MEMORY_ID")
REGION = os.getenv("AWS_REGION", "us-east-1")
@app.entrypoint
async def invoke(payload, context):
session_manager = None
if MEMORY_ID:
memory_config = AgentCoreMemoryConfig(
memory_id=MEMORY_ID,
session_id=context.session_id,
actor_id=context.actor_id,
)
session_manager = AgentCoreMemorySessionManager(memory_config, REGION)
agent = Agent(
model="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
system_prompt="You are a helpful assistant. Use what you know about the user.",
session_manager=session_manager,
)
response = await agent.invoke_async(payload.get("prompt", ""))
return {"response": str(response.message)}Project Structure
my-agent/
├── agent.py # Agent entrypoint
├── tools/ # Custom tool definitions
│ ├── __init__.py
│ └── lookup_order.py
├── requirements.txt
├── .gitignore
└── README.mdrequirements.txt
strands-agents
bedrock-agentcoreStrands Agent — TypeScript Patterns
Minimal Agent (No Tools)
// src/agent.ts
import { Agent } from '@strands-agents/sdk'
const agent = new Agent({
systemPrompt: 'You are a helpful assistant.',
})
const result = await agent.invoke('What can you help me with?')
console.log(result.lastMessage)Agent with Custom Tools
// src/agent.ts
import { Agent, tool } from '@strands-agents/sdk'
import z from 'zod'
const lookupOrder = tool({
name: 'lookup_order',
description: 'Look up an order by ID. Returns order status, items, and shipping info.',
inputSchema: z.object({
orderId: z.string().describe('The order ID to look up'),
}),
callback: async (input) => {
// Replace with your actual data source
return JSON.stringify({
orderId: input.orderId,
status: 'shipped',
items: ['Widget A', 'Widget B'],
trackingNumber: 'TRK-12345',
})
},
})
const agent = new Agent({
systemPrompt: 'You are a customer service agent. Help users check their orders.',
tools: [lookupOrder],
})
const result = await agent.invoke('Where is my order #ORD-789?')
console.log(result.lastMessage)Agent with Vended Tools (Built-in)
import { Agent } from '@strands-agents/sdk'
import { bash } from '@strands-agents/sdk/vended-tools/bash'
const agent = new Agent({
tools: [bash],
systemPrompt: 'You are a DevOps assistant. Help with system tasks.',
})
const result = await agent.invoke('List the files in the current directory')
console.log(result.lastMessage)Custom Model Configuration
import { Agent } from '@strands-agents/sdk'
import { BedrockModel } from '@strands-agents/sdk'
const model = new BedrockModel({
modelId: 'anthropic.claude-sonnet-4-20250514-v1:0',
region: 'us-west-2',
temperature: 0.3,
})
const agent = new Agent({ model })Streaming Responses (for Web Servers)
import { Agent } from '@strands-agents/sdk'
const agent = new Agent()
async function handleRequest(prompt: string) {
for await (const event of agent.stream(prompt)) {
console.log('Event:', event.type)
// Forward events to client via SSE, WebSocket, etc.
}
}Project Structure
my-agent/
├── src/
│ ├── agent.ts # Agent definition and entrypoint
│ ├── tools/ # Custom tool definitions
│ │ ├── index.ts
│ │ └── lookup-order.ts
│ └── config.ts # Model and environment config
├── package.json
├── tsconfig.json
├── .gitignore
└── README.mdtsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"outDir": "./dist",
"rootDir": "./src",
"declaration": true,
"sourceMap": true
},
"include": ["src/**/*"]
}Running Locally
# Using tsx (recommended for dev)
npx tsx src/agent.ts
# Or compile and run
npx tsc && node dist/agent.jsRelated skills
FAQ
Does the AgentCore CLI work for TypeScript agents?
Yes, but the agentcore CLI itself is Python-only; TypeScript agents run in a container and need --deployment-type container when configuring.
What memory modes does a Strands agent support?
NO_MEMORY for stateless agents, STM_ONLY for within-session conversation history, and STM_AND_LTM for personalization across sessions.