Skip to content

Python: Add a second demonstration tool to concurrent_builder_tool_approval sample #4874

@moonbox3

Description

@moonbox3

Summary

Update python/samples/03-workflows/tool-approval/concurrent_builder_tool_approval.py to include one more demonstration tool so the sample shows a richer concurrent approval scenario than a single approval-gated trade tool plus read-only helpers.

Context

Today the sample defines:

  • read-only helper tools: get_stock_price, get_market_sentiment, get_portfolio_balance
  • one approval-gated action: execute_trade

That makes the sample useful, but it does not show how agents choose between multiple actionable tools in the same concurrent workflow.

Proposed change

Add another domain-appropriate tool to the sample. A good default would be set_stop_loss(symbol: str, stop_price: float) -> str, marked with approval_mode="always_require".

Then update the sample instructions, prompt, and sample output so at least one agent may use either:

  • execute_trade
  • set_stop_loss

Why this helps

  • Demonstrates that concurrent workflows can surface approval requests for different tools, not just repeated calls to the same tool.
  • Makes the sample feel more realistic for trading and risk-management scenarios.
  • Gives readers a better example of handling multiple pending approvals in one event-processing loop.

Acceptance criteria

  • python/samples/03-workflows/tool-approval/concurrent_builder_tool_approval.py defines one additional demonstration tool.
  • The new tool is included in both agents tools=` lists.
  • The sample docstring, comments, and sample output are updated to mention the additional tool and expected behavior.
  • The sample still clearly demonstrates concurrent approval handling end to end.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions