Define the Agent
guava.Agent is our starting point for building Guava agents. We’ll create one with a name and purpose scoped to the restaurant.
Accept or reject the call
on_call_received fires before the call starts and gives you a chance to accept or reject based on caller info. Here we accept all calls.
If you don’t register
on_call_received, Guava accepts all calls by default. Implement it only when you need to screen callers or look up information based off the incoming phone number.Set up the form
on_call_start fires at the beginning of every accepted call. We use set_task to hand the agent a structured checklist of fields to collect. The agent gathers each piece of information conversationally — it knows when all fields are filled and automatically moves on.
The checklist can mix
Field objects (typed, named values the agent extracts) with plain strings (freeform instructions the agent follows). Fields are retrievable later via get_field().Handle task completion
on_task_complete fires once every field in the checklist is collected. This is the right place to save the data to your backend, trigger a notification, or hang up.