autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Tool Guide for documenting how to use tools across both AgentChat and Core

Open ekzhu opened this issue 1 year ago • 2 comments

The guide should be in Extensions->Tool Guide. The guide should cover:

  1. FunctionTool:
  • How to define them as Python function (both sync and async)
  • How does it work: function gets inspected and automatically generates the JSON schema.
  • Recommendation on input parameter design: use simple and as few parameters as possible, avoid nested types like dictionaries.
  • Recommendation on return type: use serializable types to better integrate with models -- use string as much as possible.
  • Recommendation on type hinting and doc string
  1. Built-in Tools: a listing pointing to existing built in tools in the API doc.
  2. Custom BaseTool implementation:
  • An example to show how to create one.
  • Consideration for serializable configuration.

There are existing docs in AgentChat and Core mentioning tools:

  • AgentChat: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/agents.html#using-tools
  • Core: https://microsoft.github.io/autogen/stable/user-guide/core-user-guide/components/tools.html

We should move the main content from these docs that regards to tools specifically to the Tool Guide. Leave content regarding to using tools as part of agent.

ekzhu avatar Feb 21 '25 19:02 ekzhu

The guide should be in Extensions->Tool Guide. The guide should cover:

  1. FunctionTool:
  • How to define them as Python function (both sync and async)
  • How does it work: function gets inspected and automatically generates the JSON schema.
  • Recommendation on input parameter design: use simple and as few parameters as possible, avoid nested types like dictionaries.
  • Recommendation on return type: use serializable types to better integrate with models -- use string as much as possible.
  • Recommendation on type hinting and doc string
  1. Built-in Tools: a listing pointing to existing built in tools in the API doc.
  2. Custom BaseTool implementation:
  • An example to show how to create one.
  • Consideration for serializable configuration.

There are existing docs in AgentChat and Core mentioning tools:

  • AgentChat: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/tutorial/agents.html#using-tools
  • Core: https://microsoft.github.io/autogen/stable/user-guide/core-user-guide/components/tools.html

We should move the main content from these docs that regards to tools specifically to the Tool Guide. Leave content regarding to using tools as part of agent.

nexoracontrol-ops avatar May 16 '26 01:05 nexoracontrol-ops

I'd like to take a structured pass at drafting the Tool Guide content. Here's my proposed outline based on the scope ekzhu defined:

Extensions > Tool Guide

1. FunctionTool (recommended)
   - Sync and async definitions with `@tool` decorator
   - How `inspect.signature` drives JSON schema generation
   - Parameter guidance: prefer primitives, avoid nested dicts
   - Return type guidance: prefer str, ensure serializable
   - Docstring conventions for model-friendly descriptions

2. Built-in Tools reference
   - `CodeExecutionTool`, `PythonFileExecutionTool`, `WebSurferTool`, etc.
   - Link table to the autogen-core API docs for each

3. Custom BaseTool implementation
   - When to extend BaseTool instead of using `@tool`
   - `__init__` config that survives serialization round-trips
   - `_run` / `_run_json` contract with `CancellationToken`

4. Cross-cutting: tools in AgentChat vs Core
   - AgentChat: tools are registered inline on `AssistantAgent`
   - Core: tools are standalone agents subscribed to topics
   - Which pattern fits which scenario

I can open a PR with the .md content once the outline looks right to maintainers.

cschanhniem avatar Jul 08 '26 16:07 cschanhniem