00: Minimal Chatbot
Do not start with agents. Start with the smallest chatbot: send messages to a model and get text back.
from __future__ import annotations
from pathlib import Path
from agent_patterns_lab.runtime import Message, MockLLM, Tracer
def main() -> None:
tracer = Tracer()
model = MockLLM(
[
(
"A relaxed Hangzhou day: visit West Lake in the morning, "
"try local snacks near Hefang Street, and bring comfortable shoes."
)
]
)
messages = [
Message(
role="user",
content="Plan a relaxed one-day Hangzhou trip. I like tea, local food, and easy walking.",
)
]
answer = model.complete(messages, tracer=tracer)
print(answer)
trace_path = tracer.export_jsonl(Path(".traces") / "00_single_shot.jsonl")
print(f"[trace] {trace_path}")
if __name__ == "__main__":
main()
Run:
uv run python examples/00_single_shot.py
This is useful, but limited: it has no current facts, no stable structure, no tools, and no replayable reasoning path.
Next: 01: Conversation History.