Skip to content

vjug/InMyDataPUG2025Boston

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenEdge × LiveKit AI Agent Workshop

Build an AI agent that reads and writes to a Progress OpenEdge database and books automotive service appointments. This workshop is designed for OpenEdge developers with no prior Python/agent experience. You’ll follow a guided path, copying working examples at each step and learning how they fit together.

We’ll use PASOE REST services for data access, a small Python driver to call those services, and a LiveKit agent (with OpenAI) that converses with users, manages car records, and schedules bookings. We’ll initially run the agent through the LiveKit Agents Playground and if time, implement a React front end and python token service to complete the app.


What You’ll Build

  • OpenEdge REST services for Car and Booking records.
  • A small, testable Python driver (OEDatabaseDriver) that calls those REST endpoints.
  • A LiveKit agent that uses function tools to call your driver:
    • Lookup/add car details.
    • Offer/confirm bookings.
  • A multi-agent version showing a handoff from an Account agentBooking agent.
  • (Optional, if time permits) A lightweight React + Token server demo UI.

You’ll copy the code for each step from the provided examples/ folders and focus on wiring/config + understanding.


Prerequisites

You’ll place secrets in a local .env file during setup.


Useful Links


Repository Layout (at a glance)

/openedge/            # ABL handlers/services templates for Car/Booking and test app
/python/
  /step2/             # OEDatabaseDriver env sanity-check
  /step3/             # save_car() via POST
  /step4/             # get_car() via GET + dataclass
  /step5/             # Single-agent (car lookup/add) with LiveKit
  /step6/             # Adds booking tools + driver methods
  /step7/             # Multi-agent architecture AccountAgent → BookingAgent handoff
/frontend/            # (Optional) React demo UI
/token-server/        # (Optional) LiveKit token server (Python)
README.md

Workshop Steps (copy code from examples; focus on config + understanding)

Step 1: OpenEdge Setup – Server, Database, and REST Service

  1. Create working directories:
    C:\OpenEdge\WRK\oeautos
    C:\OpenEdge\WRK\oeautos\db
    
  2. Create an empty database:
    prodb oeautos empty
    
  3. Load schema file:
    load oeautos.df
    
  4. Add oeautos database to Progress OE Explorer and start it (make a note of the port number i.e 25150).
  5. Create a new Progress Application Server with the following settings:
    • Instance name: oeautos
    • AdminServer: localhost
    • Location: Local
    • Security model: Developer
    • Autostart: checked
  6. Edit the oeautos ABL application configuration:
    • Startup parameters: -db oeautos -H localhost -S 25150
    • Add C:\OpenEdge\WRK\oeautos to PROPATH
  7. Start the AppServer.
  8. In OE Developer:
    • Choose C:\OpenEdge\WRK\oeautos as the new workspace
    • Create a new OpenEdge project named AgentTools
    • Server project
    • Transport: REST
    • Finish → Open Perspective
    • Delete Defined ServicesAgentToolsService (we will create are own')
  9. Add database to project:
    • Right-click project → PropertiesProgress OpenEdgeDatabase Connections → Configure database connections
    • Click New to add new connection for oeautos server.
    • Connection name: oeautos
    • Physical name: db\oeautos
    • Host name: localhost
    • Service/Port: 25150
    • Press Next to Finish, then Apply and Close
    • Select checkbox next to the new connection, Apply and Close
  10. Add Server to project:
  • Right-click project → NewServer
  • Select Progress Software CorporationProgress Application Server for OpenEdge, and press Next
  • Select oeautos PAS and press Finish
  1. Add a new webhandler:
    • Name: carRestHandler
    • Unselect all method stubs
    • Copy in template code
  2. Add REST service:
    • Right-click project → NewABL Service
      • Transport: REST
      • Name: carService
      • Relative URI: /carService
  3. Add saveCar resources:
    • select carService in Project Explorer
    • press the green + button to the right of ABL Resources
    • Resource URI: /saveCar
    • Press OK
    • Select ... to the right of Verb='POST'
    • Select Resource PASOEContentWEB-INFopenedgecarRestHandler.cls
    • Select ABL routines → saveCar
    • Press OK
    • In Mapping ResourcesInputHTTP Message, right click Form Parameters and select Add Node
    • Type: Form Parameter
    • Form Parameter: reg
    • In Mapping ResourcesInputHTTP MessageForm Parameters left click over reg and drag the connector to ParametersInterface Parametersreg
    • Repeat to add and bind Form Parameters for make, model and year
    • Select the Output tab under Mapping Resources
    • Drag a connector from Mapping ResourcesOutputParametersInterface Parametersresponse to Mapping ResourcesOutputResponseHTTP MessageBody (NB: Be careful to drag the connector to the line that contains 'Body', not the line below that displays [Drop a parameter here...])
  4. Add getCar resources:
    • select carService in Project Explorer
    • press the green + button to the right of ABL Resources
    • Resource URI: /getCar
    • Press OK
    • Select ... to the right of Verb='GET'
    • Select Resource PASOEContentWEB-INFopenedgecarRestHandler.cls
    • Select ABL routines → getCar
    • Press OK
    • In Mapping ResourcesInputURL Parameters, right click Query String Parameters and select Add Node
    • Type: Query String Parameter
    • Query String Parameter: reg
    • In Mapping ResourcesInputURL ParametersQuery String Parameters left click over reg and drag the connector to ParametersInterface Parametersreg
    • Drag a connector from Mapping ResourcesOutputParametersInterface ParametersttCar to Mapping ResourcesOutputResponseHTTP MessageBody (NB: Be careful to drag the connector to the line that contains 'Body', not the line below that displays [Drop a parameter here...])
  5. Publish the service to the oeautos server:
    • Save carService changes
    • In the Servers panel, right click oeautos in .. and select Add and Remove
    • Select carService in the Available list, and press Add>
    • Press Finish

Step 2: Python Driver – Environment & Connectivity

  1. Install VSCode and Python (if you don't already have them).
  2. Create directory C:\Work\Agent and open folder in VSCode
  3. Create and activate a virtual environment:
    py -m venv .venv
    .\.venv\Scripts\activate
  4. Create a C:\work\Agent\requirements.txt file and add:
    python-dotenv
    
    Then install:
    pip install -r requirements.txt
  5. Create a .env file with:
    OE_SERVICE_URL=http://localhost:8080/AgentTools/rest/
    
  6. Copy OEDatabaseDriver.py Step 2 code to C:\Work\Agent\OEDatabaseDriver.py (load .env and print OE_SERVICE_URL).
  7. Run the code to test
 py OEDatabaseDriver.py

Step 3: Python Driver – Saving Cars

  1. Copy requirements.txt and OEDatabaseDriver.py from Step 3 into C:\work\Agents. Note 'requests' has been added to requirements.txt and OEDatabaseDriver.py now shows errors
  2. Install new dependencies
    pip install -r requirements.txt
  3. Review save_car method
  4. Run the code to test
 py OEDatabaseDriver.py
  1. Use OpenEdge\ViewCars.w to confirm record has been created

Step 4: Python Driver – Retrieving Cars

  1. Copy OEDatabaseDriver.py from Step 4 into C:\work\Agents.
  2. Review get_car method
  3. Run the code to test
 py OEDatabaseDriver.py

Step 5: Introducing the AI Agent (LiveKit Integration)

  1. Copy contents of Step 5 into c:\work\Agent
  2. Install new dependencies
    pip install -r requirements.txt
  3. Create a LiveKit account:
    • Goto https://livekit.io
    • Click Start Building
    • Create account
    • Create you first project: name 'PUG Challenge'
    • Complete survey
    • SettingsAPI Keys
    • Select API Key
    • Press Reveal Secret
    • Copy Environmental Variables
    • Paste into .env
  4. Create an OpenAI account
    • Create an account at https://platform.openai.com/ (you will need to add some credit. $5 is plenty.)
    • Click cog icon (top right)
    • Select API keys
    • press + Create new secret key
    • Copy secret
    • Add OPENAI_API_KEY=[YOUR KEY] to .env and save
  5. Review code
  6. Start agent:
 py main.py dev
  1. Log into https://agents-playground.livekit.io/ and connect
  2. Check the agent can create a car in the DB. Disconnect, and re-connect, check the agent can look up a car.

Step 6: Booking Functionality

  1. Add new OpenEdge web handler for bookings (bookingRestHandler), copy code from Step 6
  2. Add new ABL Service (bookingService)
  3. Add REST resource (getNextAvailableBooking), GET verb bound to GetNextAvailableBooking, with input query parameter startDate, and output bookingDate to the Body.
  4. Add REST resource (saveBooking), POST bound to verb bound to SaveBooking, with form parameters reg, bookingDate and description and output response bound to Body.
  5. ADD REST resource (getBooking), GET verb bound to GetBooking, with query parameter reg, and output parameters BookingDate and Description bound to the Body parameters Note: You need to bind these parameters to the parameters section of the body ([Drop a parameter here]), not the body itself
  6. Save your changes, and publish to the server.
  7. Copy in code from STEP 6 and review.
  8. Start agent:
 py main.py dev
  1. Log into https://agents-playground.livekit.io/ and connect
  2. Check the agent can create a booking in the DB. Disconnect, and re-connect, check the agent can look up a booking.

Step 7: Multi-Agent Architecture

  1. Copy in code from STEP 7 and review.
  2. Start agent:
 py main.py dev
  1. Log into https://agents-playground.livekit.io/ and check agent behaviour

(Optional) Bonus: React Frontend + Token Server

Step 8: Frontend (optional)

  1. If you don’t already have it, download and install node.js https://nodejs.org/
  2. Open new cmd and cd to C:\Work
  3. Run command
npm create vite@latest frontend -- --template react
  1. Open frontend directory in a new VSCode window
  2. Install dependencies:
    npm install
    npm install @livekit/components-react @livekit/components-styles livekit-client --save
  3. Delete “C:\Work\frontend\src\assets” and “C:\Work\frontend\public” folders
  4. Copy in contents of frontend\step 1
  5. Log in to https://LiveKit.io, got settings..API Keys .. Generate Token
  6. Copy token to line 16 of src/components/LiveKitModal.jsx
  7. Create a .env file and enter
VITE_LIVEKIT_URL=[YOUR LIVEKIT URL]
  1. Run front end with
 npm run dev

Step 9: Token Server (optional)

  1. Create directory C:\work\TokenServer
  2. Open a new VSCode window, and open directory C:\work\TokenServer
  3. New Terminal
  4. Create virtual environment
py -m venv .venv 
  1. Activate the virtual environment
.\.venv\Scripts\activate
  1. copy contents of TokenServer from the workshop files
  2. Install requirements
pip install -r requirements.txt
  1. Enter livekit values into .env
  2. Start server
py server.py
  1. Copy contents of frontend\step 2
  2. Run frontend with
npm run dev”

Testing the Agent (suggested flow)

In the LiveKit Agents Playground:

  1. The agent greets and asks for your registration.
  2. Provide a reg (e.g., AB12 CDE).
    • If found, it shows car details.
    • If not, it asks for make, model, year and adds the car.
  3. The agent asks if you’d like to book an appointment or check existing.
  4. Try “Book me in for the next available date for an annual service.”
    • Agent retrieves next slot, confirms, and saves the booking.
  5. Ask “What’s my next booking?” to verify.

Environment & Scripts

  • Python venv: keep dependencies isolated (python -m venv .venv → activate → pip install -r requirements.txt).
  • .env: never commit secrets; store OE_SERVICE_URL, LiveKit & OpenAI keys locally.
  • Run steps: each python/stepX folder contains a small script (main.py or similar) to run that step.

Troubleshooting

  • PASOE service not reachable: confirm it’s published, note the correct port/context, and that OE_SERVICE_URL ends with /rest/.
  • LiveKit connection: verify LIVEKIT_URL, LIVEKIT_API_KEY, and LIVEKIT_API_SECRET in .env.
  • OpenAI: ensure OPENAI_API_KEY is set and your model name is valid for your account.

Appendix A — Python Intro for OpenEdge Developers (Quick Notes)

  • Whitespace = blocks (no END.). Indentation is syntax.
  • Run files directly (python myfile.py); manage deps with venv + pip (requirements.txt).
  • Functions use def and return values directly (multiple returns via tuples).
  • Dataclasses (@dataclass) create light DTOs for records like Car.
  • Requests library is the go‑to for HTTP calls (requests.get/post, r.json()).
  • OO Basics: class, __init__, self (like THIS-OBJECT, but explicit). Inherit with class Sub(Super):.

License

MIT


Acknowledgements

  • LiveKit Agents
  • Progress OpenEdge
  • OpenAI

About

Examples and source for our PUG Challenge 2025 Workshop

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 57.8%
  • OpenEdge ABL 25.6%
  • JavaScript 10.0%
  • CSS 6.1%
  • HTML 0.5%