From 64baa617ecf7aa5fd60aef0bf1f7562db00a38bf Mon Sep 17 00:00:00 2001 From: AbdulSamad94 Date: Sun, 5 Oct 2025 00:51:19 +0500 Subject: [PATCH 1/2] docs: improve formatting consistency in tools documentation --- docs/tools.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/tools.md b/docs/tools.md index 38199c581..249c4a7f2 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -288,9 +288,9 @@ async def run_my_agent() -> str: In certain cases, you might want to modify the output of the tool-agents before returning it to the central agent. This may be useful if you want to: -- Extract a specific piece of information (e.g., a JSON payload) from the sub-agent's chat history. -- Convert or reformat the agent’s final answer (e.g., transform Markdown into plain text or CSV). -- Validate the output or provide a fallback value when the agent’s response is missing or malformed. +- Extract a specific piece of information (e.g., a JSON payload) from the sub-agent's chat history. +- Convert or reformat the agent’s final answer (e.g., transform Markdown into plain text or CSV). +- Validate the output or provide a fallback value when the agent’s response is missing or malformed. You can do this by supplying the `custom_output_extractor` argument to the `as_tool` method: @@ -369,15 +369,17 @@ asyncio.run(main()) ``` The `is_enabled` parameter accepts: -- **Boolean values**: `True` (always enabled) or `False` (always disabled) -- **Callable functions**: Functions that take `(context, agent)` and return a boolean -- **Async functions**: Async functions for complex conditional logic + +- **Boolean values**: `True` (always enabled) or `False` (always disabled) +- **Callable functions**: Functions that take `(context, agent)` and return a boolean +- **Async functions**: Async functions for complex conditional logic Disabled tools are completely hidden from the LLM at runtime, making this useful for: -- Feature gating based on user permissions -- Environment-specific tool availability (dev vs prod) -- A/B testing different tool configurations -- Dynamic tool filtering based on runtime state + +- Feature gating based on user permissions +- Environment-specific tool availability (dev vs prod) +- A/B testing different tool configurations +- Dynamic tool filtering based on runtime state ## Handling errors in function tools From 2b0b5f5d6e741c8d95c88d7e679f8cb747d615b2 Mon Sep 17 00:00:00 2001 From: Kazuhiro Sera Date: Sun, 5 Oct 2025 09:16:41 -0700 Subject: [PATCH 2/2] Apply suggestions from code review --- docs/tools.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/tools.md b/docs/tools.md index 249c4a7f2..0acb2cb4a 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -288,9 +288,9 @@ async def run_my_agent() -> str: In certain cases, you might want to modify the output of the tool-agents before returning it to the central agent. This may be useful if you want to: -- Extract a specific piece of information (e.g., a JSON payload) from the sub-agent's chat history. -- Convert or reformat the agent’s final answer (e.g., transform Markdown into plain text or CSV). -- Validate the output or provide a fallback value when the agent’s response is missing or malformed. +- Extract a specific piece of information (e.g., a JSON payload) from the sub-agent's chat history. +- Convert or reformat the agent’s final answer (e.g., transform Markdown into plain text or CSV). +- Validate the output or provide a fallback value when the agent’s response is missing or malformed. You can do this by supplying the `custom_output_extractor` argument to the `as_tool` method: @@ -370,16 +370,16 @@ asyncio.run(main()) The `is_enabled` parameter accepts: -- **Boolean values**: `True` (always enabled) or `False` (always disabled) -- **Callable functions**: Functions that take `(context, agent)` and return a boolean -- **Async functions**: Async functions for complex conditional logic +- **Boolean values**: `True` (always enabled) or `False` (always disabled) +- **Callable functions**: Functions that take `(context, agent)` and return a boolean +- **Async functions**: Async functions for complex conditional logic Disabled tools are completely hidden from the LLM at runtime, making this useful for: -- Feature gating based on user permissions -- Environment-specific tool availability (dev vs prod) -- A/B testing different tool configurations -- Dynamic tool filtering based on runtime state +- Feature gating based on user permissions +- Environment-specific tool availability (dev vs prod) +- A/B testing different tool configurations +- Dynamic tool filtering based on runtime state ## Handling errors in function tools