Documentation | Guava

Runner

guava.Runner lets you serve multiple agents in a single process. Each agent can be attached to any number of channels — phone, WebRTC, SIP, or outbound campaigns. Call run() to start everything and block until all channels exit.

run.py

import os
from guava import Agent, Runner

agent_a = Agent(name="Grace", purpose="You are a helpful voice agent.")
agent_b = Agent(name="Jordan", purpose="You are a helpful voice agent.")

runner = Runner()
running.listen_phone(agent_a, os.environ["GUAVA_AGENT_NUMBER"])
running.listen_webrtc(agent_b)
running.run()

Methods

Parameter Type Default Description
listen_phone(agent, agent_number) Runner — Register an agent to receive inbound calls on the given phone number. Returns self for chaining.
listen_webrtc(agent, webrtc_code=None) Runner — Register an agent to accept WebRTC connections. A new code is generated if webrtc_code is omitted. Returns self for chaining.
listen_sip(agent, sip_code) Runner — Register an agent to receive inbound SIP calls on the given SIP code. Returns self for chaining.
attach_campaign(agent, campaign) Runner — Attach an outbound campaign to an agent. Returns self for chaining.
run() None — Start all registered channels in daemon threads and block until they all exit.