Skip to main content
artifactr: people and agents editing the same artifacts, every change versioned and attributed.

Docs Nightly Python 3.12, 3.13 and 3.14 Coverage: 100% Typed: pyright strict License: MIT

artifactr is a Python library for chat applications in which people and agents work on the same documents, plans and specs, with every change versioned, attributed and fed back into the agent's context.

Status: alpha. 0.1.0 is the first release and delivers RFC-0001, the v0.1 plan. The API may still change before 1.0.

Why

In most chat applications the conversation is the only channel. artifactr adds a second: artifacts that live beside the chat and that both sides edit directly. When a person rewrites a paragraph the agent drafted, or the agent restructures a plan, the edit says something about how each side is thinking. So every edit is versioned, attributed to whoever made it, visible to every participant, and told to the agent before it acts.

Install

Python 3.12 or newer. artifactr is distributed as artifactr-ai and imported as artifactr (the name artifactr on PyPI is an unrelated project). Until it is on PyPI, install it from its directory in lattice, the repository every package lives in:

uv add "artifactr-ai[fastapi] @ git+https://github.com/alexnodeland/lattice#subdirectory=packages/artifactr"

Extras: fastapi (WebSocket and REST), mcp (external agents), postgres or sqlite (SQL storage with a driver), and sql (SQL storage without one).

Example

A person edits a brief, then asks the agent for more. The agent is told about the edit before it starts, and its own edit is recorded the same way:

import asyncio

from pydantic_ai import Agent

from artifactr import (
    ArtifactWorkspace,
    InMemoryStorage,
    MarkdownArtifact,
    Runner,
    Session,
    UserActor,
    Workspaces,
)
from artifactr.core import SetFocus


class Brief(MarkdownArtifact):  # an artifact type: a Pydantic model, registered as "brief"
    pass


agent = Agent(
    "anthropic:claude-sonnet-5-5",
    deps_type=Session[None],
    capabilities=[ArtifactWorkspace(types=[Brief])],  # tools, instructions and change notes
)
runner = Runner(agent, app=None)
workspaces = Workspaces(InMemoryStorage(), types=[Brief])


async def main() -> None:
    alice = UserActor(id="u_alice", name="Alice")
    ws = await workspaces.open("acme", "launch", actor=alice)
    thread = await ws.create_thread("Launch brief")

    await ws.create(Brief(text="# Launch\n\nWe ship on Friday."), artifact_id="brief")
    await ws.commit(SetFocus(thread_id=thread.id, artifact_ids=("brief",)))

    brief = await ws.get(Brief, "brief")
    await ws.commit(brief.edit_text("Friday", "Monday"))  # version 2, by Alice

    sent = await runner.send(ws, thread.id, "Add a risks section to the brief.")
    if sent.run is not None:
        await sent.run.wait()  # the agent is told what Alice changed before it starts

    for envelope in await ws.read():
        print(envelope.seq, envelope.actor.kind, envelope.event.type)


asyncio.run(main())

It needs ANTHROPIC_API_KEY, or any other pydantic-ai model. The log it prints shows Alice's edit, the agent's run, its tool call and its own edit, in order and attributed.

Try it

examples/docplan is a complete application built on the library: a person and an agent co-write a document and plan its work, over WebSocket, REST and MCP, with a terminal client. From the root of a clone of lattice:

make install
export ANTHROPIC_API_KEY=...
uv run docplan-serve            # in one terminal
uv run docplan --user alice     # in another

Set DOCPLAN_DATABASE_URL (for example sqlite+aiosqlite:///docplan.db) to keep its workspaces in a database instead of memory.

What you get

  • Artifact types as Pydantic models. Subclass Artifact; versioning, validation, patches, change summaries and agent tools come from the library.
  • One write path. Every change, from any participant and any surface, is a command committed through a tenant-scoped workspace handle, checked against the artifact's version and appended to the workspace's ordered log.
  • Proposals that don't block. Artifact types can make agents propose instead of edit; people accept, edit or reject whenever they like, and the agent hears the outcome.
  • An agent that follows along. One pydantic-ai capability adds the artifact tools, instructions rendered fresh for every request, notes on what others changed, steering mid-run, and pauses for questions and approvals.
  • Live output apart from history. Token-level output streams to watchers; the log holds only durable facts.
  • Surfaces that behave the same. A WebSocket thread protocol and REST for your frontend, and MCP for external agents, all through one command handler.
  • Storage in memory, SQLite or PostgreSQL, behind one protocol.
  • Rules you can read and port. A pure, synchronous core pinned by language-neutral conformance fixtures, with 100% branch coverage and pyright strict.

Documentation

The documentation is artifactr's section of lattice's site, at https://lattice.alexnodeland.com/artifactr/. It is built from docs/artifactr/ and published from main on every push; run moon run lattice:docs-serve to read it locally at http://localhost:8000.

Built on

Pydantic, pydantic-ai, SQLAlchemy, FastAPI and the MCP Python SDK.

Contributing

See CONTRIBUTING.md for setup, the trunk-based workflow, and the RFC and ADR process.

License

MIT

Metadata

Release files for artifactr-ai 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for artifactr-ai 0.2.0
File Size Uploaded
artifactr_ai-0.2.0.tar.gz 131.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for artifactr-ai 0.2.0
File Interpreter ABI Platform
artifactr_ai-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 298.2 kB

Release files / artifactr_ai-0.2.0.tar.gz

Download URL artifactr_ai-0.2.0.tar.gz
Size 131.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c13eec2d3c4761eaf4a41428d70c1dc4f00957a5ba31d766c3e5bb93eee1fd65
BLAKE2b-256 checksum
How to use checksums
d43ec104f0665efb008c02b0ba4c563159fc9be1274a2533dfa0e1a866cc0c31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / artifactr_ai-0.2.0-py3-none-any.whl

Download URL artifactr_ai-0.2.0-py3-none-any.whl
Size 167.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
391ff646992c0a591abee4f8c8dec99f5b396132d72f059c24b59903a0d5b386
BLAKE2b-256 checksum
How to use checksums
88f8b480e07b3ada00065df28bfa323e3b87805a9079d12fdda5c22f54243548
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.1

2 release files

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page