Tools

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
Custom toolsCreateRunPythonPython code execution for data analysis and computations, with optional developer-defined functions for specialized business logic
Agent as toolCreateAgentAsToolDelegate subtasks to another agent and return the result to the supervisor
MCP connectorCreateMCPConnectorConnect to external MCP providers through a secure gateway

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

Use client.tools.update() to make partial changes to a tool. Provide only the fields you want to change. Omitted fields remain unchanged.

Endpoint: PATCH /v1/flow/tools/{tool_id} Update tool

from seekrai.types import UpdateWebSearch

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

Important

Tool updates propagate immediately to all agents using the tool.

Preview a tool update

Use client.tools.update_diff() to simulate an update without applying it. The response shows exactly what would change.

Endpoint: PATCH /v1/flow/tools/{tool_id}/diff Preview tool update

from seekrai.types import UpdateWebSearch

diff = client.tools.update_diff(
    tool_id="<id-of-tool-to-update>",
    request=UpdateWebSearch(
        name="my_web_search_v2",
        description="Updated description for web search."
    )
)
print(diff)

The response includes the complete before and after tool state, and a diff object identifying each changed field:

ToolDiffResponse(
    before=...,
    after=...,
    diff={
        "name": {
            "before": "my_web_search",
            "after": "my_web_search_v2"
        },
        "description": {
            "before": "Search the web for information.",
            "after": "Updated description for web search."
        }
    }
)

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.