docs: add multi-tool agent tutorial#46
Conversation
| guides/matchers-and-resolvers | ||
| guides/mock-builder | ||
| guides/call-recording | ||
| guides/multi-tool-agent-tutorial |
There was a problem hiding this comment.
This tutorial is an end-to-end guide that builds on concepts from quickstart, matchers, call-recording, etc. It would make more sense to place it after the individual concept guides (near the end of the toctree), not in the middle between call-recording and context-aware-mocks.
ChiefArchitect
left a comment
There was a problem hiding this comment.
This is a well-structured, comprehensive tutorial that fills a real gap — showing how all the StuntDouble pieces fit together in a realistic multi-tool scenario. The writing is clear and the progression from setup through assertions is logical.
| @@ -0,0 +1,491 @@ | |||
| # End-to-End Multi-Tool Agent Tutorial | |||
There was a problem hiding this comment.
The tutorial doesn't mention the Python 3.12+ requirement from the project conventions. A brief note at the top (or in prerequisites) would help.
| }, | ||
| ) | ||
|
|
||
| errors = validate_registry_mocks([get_customer, list_bills, create_invoice], config["configurable"]["scenario_metadata"]) |
There was a problem hiding this comment.
validate_registry_mocks signature mismatch
The actual signature is:
def validate_registry_mocks(tools: list[BaseTool], scenario_metadata: dict) -> dict[str, list[str]]
But the test
errors = validate_registry_mocks([get_customer, list_bills, create_invoice],config["configurable"]["scenario_metadata"])
| ) | ||
|
|
||
| builder = StateGraph(MessagesState) | ||
| builder.add_node("agent", agent_node) # your LLM / planner node |
There was a problem hiding this comment.
Add a clear comment like # your LLM node — see langgraph-integration.md with an explicit note that this is left to the reader
| registry = MockToolsRegistry() | ||
| registry.register_data_driven("get_customer") | ||
| registry.register_data_driven("list_bills") | ||
| registry.register("create_invoice", mock_fn=failing_invoice_mock) |
There was a problem hiding this comment.
mock_fn is a positional arg, not keyword-only. using mock_fn=failing_invoice_mock works but is slightly unusual — this is fine since Python allows passing positional args as kwargs.
|
@ChiefArchitect
|
|
Thanks @zeel2104, looks good, we may need to tweak it a bit in the future, Thanks for the help! |
Checklist
🚨 Please review this repository's contribution guidelines.
Description
This change adds a new end-to-end tutorial guide for mocking a multi-tool LangGraph agent with StuntDouble.
It covers:
->setting up a LangGraph agent with multiple tools
->configuring per-tool mocks with matchers and dynamic resolvers
->using CallRecorder in pytest to assert tool call order and arguments
->common patterns and edge cases such as conditional responses, hybrid real/mock flows, and error simulation
->It also links the new tutorial from the docs index so it appears in the guides navigation.
Fixes #40