Holochain Forum

How to run multiple agents and let them interact locally using `hc`?

Hello!

I would like to use hc to run multiple agents and let them interact locally.
Is there any way to do this?

Would really appreciate any help!
Thank you!!

Hi @tats_sato,

So the problem is that hc by default doesn’t configure any networking in the sandboxes, but that’s not hard to do. You can do it like this:

    hc sandbox generate workdir/happ/ -r=8888 network --bootstrap https://bootstrap-staging.holo.host/ quic

This will run an agent pointing to the staging bootstrap, which is the one aligned with our newer versions. If you want to include also a proxy server (mainly to do testing accross the whole internet, not just your LAN), do this:

    hc sandbox generate workdir/happ/ -r=8888 network --bootstrap https://bootstrap-staging.holo.host/ quic -p=kitsune-proxy://t9471bRVOKH-HMInwG5jqwk3KBiiSmiEhy6F5Cu_8ys/kitsune-quic/h/52.14.147.62/p/22224/--

Also if you’re curious, I encourage you to dive into the help for the subcommands of hc, it’s quite useful and exhaustive.

4 Likes

Hi @guillemcordoba!

Awesome this worked!!
And will definitely explore the hc help more!

Thanks so much for your help!!

2 Likes

Here is what I use in SnapMail to launch a local network of 3 agents:

    "sandbox-create": "rm -rf ~/tmp && mkdir ~/tmp && hc s clean && hc s create --root ~/tmp/ -n 3 network -b https://bootstrap-staging.holo.host/ quic && hc s call 0 1 2 install-app-bundle ../snapmail-rsm/snapmail.happ",
    "sandbox-run": "WASM_LOG=debug RUST_LOG=warn hc s run --all -p 8880 8881 8882",
5 Likes

Thank you! @ddd-mtl!