Skip to content

docs: add multi-tool agent tutorial - #46

Merged
Bbenchaya merged 2 commits into
intuit:mainfrom
zeel2104:docs/multi-tool-agent-tutorial
Apr 5, 2026
Merged

docs: add multi-tool agent tutorial#46
Bbenchaya merged 2 commits into
intuit:mainfrom
zeel2104:docs/multi-tool-agent-tutorial

Conversation

@zeel2104

Copy link
Copy Markdown
Contributor

Checklist

🚨 Please review this repository's contribution guidelines.

  • I've read and agree to the project's contribution guidelines.
  • I'm requesting to pull a topic/feature/bugfix branch.
  • I checked that my code additions will pass code linting checks and unit tests.
  • I updated unit and integration tests (if applicable).
  • I'm ready to notify the team of this contribution.

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

@zeel2104
zeel2104 requested a review from Bbenchaya as a code owner March 30, 2026 15:55
Comment thread docs/index.md Outdated
guides/matchers-and-resolvers
guides/mock-builder
guides/call-recording
guides/multi-tool-agent-tutorial

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ChiefArchitect left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"])

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@zeel2104

Copy link
Copy Markdown
Contributor Author

@ChiefArchitect
Updated the PR based on feedback:

  • moved the tutorial later in the guides toctree
  • added a Python 3.12+ prerequisite note
  • clarified that agent_node is an app-specific LLM/planner node and linked to the LangGraph integration guide
  • cleaned up the validation example to validate scenario_metadata directly before injecting config
  • simplified the custom register() example for consistency
@Bbenchaya

Copy link
Copy Markdown
Collaborator

Thanks @zeel2104, looks good, we may need to tweak it a bit in the future, Thanks for the help!

@Bbenchaya
Bbenchaya merged commit 65d64d6 into intuit:main Apr 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants