headless tools

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:59 AM on 8/5/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

21 Terms

1
New cards
Where should some tools run instead of inside the server process; according to the notes?
Where the user's app runs — typically the browser.
2
New cards
What are headless tools?
Tool definitions (name; description; argument schema) that are registered on the server with the agent; while the implementation is registered only on the client and executed after a short interrupt/resume handshake.
3
New cards
How do headless tools differ from ordinary tools?
Ordinary tools have their function body executed on the server; whereas headless tools have no in-process implementation — execution happens on the client.
4
New cards
How do headless tools differ from server-side tool use?
In server-side tool use; the model provider itself executes built-in tools remotely; with headless tools; execution happens outside the server process entirely (e.g. in a browser; another service; or via a human action).
5
New cards
What kinds of browser APIs are given as examples of when headless tools are needed?
Geolocation; IndexedDB; Clipboard; Canvas 2D; file pickers; Battery API.
6
New cards
Why might headless tools be preferred for privacy and locality?
Because data stays on the device; for example local memory in IndexedDB.
7
New cards
Why might headless tools reduce latency?
Because there's no extra server round-trip needed for purely local operations.
8
New cards
What is preferred over sending arbitrary code to `eval` for structured; safe effects?
Many small; typed tools — for example one tool per canvas primitive.
9
New cards
What are the four steps of the headless tool pattern?
1) Define the headless tool via `tool(name=...; description=...; args_schema=...)` with no implementation. 2) Register it with `create_agent` or the LangGraph graph. 3) Handle the interrupt payload when the tool is invoked. 4) Resume the graph after the action is performed.
10
New cards
What does a headless tool have; and what does it lack; compared to an ordinary tool definition?
It has only a schema (name; description; args_schema) — it has no in-process implementation.
11
New cards
What happens when the model issues a tool call for a headless tool; instead of the tool executing locally?
The run interrupts; and the graph pauses with a payload shaped like `{'type': 'tool'; 'tool_call': {'id'; 'name'; 'args'}}`.
12
New cards
After a headless tool's interrupt payload is handled; what must happen to continue the graph?
The graph must be resumed with the tool result; after the app; another service; or a human step performs the action.
13
New cards
For browser-based flows; how can the schema be connected to a client-side implementation?
By mirroring the schema in the frontend and attaching `.implement(...)` there.
14
New cards
What can supported JS SDK hooks do automatically regarding headless-tool interrupts?
They can detect headless-tool interrupts; run the matching client implementation; and submit the resume command automatically.
15
New cards
Why are headless tools needed for payment operations; according to the notes?
Because money can't be charged without user confirmation in the UI.
16
New cards
Why are headless tools needed for human-in-the-loop scenarios?
Because a human needs to review or approve the LLM's action.
17
New cards
python from langchain.tools import tool headless_tool = ________( name='confirm_payment'; description='Ask user to confirm a payment in the browser'; args_schema=PaymentConfirmInput )
```python from langchain.tools import tool headless_tool = tool( name='confirm_payment'; description='Ask user to confirm a payment in the browser'; args_schema=PaymentConfirmInput ) ```
18
New cards
python agent = create_agent( model=llm; tools=[________; get_weather; search_web] )
```python agent = create_agent( model=llm; tools=[headless_tool; get_weather; search_web] ) ```
19
New cards
json { 'type': '________'; 'tool_call': { 'id': 'call_abc123'; 'name': 'confirm_payment'; 'args': {'amount': 100; 'currency': 'USD'} } }
```json { 'type': 'tool'; 'tool_call': { 'id': 'call_abc123'; 'name': 'confirm_payment'; 'args': {'amount': 100; 'currency': 'USD'} } } ```
20
New cards
javascript const confirmPaymentTool = headlessToolSchema.________(async (args) => { const confirmed = await showPaymentModal(args.amount; args.currency); return { confirmed }; });
```javascript const confirmPaymentTool = headlessToolSchema.implement(async (args) => { const confirmed = await showPaymentModal(args.amount; args.currency); return { confirmed }; }); ```
21
New cards
python agent.________( tool_call_id='call_abc123'; result={'status': 'confirmed'; 'transaction_id': 'txn_456'} )
```python agent.resume( tool_call_id='call_abc123'; result={'status': 'confirmed'; 'transaction_id': 'txn_456'} ) ```