> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goguava.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# get_field()

> Retrieve values collected by the agent

<Tabs>
  <Tab title="Python">
    After the checklist completes and [`agent.on_task_complete`](/sdk-reference/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.

    ```python signature theme={null}
    def get_field(field_key: str) -> str | int | dict | None
    ```

    ```python example.py theme={null}
    @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()
    ```
  </Tab>

  <Tab title="TypeScript">
    After the checklist completes and [`agent.onTaskComplete`](/sdk-reference/on-task-complete) fires, use `call.getField()` to retrieve collected values by their key. This is where you write results to your CRM, database, or EHR.

    ```typescript signature theme={null}
    getField(key: string): Promise<any | null>
    ```

    ```typescript example.ts theme={null}
    agent.onTaskComplete("schedule_appointment", async (call: guava.Call) => {
      const appointmentTime = await call.getField("appointment_time");
      const patientName = await call.getField("patient_name");
      // Write to your CRM / EHR
      saveAppointment(patientName, appointmentTime);
      await call.hangup();
    })
    ```
  </Tab>
</Tabs>

## Return types by field type

<Tabs>
  <Tab title="Python">
    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 a search result) |
    | `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.
    </Tip>
  </Tab>

  <Tab title="TypeScript">
    The type of the value returned by `getField()` depends on the field's `fieldType`:

    | `fieldType` | Returned value |
    | - | - |
    | `text` | `string` |
    | `date` | object with keys `year`, `month`, `day` (all `number`) |
    | `integer` | `number` |
    | `multiple_choice` | `string` (guaranteed to be one of the values in `choices` or returned by `choiceGenerator`) |
    | `calendar_slot` | ISO-8601 datetime string (e.g. `"2022-12-25T16:30"`) |

    <Tip>
      You can call `getField()` at any point after the field has been collected — not just in `onTaskComplete`. Use it in mid-call callbacks to personalize subsequent steps.
    </Tip>
  </Tab>
</Tabs>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.