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.
- Python
- TypeScript
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()
runner.listen_phone(agent_a, os.environ["GUAVA_AGENT_NUMBER"])
runner.listen_webrtc(agent_b)
runner.run()
run.ts
import * as guava from "@guava-ai/guava-sdk";
const agentA = new guava.Agent({ name: "Grace", purpose: "You are a helpful voice agent." });
const agentB = new guava.Agent({ name: "Jordan", purpose: "You are a helpful voice agent." });
const runner = new guava.Runner();
runner.listenPhone(agentA, process.env.GUAVA_AGENT_NUMBER!);
runner.listenWebrtc(agentB);
await runner.run();
Methods
- Python
- TypeScript
| Method | Returns | 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?) | Runner | Register an agent to accept WebRTC connections. A new code is generated if the 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 and block until they all exit. |
| Method | Returns | Description |
|---|---|---|
listenPhone(agent, agentNumber) | Runner | Register an agent to receive inbound calls on the given phone number. Returns self for chaining. |
listenWebrtc(agent, webrtcCode?) | Runner | Register an agent to accept WebRTC connections. A new code is generated if the code is omitted. Returns self for chaining. |
listenSip(agent, sipCode) | Runner | Register an agent to receive inbound SIP calls on the given SIP code. Returns self for chaining. |
attachCampaign(agent, campaignCode) | Runner | Attach an outbound campaign to an agent. Returns self for chaining. |
run() | Promise<void> | Start all registered channels and block until they all exit. |