Skip to content
Pine Computer Request access
Menu

Blog

Cookbook 02: Give it a goal

Hand the computer a goal in plain words, follow its notes while it works, and read its answer.

By The Pine Computer team

Cookbook 02: Give it a goal

Instead of steering the browser one step at a time, the program hands the computer a goal and follows along: the cheapest day next week to take the train from London to Paris, for two adults.

It compared the days on the operator’s own site and answered with the day, the time and the price. It stopped before any passenger or payment details. The film shortens a run of about four and a half minutes.

Ruby
computer = pine.create_computer
session  = computer.create_session(browser: true)

session.agent.run("Find the cheapest day next week to take the train
  from London to Paris for two adults. Tell me the day, time and price.")

session.agent.events do |e|
  note = e.type == "step" && e.payload["phase"] == "commentary"
  puts "· #{e.payload["text"]}" if note
  break if e.terminal?
end
puts session.agent.result["summary"]

gets  # press Enter to stop
computer.stop

The events say what it’s doing as it goes, and the result holds its answer. More in the docs.

More from the blog

Build more.
Hand AI the work.

Pine Computer is invite-only while in beta.