Use Built-in Tools
This guide shows how to give a Custodian Agent access to the web and to documents it
was not trained on, using the built-in tools web_search, scrape_url, and
parse_document.
For the full reference, see Built-in Tools for Python or TypeScript.
When to use a tool
| Situation | Approach |
|---|---|
| The agent should answer from your own stable documents | Data source / RAG |
| The agent needs current information from the web | web_search |
| The agent should read one specific page you name | scrape_url |
| The agent should extract text from a document by URL, one time | parse_document |
Give an agent web search
- Python
- TypeScript
from custodian_labs import Custodian
app = Custodian(
model="gpt-4o",
system_prompt="Answer using current web results when they help. Cite your sources.",
tools=["web_search", "scrape_url"],
).deploy()
reply = app.chat("What changed in the latest OpenAI API release?")
print(reply.response)
import { Custodian } from "@custodianlabs/sdk";
const app = await new Custodian({
model: "gpt-4o",
systemPrompt: "Answer using current web results when they help. Cite your sources.",
tools: ["web_search", "scrape_url"],
}).deploy();
const reply = await app.chat("What changed in the latest OpenAI API release?");
console.log(reply?.response);
Combine tools with a workflow team
A common pattern: one agent researches with web_search, the next writes from its
notes. In workflow mode the agents run in a fixed order and each output feeds the
next.
- Python
- TypeScript
from custodian_labs import Custodian, CustodianSquad
squad = CustodianSquad(
custodians=[
Custodian(
name="research",
model="gpt-4o",
system_prompt="Research the topic. Produce notes with sources.",
tools=["web_search"],
output_key="research_notes",
),
Custodian(
name="writer",
model="gpt-4o",
system_prompt="Write a one-paragraph brief from the research notes.",
),
],
routing_mode="workflow",
workflow_order=["research", "writer"],
)
app = squad.deploy()
reply = app.chat("Give me a brief on RAG evaluation methods.")
print(reply.response)
import { Agent, AgentTeam } from "@custodianlabs/sdk";
const team = new AgentTeam({
agents: [
new Agent({
name: "research",
model: "gpt-4o",
systemPrompt: "Research the topic. Produce notes with sources.",
tools: ["web_search"],
outputKey: "research_notes",
}),
new Agent({
name: "writer",
model: "gpt-4o",
systemPrompt: "Write a one-paragraph brief from the research notes.",
}),
],
routingMode: "workflow",
workflowOrder: ["research", "writer"],
});
const app = await team.deploy();
const reply = await app.chat("Give me a brief on RAG evaluation methods.");
console.log(reply?.response);
Cost and latency
Each tool call is an extra round trip. Tell the agent in its system prompt when to use a tool ("search only when the answer depends on recent events") rather than letting it reach for one on every message.
External connections
Gmail (read / send / reply from an agent) is coming soon.