## Task

A task is the unit of work your agent completes on a call. Call `call.set_task()` to direct the agent toward a new goal. You can invoke `call.set_task()` on one of your handler callbacks, or at any time (even on another thread).

### Checklist items

The checklist drives the agent forward. Each item is one of three types:

| Type | Purpose |
| --- | --- |
| `guava.Field` | Collect structured data from the caller |
| `guava.Say` | Speak a verbatim statement |
| `str` | Natural language instruction for the agent |

### Example

```python
@agent.on_call_start
def on_call_start(call: guava.Call):
    call.set_task(
        "waitlist",
        objective="You are a virtual assistant for Thai Palace. Add callers to the waitlist.",
        checklist=[\
            guava.Field(key="caller_name", field_type="text", description="Name for the waitlist"),\
            guava.Field(key="party_size", field_type="integer", description="Number of people"),\
            guava.Field(\
                key="phone_number",\
                field_type="text",\
                description="Phone number to text when the table is ready",\
            ),\
            "Read the phone number back to the caller to confirm.",\
        ],
    )

@agent.on_task_complete("waitlist")
def on_waitlist_done(call: guava.Call):
    logger.info("Added %s, party of %d, to waitlist.",
        call.get_field("caller_name"), call.get_field("party_size"))
    call.hangup("Thank the caller and let them know we'll text when their table is ready.")
```
