Loading the notebook…
Loading the notebook…
Notebooks · First agents · 08
Use this notebook to test AskUserTool and the runtime's clarification request pattern.
Its imports and arguments are checked against shipit-agent 3.0. The outputs were saved when it was written, for an earlier release.
from pathlib import Path
import sys
import json
ROOT = (
Path.cwd().resolve().parent
if Path.cwd().name == "notebooks"
else Path.cwd().resolve()
)
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from examples.run_multi_tool_agent import build_llm_from_env
from shipit_agent import Agent, AskUserToolllm = build_llm_from_env("bedrock")
agent = Agent(
llm=llm,
tools=[AskUserTool()],
name="ask-user-demo",
)
for event in agent.stream(
"If the request is ambiguous, ask the user a precise follow-up question before answering."
):
print(json.dumps(event.to_dict(), indent=2, default=str))In a UI integration, watch for interactive_request packets with kind='ask_user' and route them to your form, modal, or chat prompt.