Metadata-Version: 2.5
Name: panel-agents
Version: 0.1.0b1
Summary: Panel components for building agent user interfaces.
Project-URL: Homepage, https://github.com/panel-extensions/panel-agents
Project-URL: Documentation, https://panel-extensions.github.io/panel-agents
Project-URL: Source, https://github.com/panel-extensions/panel-agents
Author-email: Philipp Rudiger <philipp@holoviz.org>
Maintainer-email: Philipp Rudiger <philipp@holoviz.org>
License: BSD
License-File: LICENSE.txt
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: panel-material-ui>=0.17.0b3
Requires-Dist: panel>=1.9.0
Requires-Dist: pydantic>=2.12
Provides-Extra: dev
Requires-Dist: mkdocs; extra == 'dev'
Requires-Dist: mkdocs-material; extra == 'dev'
Requires-Dist: mkdocs-pycafe; extra == 'dev'
Requires-Dist: mkdocstrings[python]; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: pytest-rerunfailures; extra == 'dev'
Requires-Dist: pytest-xdist; extra == 'dev'
Requires-Dist: watchfiles; extra == 'dev'
Provides-Extra: examples
Requires-Dist: duckdb; extra == 'examples'
Requires-Dist: pandas; extra == 'examples'
Requires-Dist: pydantic-ai-slim[anthropic,openai]>=2.60; extra == 'examples'
Provides-Extra: mcp
Requires-Dist: fastmcp-slim[server]<5,>=4.1; extra == 'mcp'
Requires-Dist: pydantic-ai-slim>=2.40; extra == 'mcp'
Provides-Extra: mypy
Requires-Dist: mypy; extra == 'mypy'
Requires-Dist: types-requests; extra == 'mypy'
Requires-Dist: typing-extensions; extra == 'mypy'
Provides-Extra: pydantic-ai
Requires-Dist: pydantic-ai-slim>=2.60; extra == 'pydantic-ai'
Description-Content-Type: text/markdown

# panel-agents

Panel components for building user interfaces for AI agents: a chat with tool-call cards, versioned artifacts and documents, human-in-the-loop approvals, actions on the page the user is looking at, traces and session replay.

Agent frameworks are connected through adapters that translate their output into a small set of normalized events, modelled on the [AG-UI protocol](https://docs.ag-ui.com). The components bind to a reactive `RunState` built from those events, so the same UI works live, against a recorded session, or with any framework that has an adapter. The pydantic-ai adapter ships with the package.

```bash
pip install "panel-agents[pydantic-ai]"
```

A chat for a pydantic-ai agent, docked beside an existing app, with inline approvals and a versioned artifact pane:

```python
import panel_material_ui as pmui
from panel_agents import AgentDrawer, ApprovalPolicy
from panel_agents.adapters.pydantic_ai import AgentRunner

runner = AgentRunner(agent, deps=deps, approval_policy=ApprovalPolicy(["save_*", "delete_*"]))
drawer = AgentDrawer(runner, main=my_app)
pmui.Page(title="My app", header=[drawer.toggle], main=[drawer]).servable()
```

Every session can be recorded and replayed with the same components:

```python
from panel_agents import Recorder, load_state

with Recorder(runner.state, "runs/session.jsonl"):
    await runner.run("Summarize last month's sales")

replayed = load_state("runs/session.jsonl")
```

## Guides

The documentation is at [panel-extensions.github.io/panel-agents](https://panel-extensions.github.io/panel-agents), with a getting-started tutorial, the guides below and the API reference.

- [Dock an agent beside an existing app](docs/how-to/agent-drawer.md) with `AgentDrawer`.
- [Require approval for tool calls](docs/how-to/approvals.md) with `ApprovalPolicy`.
- [Edit documents with versions you can apply and revert](docs/how-to/document-artifacts.md), with semantic diffs.
- [Let the agent act on the page](docs/how-to/ui-actions.md) with an `ActionRegistry`.
- [Serve an agent's tools over MCP](docs/how-to/mcp.md) with the `mcp` extra.
- [Security](docs/how-to/security.md): what panel-agents does about prompt injection in rendered output and approvals.
- [API reference](docs/reference/api.md): everything public, by module.

## Examples

- `examples/drawer_app.py`: an agent docked beside a sales report, editing it as a document, filtering it through a front-end action and asking before it exports.
- `examples/sql_analyst/`: a data-analysis agent over DuckDB, a replay viewer for its recordings and an MCP server for its tools.
- `examples/approval_demo.py`, `examples/artifacts_demo.py` and `examples/chat_replay.py`: the approval, artifact and chat components on synthetic events, without a model.

## Compatibility

panel-agents 1.x follows semantic versioning for the names listed in the API reference. Names starting with an underscore and modules starting with an underscore are private and may change in any release. Recordings written by 1.x can be read by later 1.x releases.
