Skip to main content
What this builds. A conversational research assistant that starts with one tool (Exa), gains a second (Google Search), and then drops it again. You’ll end up with. Four printed steps showing tools attached, saved, removed, and saved again — the agent is deleted at the end. Demonstrates the fluent tool API for adding/removing tools from an agent, then persisting changes with save().
from vectorshift.agent import Agent, AgentTools, AgentType, LlmInfo, MemoryConfig
from vectorshift.agent.tool import ToolApprovalConfig, ToolInput, ToolInputType
from vectorshift.agent.tools import ExaAiTool

# Create a conversational agent
agent = Agent.new(
    name="Research Assistant",
    type=AgentType.CONVERSATIONAL,
    llm_info=LlmInfo(provider="openai", model_id="gpt-4o"),
    tools=[
        AgentTools.exa_ai(
            tool_name="exa_ai_search",
            query=ToolInput(type=ToolInputType.DYNAMIC),
            max_characters=100,
            num_results=5,
        ),
    ],
    instructions="You are a concise research assistant.",
    memory_config=MemoryConfig(enable_session_memory=True),
)
print(f"Created agent: {agent.name} (id={agent.id})")

# Add a tool using the fluent API
agent.add_tool.google_search(
    query=ToolInput(type=ToolInputType.DYNAMIC, description="What to search"),
    num_results=5,
    approval_config=ToolApprovalConfig.LET_AGENT_DECIDE,
)
print(f"Added google_search tool. Tools: {[t.name for t in agent.tools]}")

# Save the agent
agent.save()
print("Saved agent with google_search tool.")

# Remove the tool by name
agent.remove_tool("google_search")
print(f"Removed google_search. Tools: {[t.name for t in agent.tools]}")

# Save again
agent.save()
print("Saved agent without google_search tool.")

# Clean up
agent.delete()
print("Deleted agent.")

Expected output

Created agent: Research Assistant (id=...)
Added google_search tool. Tools: ['exa_ai_search', 'google_search']
Saved agent with google_search tool.
Removed google_search. Tools: ['exa_ai_search']
Saved agent without google_search tool.
Deleted agent.
Mutations to agent.tools are local until save() — the two save() calls are what push the add and the removal to the backend.

See also

Agent CRUD

Full agent lifecycle the tool changes plug into.

Tool approval config

Set approval_config on each tool across all three declaration paths.

Agent reference

Full method surface.