Skip to content

Built-in Tools

createAgent() gives each agent private workspace tools by default. If no workspace is provided, files are stored under ~/.agent/workspaces/<name> when you pass name, otherwise under ~/.agent/workspaces/agent-<session-id>.

Pass workspace only to override that default location:

import { createAgent } from "agent-lattice";
const agent = createAgent({
apiKey: process.env.DEEPSEEK_API_KEY,
baseURL: "https://api.deepseek.com/anthropic",
name: "backend",
model: "deepseek-v4-flash",
workspace: {
cwd: process.cwd(),
allowedDirectories: [process.cwd()],
bashTimeoutMs: 30_000,
},
});

createBareAgent() starts with no tools, no workspace instructions, and no default workspace directory. Use createBuiltinTools() when you want a bare agent but still want to opt into the SDK’s built-in file and shell tools:

import { createBareAgent, createBuiltinTools } from "agent-lattice";
const agent = createBareAgent({
apiKey: process.env.DEEPSEEK_API_KEY,
baseURL: "https://api.deepseek.com/anthropic",
model: "deepseek-v4-flash",
systemPrompt: "Use the configured project directory for file work.",
tools: createBuiltinTools({
cwd: process.cwd(),
allowedDirectories: [process.cwd()],
bashTimeoutMs: 30_000,
}),
});

createBuiltinTools() and createAgentWorkspaceTools() return the same ToolDefinition[] shown below. createAgentWorkspaceTools() remains available for code that prefers the explicit workspace name.

Tool Capability
Read Read a workspace file, optionally with 1-based line offset and limit.
Write Write a file and create parent directories.
Edit Replace text in an existing file.
LS List a directory.
Glob Find files by glob pattern.
Grep Search file contents by regular expression.
Bash Run a shell command with a timeout.

These tools can read and write files and run shell commands, so in production pair them with a permission callback:

permission: async request => {
if (request.toolName === "Bash" || request.toolName === "Write") {
return {
behavior: "deny",
message: "This host did not approve shell or write access.",
};
}
return { behavior: "allow" };
}

allowedDirectories restricts write roots for Write, Edit, and obvious shell writes. Read-only tools can inspect any path the host process can read. These checks do not replace the host application’s own permission policy.