🎉 ai-infra v1.0 is here — Production-ready AI/LLM infrastructure
What's new
nfrax logonfrax

Infrastructure that just works. Ship products, not boilerplate.

Frameworks

  • svc-infra
  • ai-infra
  • fin-infra
  • robo-infra

Resources

  • Getting Started
  • What's New
  • Contributing

Community

  • GitHub

© 2026 nfrax. All rights reserved.

nfrax logonfrax
Start HereWhat's New
GitHub
ai-infra / API Reference

Workspace

from ai_infra.llm import Workspace
View source
ai_infra.llm

Unified workspace configuration for all agent file operations. The Workspace class provides a single way to configure how agents interact with the filesystem. It bridges: - deepagents backends (for deep=True agents) - proj_mgmt tools (for regular agents with file tools)

Args

root: The workspace root directory. Defaults to current directory. mode: How the agent can access files: - "virtual": In-memory only. Files don't persist. Safe for untrusted code. - "sandboxed": Real filesystem, but confined to root. Recommended for most use. - "full": Full filesystem access. Use only for trusted automation. Example - Local development (sandboxed to project):

python
agent = Agent(
        deep=True,
        workspace=Workspace(".", mode="sandboxed"),
    )
    # Agent can read/write files in current directory only

Example - Cloud/untrusted (virtual filesystem):

python
agent = Agent(
        deep=True,
        workspace=Workspace(mode="virtual"),
    )
    # Files exist only in memory, safe for untrusted prompts

Example - Trusted automation (full access):

python
agent = Agent(
        deep=True,
        workspace=Workspace("/", mode="full"),
    )
    # Agent has full filesystem access - use with caution!
Constructor
Workspace(root: str | Path = '.', mode: WorkspaceMode = 'sandboxed')
ParameterTypeDefaultDescription
rootstr| Path'.'—
modeWorkspaceMode'sandboxed'—

Methods

On This Page

Constructorconfigure_proj_mgmtget_deepagent_backend