Documentation | Guava
get_field()
After the checklist completes and agent.on_task_complete fires, use call.get_field() to retrieve collected values by their key. This is where you write results to your CRM, database, or EHR.
Signature
def get_field(field_key: str) -> str | int | dict | None
Example
@agent.on_task_complete("schedule_appointment")
def on_appointment_scheduled(call: guava.Call):
appointment_time = call.get_field("appointment_time")
patient_name = call.get_field("patient_name")
# Write to your CRM / EHR
save_appointment(patient_name, appointment_time)
call.hangup()
Return types by field type
The type of the value returned by get_field() depends on the field's field_type:
field_type |
Returned value |
|---|---|
text |
str |
date |
dict with keys year, month, day (all int) |
integer |
int |
multiple_choice |
str (guaranteed to be one of the values in choices or returned by choice_generator) |
calendar_slot |
ISO-8601 datetime string (e.g. "2022-12-25T16:30") |
Tip: You can call get_field() at any point after the field has been collected — not just in on_task_complete. Use it in mid-call callbacks to personalize subsequent steps.