configuration.mdx 1.6 KB

1234567891011121314151617181920212223242526272829303132
  1. ---
  2. title: "Advanced Tool Configuration"
  3. description: "Advanced features and patterns for Agency Swarm tools."
  4. icon: "wand-magic-sparkles"
  5. ---
  6. Besides standard Pydantic features, you can also use a special `ToolConfig` class to customize tool behavior within the framework:
  7. ## Available `ToolConfig` Parameters
  8. The following parameters are supported, with version compatibility noted:
  9. | Name | Type | Description | When to Use | Default Value |
  10. |--------------------|---------|-------------|-------------|---------------|
  11. | `one_call_at_a_time` | `bool` | Prevents concurrent execution for a specific tool. If you want to adjust parallel tool calling for all tools, prefer configuring `model_settings=ModelSettings(parallel_tool_calls=...)`. Use this per-tool setting when you need strict sequencing. | Use for database operations, API calls with rate limits, or actions that depend on previous results. | `False` |
  12. | `strict` | `bool` | Enables strict mode, which ensures the agent will always provide **perfect** tool inputs that 100% match your schema. Has limitations. See [OpenAI Docs](https://platform.openai.com/docs/guides/structured-outputs#supported-schemas). | Use for mission-critical tools or tools that have nested Pydantic model schemas. | `False` |
  13. ## Usage
  14. To use one of the available parameters, simply add a `class ToolConfig` block to your tool class:
  15. ```python
  16. class MyCustomTool(BaseTool):
  17. # ...
  18. class ToolConfig:
  19. one_call_at_a_time = True
  20. strict = False
  21. async def run(self):
  22. # ...
  23. ```