# Migrating from 0.22.9 to 0.23.0

0.23.0 is **fully backward-compatible** with 0.22.9. No existing code needs to change.
All new features are opt-in.

---

## New opt-in features

### 1. Coding agent infrastructure (`lionagi/agent/`)

A structured way to create agents with permission policies and lifecycle hooks.

```python
from lionagi.agent import create_agent, AgentConfig, PermissionPolicy

# Use a built-in preset
config = AgentConfig.preset("coding")

# Or build your own
config = AgentConfig(
    name="my-agent",
    permission=PermissionPolicy(
        denylist=["rm -rf", "sudo"],
        confirm=["git push", "git commit"],
    ),
    hooks=["guard_destructive", "log_tool_use"],
)

agent = await create_agent(config)
```

Project-level defaults can be placed in `.lionagi/settings.yaml`; they are merged with
the global `~/.lionagi/settings.yaml` at startup.

See [Agent Config API](../api/agent-config.md) for full API reference.

### 2. Sandbox tool (`lionagi/tools/sandbox.py`)

Experiment safely inside an isolated git worktree. Changes never touch your main working
tree until you explicitly `merge()`.

```python
from lionagi.tools.sandbox import SandboxSession

async with SandboxSession() as sb:
    await sb.create()          # spin up isolated worktree
    # ... make changes ...
    print(await sb.diff())     # inspect before committing
    await sb.commit("wip: try approach A")
    await sb.merge()           # promote to main tree
    # or: await sb.discard()  # throw it all away
```

See [Sandbox API](../api/sandbox.md) for full API reference.

### 3. DeepSeek native provider

```python
import lionagi as li

branch = li.Branch(
    chat_model=li.iModel(
        provider="deepseek",
        model="deepseek-chat",
        # reads DEEPSEEK_API_KEY from environment
    )
)
```

### 4. Pi CLI endpoint

```python
import lionagi as li

branch = li.Branch(
    chat_model=li.iModel(provider="pi_cli", model="pi/...")
)
```

---

## Changelog

Full details: [`../../CHANGELOG.md`](../../CHANGELOG.md) — `[0.23.0]` entry.
