A3S Docs
A3S CodeExamples

Direct Tools

Call tools directly without involving the LLM — useful for scripting, testing, and custom pipelines

Direct Tools

Call any built-in tool directly without an LLM round-trip. This is useful for scripting, testing, or building custom pipelines on top of A3S Code's tool layer.

Low-Level: session.tool()

const session = agent.session('/my-project', { permissive: true });

// Write a file
const r1 = await session.tool('write', { path: 'hello.txt', content: 'Hello!' });
console.log(`write: exit=${r1.exitCode}`);

// Read it back
const r2 = await session.tool('read', { path: 'hello.txt' });
console.log(`content: ${r2.output}`);

// Run bash
const r3 = await session.tool('bash', { command: 'cat hello.txt' });
console.log(`bash: ${r3.output}`);

Source: sdk/node/examples/advanced_features_demo.ts

session = agent.session("/my-project", permissive=True)

# Write a file
r = session.tool("write", {"path": "hello.txt", "content": "Hello!"})
print(f"write: exit={r.exit_code}")

# Read it back
r = session.tool("read", {"path": "hello.txt"})
print(f"content: {r.output}")

# Run bash
r = session.tool("bash", {"command": "cat hello.txt"})
print(f"bash: {r.output}")

Source: sdk/python/examples/advanced_features_demo.py

Convenience Methods

Higher-level wrappers for common operations:

const content = await session.readFile('src/main.rs');
const output = await session.bash('cargo test');
const files = await session.glob('**/*.rs');
const matches = await session.grep('TODO');
content = session.read_file("src/main.rs")
output = session.bash("cargo test")
files = session.glob("**/*.rs")
matches = session.grep("TODO")

Direct tool calls bypass the LLM entirely — no tokens consumed, no streaming events. They still respect the session's permission policy and workspace scope.

API Reference

session.tool()

Prop

Type

Convenience Methods

Prop

Type

On this page