llama-index-integrations/tools/llama-index-tools-seltz/examples/seltz.ipynb
This tutorial walks through using the Seltz tool integration to give LLM agents access to fast, up-to-date web knowledge with sources.
Seltz provides context-engineered web content designed for LLMs, AI agents, and RAG pipelines.
To get started, you will need:
%pip install llama-index-tools-seltz llama-index
import os
os.environ["OPENAI_API_KEY"] = "sk-..."
os.environ["SELTZ_API_KEY"] = "..."
from llama_index.tools.seltz import SeltzToolSpec
seltz_tool = SeltzToolSpec(api_key=os.environ["SELTZ_API_KEY"])
tool_list = seltz_tool.to_tool_list()
for tool in tool_list:
print(tool.metadata.name)
Let's test the search tool directly before using it in an agent.
results = seltz_tool.search("What is LlamaIndex?", max_documents=3)
for doc in results:
print(f"URL: {doc.metadata['url']}")
print(f"Content: {doc.text[:200]}...")
print()
Now let's create an agent that can use Seltz to answer questions with up-to-date web knowledge.
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
agent = FunctionAgent(
tools=tool_list,
llm=OpenAI(model="gpt-4o"),
)
response = await agent.run(
"What are the latest developments in AI reasoning?"
)
print(response)