Skip to content

Commit 843683f

Browse files
author
Eashan Kaushik
committed
docs: 📝 New documentation added
1 parent c72414d commit 843683f

File tree

11 files changed

+132
-24
lines changed

11 files changed

+132
-24
lines changed

.github/PULL_REQUEST_TEMPLATE/pull_request_template.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
* [ ] Have you included your Agent Example name in [README.md](https://github.com/aws-samples/bedrock-multi-agents-collaboration-workshop)?
3232
* [ ] Have you included your Agent Example introduction in [README.md](https://github.com/aws-samples/bedrock-multi-agents-collaboration-workshop/tree/main/src/examples)
33-
* [ ] Have you included Introduction, Architecture Diagram, Sample Prompts, and Clean Up steps?
33+
* [ ] Have you included Introduction, Architecture Diagram, Prerequisites, Usage, Sample Prompts, and Clean Up steps?
3434
* [ ] Have you appened `_agent` to the new folder name in `src/examples`?
3535
* [ ] I agree to resolve any [issues](https://github.com/aws-samples/bedrock-multi-agents-collaboration-workshop/issues) created for this example.
3636

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ aws-lambda-developer-guide/
1414
# local copies
1515
agent-old.py
1616
knowledge_bases-old.py
17+
*.pptx
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Hello World Agent
2+
3+
## Introduction
4+
5+
## Architecture Diagram
6+
7+
## Prerequisites
8+
9+
## Usage & Sample Prompts
10+
11+
## Clean Up
12+
13+
## License
14+
15+
This library is licensed under the MIT-0 License. See the LICENSE file.

src/examples/devops_agent/README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Devops Agent
2+
3+
## Introduction
4+
5+
## Architecture Diagram
6+
7+
## Usage & Sample Prompts
8+
9+
## License
10+
11+
This library is licensed under the MIT-0 License. See the LICENSE file.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Portfolio Assistant Agent
2+
3+
## Introduction
4+
5+
## Architecture Diagram
6+
7+
## Prerequisites
8+
9+
## Usage & Sample Prompts
10+
11+
## Clean Up
12+
13+
## License
14+
15+
This library is licensed under the MIT-0 License. See the LICENSE file.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Startup Advisor Agent
2+
3+
## Introduction
4+
5+
## Architecture Diagram
6+
7+
## Prerequisites
8+
9+
## Usage & Sample Prompts
10+
11+
## Clean Up
12+
13+
## License
14+
15+
This library is licensed under the MIT-0 License. See the LICENSE file.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Sports Team Poet Agent
2+
3+
## Introduction
4+
5+
## Architecture Diagram
6+
7+
## Prerequisites
8+
9+
## Usage & Sample Prompts
10+
11+
## Clean Up
12+
13+
## License
14+
15+
This library is licensed under the MIT-0 License. See the LICENSE file.
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Trip Planner Agent
2+
3+
## Introduction
4+
5+
## Architecture Diagram
6+
7+
## Prerequisites
8+
9+
## Usage & Sample Prompts
10+
11+
## Clean Up
12+
13+
## License
14+
15+
This library is licensed under the MIT-0 License. See the LICENSE file.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Voyage Vituoso Agent
2+
3+
## Introduction
4+
5+
## Architecture Diagram
6+
7+
## Prerequisites
8+
9+
## Usage & Sample Prompts
10+
11+
## Clean Up
12+
13+
## License
14+
15+
This library is licensed under the MIT-0 License. See the LICENSE file.

src/shared/web_search/cfn_stacks/web_search_stack.yaml

+24-18
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,16 @@ Parameters:
1313
SerperApiKey:
1414
Type: String
1515
NoEcho: true
16-
Description: API Key for Serper service
16+
Description: Provide SerperApiKey API Key to utilize /google_search path
1717

1818
TavilyApiKey:
1919
Type: String
2020
NoEcho: true
21-
Description: API Key for Tavily service
21+
Description: Provide TavilyApiKey API Key to utilize /web_search or /travily_ai_search path
22+
23+
Conditions:
24+
HasSerperApiKey: !Not [!Equals [!Ref SerperApiKey, '']]
25+
HasTavilyApiKey: !Not [!Equals [!Ref TavilyApiKey, '']]
2226

2327
Resources:
2428
#####################
@@ -27,13 +31,15 @@ Resources:
2731

2832
SerperApiKeySecret:
2933
Type: 'AWS::SecretsManager::Secret'
34+
Condition: HasSerperApiKey
3035
Properties:
3136
Name: 'SERPER_API_KEY'
3237
Description: 'API Key for Serper service'
3338
SecretString: !Ref SerperApiKey
3439

3540
TavilyApiKeySecret:
3641
Type: 'AWS::SecretsManager::Secret'
42+
Condition: HasTavilyApiKey
3743
Properties:
3844
Name: 'TAVILY_API_KEY'
3945
Description: 'API Key for Tavily service'
@@ -73,11 +79,6 @@ Resources:
7379
logger = logging.getLogger(__name__)
7480
logger.setLevel(log_level)
7581
76-
# AWS_REGION = os.environ.get("AWS_REGION", "us-east-1")
77-
# ACTION_GROUP_NAME = os.environ.get("ACTION_GROUP", "action-group-web-search-d213q")
78-
FUNCTION_NAMES = ["tavily-ai-search", "google-search", "web_search"]
79-
80-
8182
def is_env_var_set(env_var: str) -> bool:
8283
return env_var in os.environ and os.environ[env_var] not in ("", "0", "false", "False")
8384
@@ -99,20 +100,22 @@ Resources:
99100
100101
return secret
101102
103+
FUNCTION_NAMES = ["tavily_ai_search", "google_search", "web_search"]
102104
103-
SERPER_API_KEY = get_from_secretstore_or_env("SERPER_API_KEY")
104-
TAVILY_API_KEY = get_from_secretstore_or_env("TAVILY_API_KEY")
105+
try:
106+
SERPER_API_KEY = get_from_secretstore_or_env("SERPER_API_KEY")
107+
FUNCTION_NAMES.append("google_search")
108+
except Exception as e:
109+
SERPER_API_KEY = None
105110
111+
try:
112+
TAVILY_API_KEY = get_from_secretstore_or_env("TAVILY_API_KEY")
113+
FUNCTION_NAMES.append("tavily_ai_search", "web_search")
114+
except Exception as e:
115+
TAVILY_API_KEY = None
106116
107117
def extract_search_params(action_group, function, parameters):
108-
# if action_group != ACTION_GROUP_NAME:
109-
# logger.error(f"unexpected name '{action_group}'; expected valid action group name '{ACTION_GROUP_NAME}'")
110-
# return None, None
111-
112-
if function not in FUNCTION_NAMES:
113-
logger.error(f"unexpected function name '{function}'; valid function names are'{FUNCTION_NAMES}'")
114-
return None, None
115-
118+
116119
search_query = next(
117120
(param["value"] for param in parameters if param["name"] == "search_query"),
118121
None,
@@ -133,7 +136,7 @@ Resources:
133136
None,
134137
)
135138
136-
logger.debug(f"extract_search_params: {search_query=} {target_website=}")
139+
logger.debug(f"extract_search_params: {search_query=} {target_website=} {topic=} {days=}")
137140
138141
return search_query, target_website, topic, days
139142
@@ -199,6 +202,9 @@ Resources:
199202
200203
logger.info(f"lambda_handler: {action_group=} {function=}")
201204
205+
if function not in FUNCTION_NAMES:
206+
raise
207+
202208
search_query, target_website, topic, days = extract_search_params(action_group, function, parameters)
203209
204210
search_results: str = ""

src/utils/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This module contains utilities for building and using various Amazon Bedrock fea
1010
- [Utilize yaml files to define Agents and Tasks](#utilize-yaml-files-to-define-agents-and-tasks)
1111
- [Associate shared tools with Amazon Bedrock Agents](#associate-shared-tools-with-amazon-bedrock-agents)
1212

13-
### Create and Manage Amazon Bedrock Agents
13+
## Create and Manage Amazon Bedrock Agents
1414

1515
This module contains a helper class for building and using Agents for Amazon Bedrock. The AgentsForAmazonBedrock class provides a convenient interface for working with Agents.It includes methods for creating, updating, and invoking Agents, as well as managing IAM roles and Lambda functions for action groups. Here is a quick example of using
1616
the classs:
@@ -50,7 +50,7 @@ Here is a summary of the most important methods:
5050
- add_action_group_with_lambda: Creates a new Action Group for an Agent, backed by Lambda.
5151
- simple_invoke_agent: Invokes an Agent with a given input.
5252

53-
### Create and Manage Amazon Bedrock KnowledgeBase
53+
## Create and Manage Amazon Bedrock KnowledgeBase
5454

5555
This module contains a helper class for building and using Knowledge Bases for Amazon Bedrock. The KnowledgeBasesForAmazonBedrock class provides a convenient interface for working with Knowledge Bases. It includes methods for creating, updating, and invoking Knowledge Bases, as well as managing IAM roles and OpenSearch Serverless. Here is a quick example of using the class:
5656

@@ -75,7 +75,7 @@ Here is a summary of the most important methods:
7575
- create_or_retrieve_knowledge_base: Creates a new Knowledge Base or retrieves an existent one.
7676
- synchronize_data: Syncronize the Knowledge Base with the
7777

78-
### Create and Manage Amazon Bedrock Multi-Agent Collaboration
78+
## Create and Manage Amazon Bedrock Multi-Agent Collaboration
7979

8080
Check out `Hello World` example [here](/src/examples/00_hello_world_agent/).
8181

@@ -104,13 +104,13 @@ hello_world_supervisor = SupervisorAgent.direct_create(
104104
)
105105
```
106106

107-
### Utilize yaml files to define Agents and Tasks
107+
## Utilize yaml files to define Agents and Tasks
108108

109109
Few examples to utilize yaml files to define Agents and Tasks can be found here:
110110

111111
- **[Sports Team Poet Agent](/src/examples/team_poems_agent/)** This is a fun example for sports fans. The Sports Team Poet is a supervisor with a Research Agent and a Sports Poetry Writer. Pick your favorite team (go Celtics!) and see multi-agents collaborate to conduct web research about your team and make a fun poem with those insights. Have fun!
112112
- **[Trip Planner Agent](/src/examples/trip_planner_agent/)** The Trip Planner uses a few sub-agents to help you build a robust itinerary given a destination and number of days. It leverages a Restaurant Scout and an Activity Finder to get great ideas, and an Intinerary Compiler to finish the job. Try it out for your next trip.
113113

114-
### Associate shared tools with Amazon Bedrock Agents
114+
## Associate shared tools with Amazon Bedrock Agents
115115

116116
For guidance follow instruction for individual tools [here](/src/shared/).

0 commit comments

Comments
 (0)