Correctly using the new Xively code on Github?

I see that I’m supposed to abandon the planner and adopt the new Xively code posted on Github:
https://github.com/electricimp/reference/tree/master/webservices/xively

I’m having some trouble getting the code to work and I’m really just asking a few simple questions about where to place this code, mainly to make sure I get on the right track.

Am I correct in thinking that this code below (minus the Get Data section since I’m only graphing data online) is placed in my DEVICE code area, edited as suggested with correct key and feed id?:
https://github.com/electricimp/reference/tree/master/webservices/xively

And am I correct that the code listed on this page is placed in the Agent code area, totally unedited?:
https://github.com/electricimp/reference/blob/master/webservices/xively/xivelyClient.agent.nut

Or am I way off? I’m getting a lot of “[Device] ERROR: the index ‘Xively’ does not exist” messages.

I had an Imp working with 5 Thermistors a few days ago, posting 5 channels to Xively. It’s not working this morning, so I’m taking a stab at using the new code and abandoning the planner, as directed.

Thanks.

I use this code:
https://gist.github.com/marcboon/5634981
works very well

Everything in the agent.nut file is agent code. None of it is device code.

This is the code that is used in the Adafruit tutorial I wrote that pushes thermocouple data to Xively. There is quite a bit code here, including Xively and Twitter code so you’ll need to look through it carefully.

The key to moving past using the planner is to learn how to use these functions to communicate between the agent and the device:
agent.send(), agent.on()
device.send(), device.on()

Thanks DolfTraanberg and Jwehr. I appreciate the links and help. I’ll be taking another look at this later tonight.