-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Parent Issue: #195
Quick Links
- Strands Multi-Agent Documentation: https://strandsagents.com/latest/documentation/docs/user-guide/concepts/multi-agent/agent-to-agent/
- AWS Bedrock AgentCore A2A Runtime: https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-a2a.html
- Implementation Examples: https://github.com/aarora79/amazon-bedrock-agentcore-samples/tree/feature/demo1-simple-dual-observability/01-tutorials/06-AgentCore-observability/07-simple-dual-observability
- Deployment Reference: https://github.com/awslabs/amazon-bedrock-agentcore-samples/tree/main/02-use-cases/SRE-agent
Objective
Create a Strands-based agent that manages flight reservations and bookings for a fictional airline.
Important Architecture Clarification
Agent Skills (Tools) work directly with embedded SQLite databases for all CRUD operations. There is NO API layer between agent tools and the database:
- Agent tools invoke Python SQLite methods directly
- Query results are returned immediately to the agent
- Agent skills receive calls from other agents via REST API (A2A protocol)
- Each agent has its own embedded SQLite database (not shared)
Tech Stack
- Framework: Strands (Python agentic framework)
- Database: SQLite (in-process, embedded, direct CRUD from agent tools)
- API: REST (A2A protocol - only for inter-agent communication)
- Container: Docker
Agent Skills (Tools)
These tools interact directly with the embedded SQLite database:
-
check_availability - Check seat availability for specific flight
- Direct SQLite: SELECT available_seats FROM flights WHERE id=?
- Returns: Number of available seats
-
reserve_flight - Reserve seats on a flight for passengers
- Direct SQLite: INSERT INTO bookings (...); INSERT INTO booking_passengers (...)
- Direct SQLite: UPDATE seat_inventory SET status='reserved' WHERE flight_id=?
- Returns: Booking number and reservation status
-
confirm_booking - Confirm and finalize a flight booking
- Direct SQLite: UPDATE bookings SET status='confirmed' WHERE booking_number=?
- Direct SQLite: UPDATE seat_inventory SET status='booked' WHERE seat_number IN (?)
- Returns: Confirmation code and final status
-
process_payment - Process payment (simulated, no real integration)
- Direct SQLite: INSERT INTO payments (...)
- Direct SQLite: UPDATE bookings SET status='paid' WHERE booking_number=?
- Returns: Transaction ID and payment status
-
manage_reservation - Update, view, or cancel existing reservations
- Direct SQLite: SELECT * FROM bookings WHERE booking_number=?
- Direct SQLite: UPDATE bookings SET status='cancelled' WHERE booking_number=?
- Direct SQLite: INSERT INTO cancellations (...)
- Returns: Updated reservation details
Data Flow
External Request (from Travel Assistant Agent)
↓
[Flight Booking Agent (Strands) - REST API receives request]
├─→ Skill: check_availability
│ └─→ Direct SQLite CRUD: SELECT from flights table
├─→ Skill: reserve_flight
│ └─→ Direct SQLite CRUD: INSERT bookings, passengers, seat_inventory
├─→ Skill: confirm_booking
│ └─→ Direct SQLite CRUD: UPDATE bookings, seat_inventory
├─→ Skill: process_payment
│ └─→ Direct SQLite CRUD: INSERT payments, UPDATE bookings
└─→ Skill: manage_reservation
└─→ Direct SQLite CRUD: SELECT/UPDATE bookings, INSERT cancellations
SQLite Schema
Bookings Table
CREATE TABLE bookings (
id INTEGER PRIMARY KEY,
booking_number TEXT UNIQUE NOT NULL,
flight_id INTEGER NOT NULL,
total_price DECIMAL(10,2),
status TEXT CHECK(status IN ('pending', 'confirmed', 'paid', 'cancelled')),
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
confirmed_at DATETIME,
FOREIGN KEY (flight_id) REFERENCES flights(id)
);Booking Passengers Table
CREATE TABLE booking_passengers (
id INTEGER PRIMARY KEY,
booking_id INTEGER NOT NULL,
passenger_name TEXT NOT NULL,
email TEXT,
seat_number TEXT,
FOREIGN KEY (booking_id) REFERENCES bookings(id)
);Payments Table
CREATE TABLE payments (
id INTEGER PRIMARY KEY,
booking_id INTEGER NOT NULL,
amount DECIMAL(10,2),
status TEXT CHECK(status IN ('pending', 'completed', 'failed')),
payment_method TEXT,
processed_at DATETIME,
FOREIGN KEY (booking_id) REFERENCES bookings(id)
);Seat Inventory Table
CREATE TABLE seat_inventory (
id INTEGER PRIMARY KEY,
flight_id INTEGER NOT NULL,
seat_row TEXT,
seat_column TEXT,
status TEXT CHECK(status IN ('available', 'reserved', 'booked')),
FOREIGN KEY (flight_id) REFERENCES flights(id)
);Cancellations Table
CREATE TABLE cancellations (
id INTEGER PRIMARY KEY,
booking_id INTEGER NOT NULL,
reason TEXT,
refund_amount DECIMAL(10,2),
cancelled_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (booking_id) REFERENCES bookings(id)
);Sample Data
Bookings
INSERT INTO bookings (booking_number, flight_id, total_price, status, created_at, confirmed_at) VALUES
('BK001', 1, 500.00, 'confirmed', '2025-11-01 10:00:00', '2025-11-01 10:15:00'),
('BK002', 1, 250.00, 'pending', '2025-11-01 11:00:00', NULL),
('BK003', 2, 560.00, 'confirmed', '2025-11-01 12:00:00', '2025-11-01 12:10:00'),
('BK004', 3, 440.00, 'confirmed', '2025-11-01 13:00:00', '2025-11-01 13:05:00');Booking Passengers
INSERT INTO booking_passengers (booking_id, passenger_name, email, seat_number) VALUES
(1, 'John Smith', 'john@example.com', '12A'),
(1, 'Jane Smith', 'jane@example.com', '12B'),
(2, 'Bob Johnson', 'bob@example.com', '14C'),
(3, 'Alice Williams', 'alice@example.com', '1A'),
(4, 'Charlie Brown', 'charlie@example.com', '5B');Payments
INSERT INTO payments (booking_id, amount, status, payment_method, processed_at) VALUES
(1, 500.00, 'completed', 'credit_card', '2025-11-01 10:15:00'),
(2, 250.00, 'pending', 'credit_card', NULL),
(3, 560.00, 'completed', 'credit_card', '2025-11-01 12:10:00'),
(4, 440.00, 'completed', 'paypal', '2025-11-01 13:05:00');Seat Inventory (Sample for Flight 1 - UA101)
INSERT INTO seat_inventory (flight_id, seat_row, seat_column, status) VALUES
(1, '1', 'A', 'booked'),
(1, '1', 'B', 'booked'),
(1, '1', 'C', 'available'),
(1, '1', 'D', 'available'),
(1, '12', 'A', 'booked'),
(1, '12', 'B', 'booked'),
(1, '12', 'C', 'available'),
(1, '12', 'D', 'available'),
(1, '14', 'C', 'booked'),
(1, '14', 'D', 'available');REST API Endpoints (A2A Protocol)
These endpoints receive requests from other agents (Travel Assistant Agent):
- POST /api/check-availability - Called by Travel Assistant to check seats
- POST /api/reserve-flight - Called by Travel Assistant to create reservation
- POST /api/confirm-booking - Called by Travel Assistant to finalize booking
- POST /api/process-payment - Called by Travel Assistant to process payment
- GET /api/reservation/{id} - Called by Travel Assistant to retrieve booking
- DELETE /api/reservation/{id} - Called by Travel Assistant to cancel booking
- GET /api/health - Health check endpoint
Note: These endpoints route requests to agent skills, which then use direct SQLite CRUD operations. There is NO intermediate API layer between skills and database.
Acceptance Criteria
- Built with Strands framework
- All skills (tools) use direct SQLite CRUD (no backend API)
- Registers with A2A Registry with appropriate tags
- Docker image builds and runs
- SQLite initialized with all schemas + seed data on startup
- Receives booking requests from Travel Assistant Agent via REST A2A API
- Manages seat inventory correctly via direct SQLite updates
- Simulated payment processing (no real integration)
- Error handling and logging for database operations
- Follows patterns from referenced repos
- Architecture clarification documented (no DB API layer)