Tools

Create and manage tools in the tool library.

Tools extend what agents can do. While models provide reasoning capabilities, tools allow agents to take actions—accessing external systems, querying knowledge stores, executing code, or performing web searches to accomplish tasks.

The tool library lets you create and manage tools independently of agents, then link them to any agent by tool ID.

Tool types

TypeSDK classDescription
File searchCreateFileSearchSemantic search and retrieval across vector databases
Web searchCreateWebSearchReal-time information retrieval from web sources
Code interpreterCreateRunPythonPython code execution for data analysis and computations
Custom toolsCreateRunPythonDeveloper-defined functions for specialized business logic

See the sub-pages for type-specific configuration and parameters.

Create a tool

Create a tool in the library using client.tools.create():

from seekrai import SeekrFlow
from seekrai.types import CreateWebSearch

client = SeekrFlow()

tool = client.tools.create(
    CreateWebSearch(
        name="my_web_search",
        description="Search the web for information relevant to the user's query."
    )
)
print(f"Tool created: {tool.id}")

For tools that require configuration, include a config object:

from seekrai.types import CreateFileSearch, FileSearchConfig

tool = client.tools.create(
    CreateFileSearch(
        name="my_file_search",
        description="Search the knowledge base for relevant information.",
        config=FileSearchConfig(
            file_search_index="<vector-store-id>",
            top_k=10,
            score_threshold=0.5
        )
    )
)

Retrieve a tool

tool = client.tools.retrieve("<tool-id>")
print(tool.name, tool.type)

List tools

tools = client.tools.list()
for tool in tools.data:
    print(f"{tool.name} ({tool.type}): {tool.id}")

Update a tool

Updating a tool replaces the entire tool definition. Include all fields in the request, even those you are not changing.

from seekrai.types import UpdateWebSearch

updated_tool = client.tools.update(
    tool_id="<id-of-tool-to-update>",
    UpdateWebSearch(
        name="my_updated_web_search",
        description="Updated description for web search."
    )
)

Important

Tool updates propagate immediately to all agents using the tool.

Duplicate a tool

duplicate = client.tools.duplicate("<tool-id>", "my_duplicate_tool")

Delete a tool

result = client.tools.delete("<tool-id>")
print(result.message)

Important

You cannot delete a tool that is linked to an active agent. Demote or delete the agent first.

List linked agents

Check which agents use a specific tool before updating or deleting it:

agents = client.tools.list_agents("<tool-id>")
for agent in agents:
    print(f"{agent.name} ({agent.status}): {agent.id}")

Link tools to an agent

When creating or updating an agent, specify tool IDs in the tool_ids parameter:

from seekrai.types import CreateAgentRequest

agent = client.agents.create(
    CreateAgentRequest(
        name="my_agent",
        instructions="You are a helpful assistant.",
        model_id="meta-llama/Llama-3.3-70B-Instruct",
        tool_ids=["<tool-id-1>", "<tool-id-2>"]
    )
)

For more on agent creation and management, see Create and manage agents.