Skip to content

Commit f0e4872

Browse files
liustveADOT Patch workflow
andauthored
Integrate Pet Clinic AI Agents with Nutrition Service (#159)
*Description of changes:* - Integrates Pet Clinic AI agents with the existing nutrition service to provide dietary recommendations based on the clinic's actual product inventory. Nutrition Agent now queries the nutrition service API for pet-specific dietary information and product recommendations - Adds nutrition service to the ingress endpoint and extends the database with a products column containing Pet Clinic's pet food product inventory. - Update `setup-agents-demo` script to auto discover their nutrition service and/or allow users to provide the link to their nutrition service's endpoint. - Removes intentional transient errors from Nutrition Agent - Updates `requirements.txt` for both agents to include latest version of Strands and ADOT. Example trace with everything integrated: <img width="1395" height="527" alt="image" src="https://github.com/user-attachments/assets/7ae81b15-691f-489e-99cd-d267dade31ac" /> By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- Co-authored-by: ADOT Patch workflow <[email protected]>
1 parent ae2aced commit f0e4872

File tree

15 files changed

+259
-340
lines changed

15 files changed

+259
-340
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ The following instructions set up AI agents deployed to Bedrock AgentCore Runtim
176176
The setup includes:
177177

178178
- **Primary Agent**: A general pet clinic assistant that handles appointment scheduling, clinic information, and emergency contacts. Any nutrition related queries will be delegated to the Nutrition Agent.
179-
- **Nutrition Agent**: A specialized agent focused on pet nutrition, diet recommendations, and feeding guidelines
180-
- **Traffic Generator**: A Lambda function scheduled via AWS EventBridge that sends queries to the Primary Agent every 1 minute.
179+
- **Nutrition Agent**: A specialized agent focused on pet nutrition, diet recommendations, and feeding guidelines. When deployed with the Pet Clinic EKS demo, it utilizes the nutrition service API at `http://<ingress-host>/nutrition` to base its answers on data from the service
180+
- **Traffic Generator**: A Lambda function scheduled via AWS EventBridge that sends queries to the Primary Agent on set a cadence.
181181

182182
**Prerequisites:**
183183
- AWS CLI 2.x configured with appropriate permissions
@@ -194,6 +194,14 @@ The setup includes:
194194
cd scripts/agents && ./setup-agents-demo.sh --region=region-name
195195
```
196196

197+
The Nutrition Agent relies on the nutrition service to retrieve pet nutrition information and provide accurate dietary recommendations. To enable this feature, the [EKS demo](#eks-demo) must be set up first. The deployment script will attempt to auto-discover the nutrition service endpoint from your EKS cluster. If auto-discovery fails or you want to specify a custom endpoint, you can manually provide the nutrition service URL using the `--nutrition-service-url` parameter:
198+
199+
```shell
200+
export MY_NUTRITION_ENDPOINT=my-load-balancer.us-east-1.elb.amazonaws.com
201+
202+
cd scripts/agents && ./setup-agents-demo.sh --region=us-east-1 --nutrition-service-url=http://${MY_NUTRITION_ENDPOINT}/nutrition
203+
```
204+
197205
2. **Clean up resources** when finished:
198206

199207
```shell

cdk/agents/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const app = new cdk.App();
77

88
// Deploy Pet Clinic agents
99
const agentsStack = new PetClinicAgentsStack(app, 'PetClinicAgentsStack', {
10+
nutritionServiceUrl: process.env.NUTRITION_SERVICE_URL,
1011
env: {
1112
account: process.env.CDK_DEFAULT_ACCOUNT,
1213
region: process.env.CDK_DEFAULT_REGION,

cdk/agents/lambda/bedrock-agentcore-deployer/deployer.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,27 @@ def create_agent(properties, event, context):
2727
execution_role = properties['ExecutionRole']
2828

2929
try:
30-
response = client.create_agent_runtime(
31-
agentRuntimeName=agent_name,
32-
description=f'{agent_name} agent for Application Signals demo',
33-
agentRuntimeArtifact={
30+
create_params = {
31+
'agentRuntimeName': agent_name,
32+
'description': f'{agent_name} agent for Application Signals demo',
33+
'agentRuntimeArtifact': {
3434
'containerConfiguration': {
3535
'containerUri': image_uri
3636
}
3737
},
38-
roleArn=execution_role,
39-
networkConfiguration={
38+
'roleArn': execution_role,
39+
'networkConfiguration': {
4040
'networkMode': 'PUBLIC'
4141
},
42-
protocolConfiguration={
42+
'protocolConfiguration': {
4343
'serverProtocol': 'HTTP'
4444
}
45-
)
45+
}
46+
47+
if 'EnvironmentVariables' in properties:
48+
create_params['environmentVariables'] = properties['EnvironmentVariables']
49+
50+
response = client.create_agent_runtime(**create_params)
4651

4752
agent_arn = response['agentRuntimeArn']
4853

@@ -68,22 +73,27 @@ def update_agent(properties, event, context):
6873
image_uri = properties['ImageUri']
6974
execution_role = properties['ExecutionRole']
7075

71-
response = client.update_agent_runtime(
72-
agentRuntimeId=agent_runtime_id,
73-
description=f'{agent_name} agent for Application Signals demo',
74-
agentRuntimeArtifact={
76+
update_params = {
77+
'agentRuntimeId': agent_runtime_id,
78+
'description': f'{agent_name} agent for Application Signals demo',
79+
'agentRuntimeArtifact': {
7580
'containerConfiguration': {
7681
'containerUri': image_uri
7782
}
7883
},
79-
roleArn=execution_role,
80-
networkConfiguration={
84+
'roleArn': execution_role,
85+
'networkConfiguration': {
8186
'networkMode': 'PUBLIC'
8287
},
83-
protocolConfiguration={
88+
'protocolConfiguration': {
8489
'serverProtocol': 'HTTP'
8590
}
86-
)
91+
}
92+
93+
if 'EnvironmentVariables' in properties:
94+
update_params['environmentVariables'] = properties['EnvironmentVariables']
95+
96+
response = client.update_agent_runtime(**update_params)
8797

8898
agent_arn = response['agentRuntimeArn']
8999

cdk/agents/lambda/traffic-generator/prompts.json

Lines changed: 69 additions & 172 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
11
{
22
"nutrition-queries": [
3-
"Can my dog eat steak?",
3+
"What should I feed my iguana?",
4+
"Can my dog eat rice?",
5+
"Can my turtle eat lettuce?",
6+
"What's the best diet for my gecko?",
7+
"My bearded dragon needs supplements, which ones?",
8+
"How often should I feed my tarantula?",
9+
"What vegetables can my tortoise eat?",
10+
"My chameleon is losing weight, diet help?",
11+
"Can my frog eat crickets?",
12+
"What's good nutrition for my axolotl?",
13+
"My ferret won't eat, what should I do?",
14+
"What's the best food for indoor cats?",
415
"What should I feed my rabbit?",
516
"My bird has diabetes, what diet do you recommend?",
617
"What supplements are good for joint health in horses?",
718
"Is chocolate toxic to pets?",
8-
"How much should I feed my 50 pound dog?",
919
"My guinea pig won't eat, what should I do?",
20+
"Can dogs eat blueberries?",
1021
"How often should I feed my ferret?",
1122
"What foods are toxic to birds?",
1223
"My hamster is overweight, help with diet plan",
1324
"Can rabbits eat grapes?",
14-
"What's the best food for senior cats?",
1525
"My fish has swim bladder disease, what diet?",
1626
"How much water should my reptile drink?",
1727
"Can I give my bird human vitamins?",
1828
"What's a good diet for a diabetic rabbit?",
1929
"My horse has allergies, what food is safe?",
30+
"My cat has diabetes, feeding schedule?",
2031
"How do I transition my turtle to new food?",
2132
"Can guinea pigs eat pellets meant for rabbits?",
2233
"What's the best diet for weight loss in ferrets?",
@@ -25,15 +36,16 @@
2536
"What supplements help with arthritis in horses?",
2637
"Can hamsters eat sunflower seeds?",
2738
"My snake is refusing food, should I be worried?",
39+
"What's good for my dog's coat health?",
2840
"What's the best food for baby rabbits?",
2941
"How do I know if my bird is dehydrated?",
3042
"Can reptiles eat avocado?",
31-
"What's a good diet for heart disease in cats?",
3243
"My parrot won't stop begging for food",
3344
"How often should senior rabbits eat?",
3445
"Can I feed my hamster table scraps?",
3546
"What's the difference between pellets and seeds for birds?",
3647
"My turtle has bad breath, is it diet related?",
48+
"Can cats eat eggs?",
3749
"Can guinea pigs eat fish?",
3850
"What's the best diet for active horses?",
3951
"My bearded dragon is constipated, what foods help?",
@@ -44,181 +56,66 @@
4456
"Can turtles eat tuna?",
4557
"What's the best food for indoor rabbits?",
4658
"My bird is a picky eater, help!",
59+
"My dog won't eat dry food",
4760
"Can hamsters eat vegetables?",
4861
"What supplements boost immune system in reptiles?",
4962
"My rabbit has GI stasis, what helps?",
50-
"How do I feed multiple pets?",
51-
"Can pets eat dairy products?",
52-
"What's good for digestive health?",
53-
"My dog gulps food too fast",
54-
"Can cats eat eggs?",
63+
"What should I feed my senior cat?",
64+
"Can my dog eat chicken?",
65+
"My cat won't drink water, help?",
5566
"What's the best diet for large breed dogs?",
56-
"My pet has food allergies, what now?",
57-
"Can dogs eat rice?",
58-
"What's good for joint health?",
59-
"My cat won't drink water",
60-
"How do I store pet food properly?",
61-
"Can pets eat berries?",
62-
"What's the best diet for small dogs?",
67+
"Can cats eat tuna?",
6368
"My dog has sensitive stomach",
64-
"Can cats eat meat?",
65-
"What supplements help with anxiety?",
66-
"My pet is getting old, diet changes?",
67-
"Can dogs eat pasta?",
68-
"What's good for skin allergies?",
69-
"My cat prefers dry food only",
70-
"How much protein do pets need?",
71-
"Can pets eat honey?",
72-
"What's the best diet for working dogs?",
73-
"My dog has hip dysplasia, nutrition help?",
74-
"Can cats eat salmon?",
75-
"What's good for urinary health?",
76-
"My pet won't take pills",
77-
"Can dogs eat bananas?",
78-
"What's the best diet for pregnant pets?",
79-
"My cat has diabetes, feeding schedule?",
80-
"Can pets eat coconut oil?",
81-
"What's good for liver health?",
82-
"My dog is always hungry",
83-
"Can cats eat chicken?",
84-
"What supplements help with shedding?",
85-
"My pet has cancer, nutrition advice?",
86-
"Can dogs eat apples?",
87-
"What's the best diet for rescue pets?",
88-
"My cat won't eat wet food",
89-
"How do I read pet food labels?",
90-
"Can pets eat pumpkin?",
91-
"What's good for brain health?",
92-
"My dog has bloat, prevention diet?",
93-
"Can cats eat turkey?",
94-
"What's the best diet for outdoor cats?",
95-
"My pet has bad gas",
69+
"What should I feed my chinchilla?",
70+
"Can my hedgehog eat insects?",
71+
"What supplements help with shedding in cats?",
72+
"What's the best diet for my sugar glider?",
73+
"My pet skunk needs nutrition advice",
74+
"How often should I feed my capybara?",
75+
"What vegetables can my pot-bellied pig eat?",
76+
"Can dogs eat peanut butter?",
77+
"My wallaby is losing weight, diet help?",
78+
"Can my kinkajou eat honey?",
79+
"What's good nutrition for my fennec fox?",
80+
"My prairie dog won't eat, what should I do?",
81+
"What should I feed my miniature donkey?",
82+
"My cat is losing weight, help?",
83+
"Can my coatimundi eat fruits?",
84+
"What's the best diet for my alpaca?",
85+
"My serval needs supplements, which ones?",
86+
"How much should I feed my pygmy goat?",
87+
"What's a good diet for my otter?",
88+
"Can my raccoon eat dog food?",
89+
"What's the best diet for senior dogs?",
90+
"What supplements help with my sloth's digestion?",
91+
"My armadillo has dietary restrictions",
92+
"What should I feed my baby opossum?",
93+
"Can my porcupine eat vegetables?",
94+
"What's the best food for my lemur?",
95+
"My flying squirrel is picky, help!",
96+
"Can cats eat cheese?",
97+
"What supplements boost immune system in chinchillas?",
98+
"Can my degu eat seeds?",
99+
"What's good for digestive health in hedgehogs?",
100+
"My marmoset has food allergies",
101+
"How do I feed my pet crow?",
102+
"What's the best diet for my peacock?",
103+
"Can my toucan eat berries?",
104+
"My dog has kidney disease, diet help?",
105+
"What supplements help with anxiety in sugar gliders?",
106+
"My emu is getting old, diet changes?",
107+
"What's good for my llama's coat health?",
108+
"Can my muntjac deer eat hay?",
109+
"What's good for digestive health in cats?",
110+
"What's the best diet for my axolotl?",
111+
"How much should I feed my puppy?",
96112
"Can dogs eat carrots?",
97-
"What supplements help with mobility?",
98-
"My cat is losing weight",
99-
"How do I switch from kitten to adult food?",
100-
"Can pets eat sweet potatoes?",
101-
"What's good for eye health?",
102-
"My dog won't eat dry food",
103-
"Can cats eat beef?",
104-
"What's the best diet for apartment pets?",
105-
"My pet has dental issues",
106-
"Can dogs eat blueberries?",
107-
"What supplements help with stress?",
108-
"My cat eats too fast",
109-
"How do I feed a sick pet?",
110-
"Can pets eat quinoa?",
111-
"What's good for muscle development?",
112-
"My dog has food aggression",
113-
"Can cats eat pork?",
114-
"What's the best diet for multi-pet homes?",
115-
"My pet has seizures, diet impact?",
116-
"Can dogs eat watermelon?",
117-
"What supplements help with digestion?",
118-
"My cat won't eat after moving",
119-
"How do I feed pets with different needs?",
120-
"Can pets eat oats?",
121-
"What's good for bone health?",
122-
"My dog is food obsessed",
123-
"Can cats eat duck?",
124-
"What's the best diet for travel?",
125-
"My pet has thyroid issues",
126-
"Can dogs eat strawberries?",
127-
"What supplements help with energy?",
128-
"My cat prefers human food",
129-
"How do I maintain healthy weight?",
130-
"Can pets eat barley?",
131-
"What's good for respiratory health?",
132-
"My dog won't eat after surgery",
133-
"Can cats eat lamb?",
134-
"What's the best diet for show pets?",
135-
"My pet has inflammatory bowel disease",
136-
"Can dogs eat oranges?",
137-
"What supplements help with recovery?",
138-
"My cat is drinking too much water",
139-
"How do I feed pets on medication?",
140-
"Can pets eat brown rice?",
141-
"What's good for circulation?",
142-
"My dog has megaesophagus",
143-
"Can cats eat rabbit?",
144-
"What's the best diet for breeding pets?",
145-
"My pet has crystals in urine",
146-
"Can dogs eat pears?",
147-
"What supplements help with inflammation?",
148-
"My cat won't eat prescription diet",
149-
"How do I feed underweight pets?",
150-
"Can pets eat lentils?",
151-
"What's good for nervous system?",
152-
"My dog has colitis",
153-
"Can cats eat venison?",
154-
"What's the best diet for geriatric pets?",
155-
"My pet has stones in bladder",
156-
"Can dogs eat peaches?",
157-
"What supplements help with healing?",
158-
"My cat is eating litter",
159-
"How do I feed pets with diabetes?",
160-
"Can pets eat chickpeas?",
161-
"What's good for hormone balance?",
162-
"My dog has gastritis",
163-
"Can cats eat fish oil?",
164-
"What's the best diet for hypoallergenic needs?",
165-
"My pet has liver disease",
166-
"Can dogs eat mangoes?",
167-
"What supplements help with coat shine?",
168-
"My cat won't eat after dental work",
169-
"How do I feed pets with kidney disease?",
170-
"Can pets eat spinach?",
171-
"What's good for metabolic health?",
172-
"My dog has exocrine pancreatic insufficiency",
173-
"Can cats eat probiotics?",
174-
"What's the best diet for food trials?",
175-
"My pet has heart murmur",
176-
"Can dogs eat pineapple?",
177-
"What supplements help with joint pain?",
178-
"My cat is eating plants",
179-
"How do I feed pets with cancer?",
180-
"Can pets eat broccoli?",
181-
"What's good for immune support?",
182-
"My dog has Cushing's disease",
113+
"My cat is overweight, diet plan?",
114+
"What supplements help with joint pain in dogs?",
115+
"Can cats eat salmon?",
116+
"My dog has allergies, what food is safe?",
183117
"Can cats eat yogurt?",
184-
"What's the best diet for weight gain?",
185-
"My pet has chronic diarrhea",
186-
"Can dogs eat cantaloupe?",
187-
"What supplements help with cognitive function?",
188-
"My cat won't eat after vaccination",
189-
"How do I feed pets with allergies?",
190-
"Can pets eat green beans?",
191-
"What's good for antioxidant support?",
192-
"My dog has addison's disease",
193-
"Can cats eat cheese?",
194-
"What's the best diet for sensitive stomachs?",
195-
"My pet has chronic vomiting",
196-
"Can dogs eat grapes? Wait, I heard they're toxic",
197-
"What supplements help with senior pets?",
198-
"My cat is hiding and not eating",
199-
"How do I feed pets with pancreatitis?",
200-
"Can pets eat cauliflower?",
201-
"What's good for detoxification?",
202-
"My dog has inflammatory conditions",
203-
"Can cats eat cottage cheese?",
204-
"What's the best diet for post-surgery recovery?",
205-
"My pet has chronic kidney disease",
206-
"Can dogs eat kiwi?",
207-
"What supplements help with wound healing?",
208-
"My cat won't eat new prescription food",
209-
"How do I feed pets with heart disease?",
210-
"Can pets eat asparagus?",
211-
"What's good for cellular health?",
212-
"My dog has autoimmune disease",
213-
"Can cats eat cream?",
214-
"What's the best diet for chemotherapy patients?",
215-
"My pet has gastrointestinal issues",
216-
"Can dogs eat papaya?",
217-
"What supplements help with liver support?",
218-
"My cat is eating too much",
219-
"How do I feed pets with arthritis?",
220-
"Can pets eat zucchini?",
221-
"What's good for cardiovascular health?"
118+
"What's the best diet for working dogs?"
222119
],
223120
"non-nutrition-queries": [
224121
"What are your clinic hours?",

0 commit comments

Comments
 (0)