Skip to main content

createAgentSession()

Create an agent session with automatic discovery of extensions, skills, and tools.

Parameters

CreateAgentSessionOptions
Configuration for the agent session

Returns

object

Examples

Minimal Usage

Uses all defaults: discovers skills, extensions, tools, and context files from cwd and ~/.pi/agent.

With Explicit Model

Full Control

Tool Factories

When using a custom cwd, you must use tool factory functions to ensure tools resolve paths relative to your cwd, not process.cwd().

Pre-built Tools

These use process.cwd() as the working directory:

Tool Factories (for custom cwd)

Tool Sets

Tool[]
Full access mode: [read, bash, edit, write]
Tool[]
Read-only exploration: [read, grep, find, ls]
Record<ToolName, Tool>
All available built-in tools as a keyed object

Type Exports