Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5f7e082
initial commit infra and app
Jun 4, 2025
4f4fd74
adding side panel for built in tools
Jun 7, 2025
f7437fb
adding metrics and tools panel update
cerashdan Jun 7, 2025
79b998f
adding README.md
cerashdan Jun 7, 2025
5724a89
Merge branch 'strands-agents:main' into main
cerashdan Jun 7, 2025
cf152cf
Merge branch 'strands-agents:main' into main
cerashdan Jun 8, 2025
41a3d23
adding inital work for session management with dynamodb
cerashdan Jun 8, 2025
e306cd5
completed session management with dynamoDB
cerashdan Jun 8, 2025
00f9aaf
enhancing logging
cerashdan Jun 8, 2025
a1955ab
adding responsive style
cerashdan Jun 9, 2025
bbc9c2c
adding model parmaeters feature to strands playground
cerashdan Jun 9, 2025
0279e3f
updating naming
cerashdan Jun 9, 2025
5efeaff
updating app with educational labels
cerashdan Jun 9, 2025
defdf41
Merge branch 'strands-agents:main' into main
cerashdan Jun 9, 2025
a3041ef
renaming to strands playground
cerashdan Jun 9, 2025
44e484f
updating README.me
cerashdan Jun 9, 2025
498c844
adding CDK descritpion
cerashdan Jun 9, 2025
2765ada
updating front-end while adding Q Dev footer
cerashdan Jun 10, 2025
d3f3f92
adding in line @tool as example on how to integrate
cerashdan Jun 10, 2025
97ac053
Merge branch 'strands-agents:main' into main
cerashdan Jun 17, 2025
495b719
updating order, and readme
cerashdan Jun 17, 2025
561c282
updating readmen and removing old files
cerashdan Jun 17, 2025
67d8066
updating README.md
cerashdan Jun 17, 2025
d07934a
adding main solution image
cerashdan Jun 17, 2025
a1c2ce7
updating README.md with architecture diagram
cerashdan Jun 19, 2025
724ce06
adding infra stack and removing unsed css + html
cerashdan Jun 19, 2025
eac826c
final commit
cerashdan Jun 19, 2025
ef8c3a4
feat(04-UX-demo): implement Strands Playground for interactive agent …
cerashdan Jun 19, 2025
5646eed
fix: adding the architecture diagram image
cerashdan Jun 22, 2025
29fc347
resolving merge conflict with README.md
cerashdan Jul 13, 2025
1ac781c
security improvement to the UIUX sample
cerashdan Jul 13, 2025
3f73d15
update static code - removing inner/outer HTML methods
cerashdan Jul 13, 2025
9a2e5f6
updating cdk
cerashdan Jul 13, 2025
00a143e
updating order of directories
cerashdan Jul 23, 2025
6a174ca
Merge branch 'strands-agents:main' into main
cerashdan Jul 23, 2025
afcb816
updating README to include strandsplayground
cerashdan Jul 23, 2025
9d783e5
adding infra stack
cerashdan Jul 23, 2025
5b15a4a
removing CDK nag
cerashdan Jul 23, 2025
821e2ef
removing option 2 - docker deployment
cerashdan Jul 23, 2025
a8f6b89
updates to readme documentation
cerashdan Jul 23, 2025
f78110d
Merge branch 'strands-agents:main' into main
cerashdan Aug 18, 2025
f93726d
fix readme + requiremetns, revamped tools
cerashdan Aug 18, 2025
f55cfbf
update README, dependcies, and main.py
cerashdan Aug 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions 04-UX-demos/05-strands-playground/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ This project provides a playground environment for developers to experiment with
1. Clone the repository and navigate to the project directory:
```bash
git clone https://github.com/strands-agents/samples.git
cd 04-UX-demos/05-strands-playground/
cd samples/04-UX-demos/05-strands-playground/
```

2. Install Python dependencies:
Expand Down Expand Up @@ -125,7 +125,7 @@ This project provides a playground environment for developers to experiment with

3. Open your browser and navigate to `http://localhost:8003`

### Option 3: Full CDK Deployment to AWS
### Option 2: Full CDK Deployment to AWS

Deploy a complete production-ready environment to AWS using CDK:

Expand Down Expand Up @@ -171,8 +171,6 @@ The Strands Playground follows a modern web application architecture:
- **AI Integration**: Direct integration with Amazon Bedrock through the Strands SDK
- **Deployment**: Containerized application deployable locally or on AWS infrastructure



## Usage Examples

### Basic Experimentation
Expand Down Expand Up @@ -260,10 +258,26 @@ When deploying this application, consider the following security best practices:
3. **Environment Variables**: Never hardcode sensitive information; use environment variables or AWS Secrets Manager
4. **CORS Settings**: Restrict CORS settings to specific origins in production
5. **Network Security**: Deploy within a VPC with appropriate security groups and network ACLs
6. **Tools permissions**: By default, certain tools that perform potentially senstive operations (like file modifications, shell commands or code execution) will prompt for user confirmation before executing. This safety feature ensures users maintain control over actions that could modify their system.). To bypass these confirmation prompts, you can set the `BYPASS_TOOL_CONSENT` environment variable:

```bash
# Set this environment variable to bypass tool confirmation prompts
export BYPASS_TOOL_CONSENT=true
```

or you can edit `main.py`:

```bash
import os

os.environ["BYPASS_TOOL_CONSENT"] = "true"
```


## Version History

- **1.0.0** - Initial release with core playground functionality
- **1.0.1** - Update tools list, dependencies and README

## License

Expand Down
41 changes: 33 additions & 8 deletions 04-UX-demos/05-strands-playground/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
import os
import logging
import boto3
import base64

from botocore.exceptions import ClientError
from typing import Optional

from strands import Agent, tool
from strands.models import BedrockModel
from strands_tools import (
agent_graph, calculator, cron, current_time, editor, environment,
file_read, file_write, generate_image, http_request, image_reader, journal,
load_tool, mem0_memory, memory, nova_reels, python_repl, retrieve, shell,
slack, speak, stop, swarm, think, use_aws, use_llm, workflow
a2a_client, agent_core_memory, agent_graph, batch, browser, calculator,
code_interpreter, cron, current_time, diagram, editor, environment,
file_read, file_write, generate_image, generate_image_stability, handoff_to_user,
http_request, image_reader, journal, load_tool, mem0_memory, memory,
nova_reels, python_repl, retrieve, rss, shell, slack, sleep, speak,
stop, swarm, think, use_agent, use_aws, use_llm, workflow
)

from fastapi import FastAPI, HTTPException
Expand Down Expand Up @@ -50,15 +53,23 @@ def weather_forecast(city: str, days: int = 3) -> str:

# Define all available tools
available_tools = {
'a2a_client': a2a_client,
'agent_core_memory': agent_core_memory,
'agent_graph': agent_graph,
'batch': batch,
'browser': browser,
'calculator': calculator,
'code_interpreter': code_interpreter,
'cron': cron,
'current_time': current_time,
'diagram': diagram,
'editor': editor,
'environment': environment,
'file_read': file_read,
'file_write': file_write,
'generate_image': generate_image,
'generate_image_stability': generate_image_stability,
'handoff_to_user': handoff_to_user,
'http_request': http_request,
'image_reader': image_reader,
'journal': journal,
Expand All @@ -68,12 +79,15 @@ def weather_forecast(city: str, days: int = 3) -> str:
'nova_reels': nova_reels,
'python_repl': python_repl,
'retrieve': retrieve,
'rss': rss,
'shell': shell,
'slack': slack,
'sleep': sleep,
'speak': speak,
'stop': stop,
'swarm': swarm,
'think': think,
'use_agent': use_agent,
'use_aws': use_aws,
'use_llm': use_llm,
'workflow': workflow,
Expand All @@ -82,15 +96,23 @@ def weather_forecast(city: str, days: int = 3) -> str:

# Tool descriptions for better user understanding
tool_descriptions = {
'a2a_client': 'Enable agent-to-agent communication',
'agent_core_memory': 'Integration with Amazon Bedrock Agent Core Memory',
'agent_graph': 'Create and manage graphs of agents with different topologies and communication patterns',
'batch': 'Call multiple tools from a single model request',
'browser': 'Automate web browser interactions',
'calculator': 'Perform mathematical calculations with support for advanced operations',
'code_interpreter': 'Execute code in isolated sandboxes',
'cron': 'Manage crontab entries for scheduling tasks, with special support for Strands agent jobs',
'current_time': 'Get the current time in various timezones',
'diagram': 'Create cloud architecture and UML diagrams',
'editor': 'Editor tool designed to do changes iteratively on multiple files',
'environment': 'Manage environment variables at runtime',
'file_read': 'File reading tool with search capabilities, various reading modes, and document mode support',
'file_write': 'Write content to a file with proper formatting and validation based on file type',
'generate_image': 'Create images using Stable Diffusion models',
'generate_image': 'Create AI generated images with Amazon Bedrock',
'generate_image_stability': 'Create images with Stability AI',
'handoff_to_user': 'Enable human-in-the-loop workflows by pausing agent execution for user input or transferring control entirely to the user',
'http_request': 'Make HTTP requests to external APIs with authentication support',
'image_reader': 'Read and process image files for AI analysis',
'journal': 'Create and manage daily journal entries with tasks and notes',
Expand All @@ -100,12 +122,15 @@ def weather_forecast(city: str, days: int = 3) -> str:
'nova_reels': 'Create high-quality videos using Amazon Nova Reel',
'python_repl': 'Execute Python code in a REPL environment with PTY support and state persistence',
'retrieve': 'Retrieves knowledge based on the provided text from Amazon Bedrock Knowledge Bases',
'rss': 'Manage and process RSS feeds',
'shell': 'Interactive shell with PTY support for real-time command execution and interaction',
'slack': 'Comprehensive Slack integration for messaging, events, and interactions',
'speak': 'Generate speech from text using say command or Amazon Polly.',
'sleep': 'Pause execution with interrupt support',
'speak': 'Generate speech from text using say command or Amazon Polly',
'stop': 'Stops the current event loop cycle by setting stop_event_loop flag',
'swarm': 'Create and coordinate a swarm of AI agents for parallel processing and collective intelligence',
'think': 'Process thoughts through multiple recursive cycles',
'use_agent': 'Run a new AI event loop with custom prompts and different model providers',
'use_aws': 'Execute AWS service operations using boto3',
'use_llm': 'Create isolated agent instances for specific tasks',
'workflow': 'Advanced workflow orchestration system for parallel AI task execution',
Expand Down Expand Up @@ -168,6 +193,7 @@ def restore_agent_state(self, user_id):

# Save agent state
def save_agent_state(self, user_id):
logger.debug(self.messages)
if not table_name and not table_region:
try:
logger.debug("TABLE_NAME and TABLE_REGION environment variable not set, fallback to local file session management, saving conversation to file")
Expand Down Expand Up @@ -263,7 +289,6 @@ def get_agent_response(request: PromptRequest):
result = agent(request.prompt)
logger.debug(f"Model response: {result.message}")
agent.save_agent_state(request.userId)
logger.info(f"Agent state saved for user: {request.userId}")
return {
"messages": result.message,
"latencyMs": result.metrics.accumulated_metrics["latencyMs"],
Expand Down
6 changes: 6 additions & 0 deletions 04-UX-demos/05-strands-playground/app/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ pydantic==2.11.4
strands-agents
strands-agents-tools
strands-agents-tools[mem0_memory]
strands-agents-tools[local_chromium_browser]
strands-agents-tools[agent_core_browser]
strands-agents-tools[agent_core_code_interpreter]
strands-agents-tools[a2a_client]
strands-agents-tools[diagram]
strands-agents-tools[rss]
uv