tools
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| SkillsRegistry llmling_agent.skills.registry Registry for Claude Code Skills with auto-discovery. |
||
| Tool llmling_agent.tools.base Information about a registered tool. |
||
| ToolCallInfo llmling_agent.tools.tool_call_info Information about an executed tool call. |
||
| ToolError llmling_agent.tools.manager Base exception for tool-related errors. |
||
| ToolManager llmling_agent.tools.manager Manages tool registration, enabling/disabling and access. |
🛈 DocStrings¶
Tool implementations and related classes / functions.
SkillsRegistry
¶
Bases: BaseRegistry[str, Skill]
Registry for Claude Code Skills with auto-discovery.
Source code in src/llmling_agent/skills/registry.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
__init__
¶
__init__(skills_dirs: Sequence[JoinablePathLike] | None = None) -> None
Initialize with custom skill directories or auto-detect.
Source code in src/llmling_agent/skills/registry.py
38 39 40 41 42 43 44 | |
discover_skills
async
¶
discover_skills() -> None
Scan filesystem and register all found skills.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filesystem
|
Optional async filesystem to use. If None, will use upath_to_fs() to get appropriate filesystem for each skills directory. |
required |
Source code in src/llmling_agent/skills/registry.py
46 47 48 49 50 51 52 53 54 | |
get_skill_instructions
¶
Lazy load full instructions for a skill.
Source code in src/llmling_agent/skills/registry.py
156 157 158 159 | |
register_skills_from_path
async
¶
register_skills_from_path(skills_dir: UPath | AbstractFileSystem, **storage_options: Any) -> None
Register skills from a given path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
skills_dir
|
UPath | AbstractFileSystem
|
Path to the directory containing skills. |
required |
storage_options
|
Any
|
Additional options to pass to the filesystem. |
{}
|
Source code in src/llmling_agent/skills/registry.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
Tool
dataclass
¶
Information about a registered tool.
Source code in src/llmling_agent/tools/base.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
agent_name
class-attribute
instance-attribute
¶
agent_name: str | None = None
The agent name as an identifier for agent-as-a-tool.
category
class-attribute
instance-attribute
¶
category: ToolKind | None = None
The category of the tool.
enabled
class-attribute
instance-attribute
¶
enabled: bool = True
Whether the tool is currently enabled
import_path
class-attribute
instance-attribute
¶
import_path: str | None = None
The import path for the tool.
metadata
class-attribute
instance-attribute
¶
Additional tool metadata
requires_confirmation
class-attribute
instance-attribute
¶
requires_confirmation: bool = False
Whether tool execution needs explicit confirmation
schema_override
class-attribute
instance-attribute
¶
schema_override: OpenAIFunctionDefinition | None = None
Schema override. If not set, the schema is inferred from the callable.
source
class-attribute
instance-attribute
¶
source: ToolSource = 'dynamic'
Where the tool came from.
execute
async
¶
Execute tool, handling both sync and async cases.
Source code in src/llmling_agent/tools/base.py
159 160 161 162 | |
format_info
¶
Format complete tool information.
Source code in src/llmling_agent/tools/base.py
146 147 148 149 150 151 152 153 154 155 156 157 | |
from_autogen_tool
classmethod
¶
from_autogen_tool(
tool: Any,
*,
name_override: str | None = None,
description_override: str | None = None,
schema_override: OpenAIFunctionDefinition | None = None,
**kwargs: Any
) -> Tool[Any]
Create a tool from a AutoGen tool.
Source code in src/llmling_agent/tools/base.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
from_code
classmethod
¶
Create a tool from a code string.
Source code in src/llmling_agent/tools/base.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
from_crewai_tool
classmethod
¶
from_crewai_tool(
tool: Any,
*,
name_override: str | None = None,
description_override: str | None = None,
schema_override: OpenAIFunctionDefinition | None = None,
**kwargs: Any
) -> Tool[Any]
Allows importing crewai tools.
Source code in src/llmling_agent/tools/base.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | |
from_langchain_tool
classmethod
¶
from_langchain_tool(
tool: Any,
*,
name_override: str | None = None,
description_override: str | None = None,
schema_override: OpenAIFunctionDefinition | None = None,
**kwargs: Any
) -> Tool[Any]
Create a tool from a LangChain tool.
Source code in src/llmling_agent/tools/base.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
matches_filter
¶
matches_filter(state: ToolState) -> bool
Check if tool matches state filter.
Source code in src/llmling_agent/tools/base.py
119 120 121 122 123 124 125 126 127 | |
to_mcp_tool
¶
to_mcp_tool() -> Tool
Convert internal Tool to MCP Tool.
Source code in src/llmling_agent/tools/base.py
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
to_pydantic_ai
¶
to_pydantic_ai() -> Tool
Convert tool to Pydantic AI tool.
Source code in src/llmling_agent/tools/base.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
ToolCallInfo
¶
Bases: Schema
Information about an executed tool call.
Source code in src/llmling_agent/tools/tool_call_info.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
agent_tool_name
class-attribute
instance-attribute
¶
agent_tool_name: str | None = None
If this tool is agent-based, the name of that agent.
error
class-attribute
instance-attribute
¶
error: str | None = None
Error message if the tool call failed.
message_id
class-attribute
instance-attribute
¶
message_id: str | None = None
ID of the message that triggered this tool call.
timestamp
class-attribute
instance-attribute
¶
When the tool was called.
timing
class-attribute
instance-attribute
¶
timing: float | None = None
Time taken for this specific tool call in seconds.
tool_call_id
class-attribute
instance-attribute
¶
ID provided by the model (e.g. OpenAI function call ID).
format
¶
format(
style: FormatStyle = "simple",
*,
template: str | None = None,
variables: dict[str, Any] | None = None,
show_timing: bool = True,
show_ids: bool = False
) -> str
Format tool call information with configurable style.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
style
|
FormatStyle
|
Predefined style to use: - simple: Compact single-line format - detailed: Multi-line with all details - markdown: Formatted markdown with syntax highlighting |
'simple'
|
template
|
str | None
|
Optional custom template (required if style="custom") |
None
|
variables
|
dict[str, Any] | None
|
Additional variables for template rendering |
None
|
show_timing
|
bool
|
Whether to include execution timing |
True
|
show_ids
|
bool
|
Whether to include tool_call_id and message_id |
False
|
Returns:
| Type | Description |
|---|---|
str
|
Formatted tool call information |
Raises:
| Type | Description |
|---|---|
ValueError
|
If style is invalid or custom template is missing |
Source code in src/llmling_agent/tools/tool_call_info.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
ToolError
¶
Bases: LLMLingError
Base exception for tool-related errors.
Source code in src/llmling_agent/tools/manager.py
35 36 | |
ToolManager
¶
Manages tool registration, enabling/disabling and access.
Source code in src/llmling_agent/tools/manager.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
providers
property
¶
providers: list[ResourceProvider]
Get all providers: external + worker + builtin providers.
__init__
¶
Initialize tool manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tools
|
Sequence[Tool | ToolType] | None
|
Initial tools to register |
None
|
tool_mode
|
ToolMode | None
|
Tool execution mode (None or "codemode") |
None
|
Source code in src/llmling_agent/tools/manager.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
add_provider
¶
add_provider(provider: ResourceProvider, owner: str | None = None) -> None
Add an external resource provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
provider
|
ResourceProvider
|
ResourceProvider instance (e.g., MCP server, custom provider) |
required |
owner
|
str | None
|
Optional owner for the provider |
None
|
Source code in src/llmling_agent/tools/manager.py
94 95 96 97 98 99 100 101 102 103 | |
disable_tool
async
¶
disable_tool(tool_name: str) -> None
Disable a tool.
Source code in src/llmling_agent/tools/manager.py
150 151 152 153 154 | |
enable_tool
async
¶
enable_tool(tool_name: str) -> None
Enable a previously disabled tool.
Source code in src/llmling_agent/tools/manager.py
144 145 146 147 148 | |
get_tool
async
¶
Get a specific tool by name.
First checks local tools, then uses concurrent provider fetching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the tool to retrieve |
required |
Returns:
| Type | Description |
|---|---|
Tool
|
Tool instance if found, None otherwise |
Source code in src/llmling_agent/tools/manager.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
get_tools
async
¶
Get tool objects based on filters.
Source code in src/llmling_agent/tools/manager.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
list_prompts
async
¶
list_prompts() -> list[MCPClientPrompt]
Get all prompts from all providers.
Returns:
| Type | Description |
|---|---|
list[MCPClientPrompt]
|
List of Prompt instances |
Source code in src/llmling_agent/tools/manager.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | |
list_tools
async
¶
Get a mapping of all tools and their enabled status.
Source code in src/llmling_agent/tools/manager.py
156 157 158 | |
remove_provider
¶
remove_provider(provider: ResourceProvider | ProviderName) -> None
Remove an external resource provider.
Source code in src/llmling_agent/tools/manager.py
105 106 107 108 109 110 111 112 113 114 115 116 117 | |
reset_states
async
¶
reset_states() -> None
Reset all tools to their default enabled states.
Source code in src/llmling_agent/tools/manager.py
119 120 121 122 | |
temporary_tools
async
¶
temporary_tools(
tools: ToolType | Tool | Sequence[ToolType | Tool], *, exclusive: bool = False
) -> AsyncIterator[list[Tool]]
Temporarily register tools.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tools
|
ToolType | Tool | Sequence[ToolType | Tool]
|
Tool(s) to register |
required |
exclusive
|
bool
|
Whether to temporarily disable all other tools |
False
|
Yields:
| Type | Description |
|---|---|
AsyncIterator[list[Tool]]
|
List of registered tool infos |
Example
with tool_manager.temporary_tools([tool1, tool2], exclusive=True) as tools:
# Only tool1 and tool2 are available
await agent.run(prompt)
# Original tool states are restored
Source code in src/llmling_agent/tools/manager.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |