How can I define styles for content boxes?

I am having trouble to define a style for content boxes.
In the code snippet below I want to display a blue rectangle box next to the white circle.
My goal is to define a style that I can than reuse multiple times such that I dont have to type it over and over again. I can not figure out how to do this. Maybe you can point me in the right direction?

#import "@preview/cetz:0.5.0"

#cetz.canvas({
    import cetz.draw: *

    content((0,0),[$x=5$],frame:"circle",padding:2pt,fill:white)

    let agent_style = (frame:"rect",padding:2pt,fill:blue)
    content((5,0),[$z=9$],style:agent_style)
})

Almost! Have a look at this:

#cetz.canvas({
  import cetz.draw: *

  content((0, 0), [$x=5$], frame: "circle", padding: 2pt, fill: white)

  // option 1: spread style arguments
  let agent_style = (frame: "rect", padding: 2pt, fill: blue)
  content((5, 0), [$z=9$], ..agent_style)

  // option 2: set default style for content
  set-style(content: (frame: "rect", padding: 2pt, fill: red))
  content((7, 0), [$z=9$])

  group({
    // set-style is scoped: it only applies to the current group
    set-style(content: (frame: "rect", padding: 2pt, fill: orange))
    content((9, 0), [$z=9$])
  })
})

Thank you very much, for these options. The first option is what I was looking for.

Now though, I would like to have rounded corners in that style, too. I thought I could make this happen as described here:
https://cetz-package.github.io/docs/api/draw-functions/shapes/rect

But it seems like this doesnt work in the definition of my agent_style.

Do you have a solution for that, too?

I have tried this:

// imports
#import "@preview/cetz:0.5.0"
#cetz.canvas({
    import cetz.draw: *
    let agent_style = (frame:"rect",padding:2pt,fill:blue,radius:10%)
    
    content((0,0),[$x=5$],frame:"circle",padding:2pt,fill:white)

    content((5,0),[$z=9$],..agent_style)
})

It is not throwing an error, but it is not rounding the corners either.

I don’t think you can do this with one element in CeTZ, but you can always write a function to define a more complex element, like so:

// imports
#import "@preview/cetz:0.5.0"

#context cetz.canvas({
    import cetz.draw: *
    let agent_style = (frame:"rect",padding:2pt,fill:blue,radius:10%)

    let node(pos, body, inset: 10pt, ..args) = {
      let (width, height) = measure(body)
      width += inset
      height += inset
      group({
        translate(pos)
        rect((-width/2, -height/2), (width/2, height/2), radius: 5pt, ..args)
        content((0,0), body)
      })
    }

    node((0,0), $x=3$, fill: blue.lighten(50%))
    node((3,0), $x=6$, fill: orange.lighten(50%))
})

The node function is just content with a separete rounded rectangle frame.
You may also be interested in fletcher for drawing simple “node and edge” style diagrams, depending on your needs.