Integration Patterns
Multiple Agents in One Repo
Use multiple agentIds to isolate different SDK Agents in the same project directory
Multiple Agents in One Repo
If you create several local SDK Agents inside the same project directory, the most important rule is:
- give each agent a stable and different
id
For example:
const planner = new Agent({ id: "planner" });
const planner_workspace = new Workspace({ id: "planner-project", path: repo_path });
const planner_session = await planner.sessions.create({ workspace: planner_workspace });
const reviewer = new Agent({ id: "reviewer" });
const reviewer_workspace = new Workspace({ id: "reviewer-project", path: repo_path });
const reviewer_session = await reviewer.sessions.create({ workspace: reviewer_workspace });Both Workspaces may target the same physical directory. Session storage remains partitioned by agent_id, while each Session explicitly selects its Workspace. If the Agents need isolated command environments, create and pass a separate Shell instance to each Workspace.
This is especially useful when one repository needs several agents with different roles.