> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# RequestList

> Keep a list of what the caller asked for while the agent was busy, so the agent takes each request up afterward.

[refresh-step]: /docs/server-sdks/reference/python/agents/function-result/refresh-step

`RequestList` keeps a list, in the call's `global_data`, of what the caller asked for
while the agent was busy with another task. A tool notes each request with
[`note()`](/docs/server-sdks/reference/python/agents/patterns/request-list/note), and
the agent tells the caller it's noted for right after this. Step text shows the list as
`${global_data.<global_key>_text}`, so once the current task is done, the agent takes
up each request in order.

The model hears of each new request in the tool result. Current platform releases
expand step text again when a value it reads changes, so the list shows in the step's
text at the next request. Earlier releases and realtime models keep the text from when
the step was entered; return [`refresh_step()`][refresh-step] with the note to show the
list there at once.

```python
from signalwire.patterns import RequestList
```

## Parameters

**`global_key`** `str` — required

The `global_data` key the list is kept under. The list's text for step text is kept
under `<global_key>_text`.

---

**`openers`** `Mapping[str, str] | None` — default: None

Keyword-only. How the agent opens each kind of request when it takes it up, keyed by
kind. `{about}` in an opener is replaced with what the request is about. A kind
without an opener opens with what it's about.

---

**`heading`** `str` — default: Noted for right after this:

Keyword-only. The first line of the list's text.

---

## Methods

#### [as_text](/docs/server-sdks/reference/python/agents/patterns/request-list/as-text)

Render a list of requests as step text.

#### [defaults](/docs/server-sdks/reference/python/agents/patterns/request-list/defaults)

Return the global data to start a call with.

#### [done](/docs/server-sdks/reference/python/agents/patterns/request-list/done)

Remove the oldest request once it has been taken up.

#### [next](/docs/server-sdks/reference/python/agents/patterns/request-list/next)

Return the oldest request with its opener.

#### [note](/docs/server-sdks/reference/python/agents/patterns/request-list/note)

Note a request to come back to, and tell the model.

#### [opener](/docs/server-sdks/reference/python/agents/patterns/request-list/opener)

Return how the agent opens a request.

#### [pending](/docs/server-sdks/reference/python/agents/patterns/request-list/pending)

Return the requests a call has noted, oldest first.

## Example

```python {6-8,11,14,24}
from signalwire import AgentBase, FunctionResult
from signalwire.patterns import RequestList

agent = AgentBase(name="desk", route="/desk")
agent.prompt_add_section("Role", "You take orders and note other requests.")
later = RequestList("later", openers={"balance": "You also asked about your balance.",
                                      "question": "You had a question: {about}."})
agent.set_global_data(later.defaults())

def note_request(args, raw_data):
    return later.note(raw_data, args["kind"], args["about"])

def finish_request(args, raw_data):
    return later.done(raw_data, FunctionResult("Done with that request."))

agent.define_tool("note_request", "Note something the caller asked for, to take up after the order",
                  {"type": "object",
                   "properties": {"kind": {"type": "string", "enum": ["balance", "question"]},
                                  "about": {"type": "string"}},
                   "required": ["kind", "about"]}, note_request)
agent.define_tool("finish_request", "Mark the first noted request as taken up",
                  {"type": "object", "properties": {}}, finish_request)
ctx = agent.define_contexts().add_context("default")
ctx.add_step("take_order").set_text("Take the caller's order.\n\n${global_data.later_text}")
agent.serve()
```