Skip to content

feat(state,adapters): state store abstraction, postgres backend, governed adapters#1233

Draft
ohdearquant wants to merge 1 commit into
mainfrom
feat/state-adapters
Draft

feat(state,adapters): state store abstraction, postgres backend, governed adapters#1233
ohdearquant wants to merge 1 commit into
mainfrom
feat/state-adapters

Conversation

@ohdearquant

Copy link
Copy Markdown
Owner

Summary

  • Adds StateStore abstraction + PostgresStore backend + ArtifactStore
  • Adds governed adapter wrappers: GovernedAnthropicAgent, GovernedCrew, GovernedChain, GovernedOpenAIAgent
  • Adds config_resolution.py for project-level config resolution
  • Enhances StateDB with transaction context manager + savepoint support for nested transactions
  • Adds postgres DDL schema (schema_pg.sql)

Extracted from #1187 (stripped ADR docs).

Test plan

  • uv run pytest tests/state/ tests/adapters/ tests/test_config_resolution.py — 433 pass, 1 skip
  • CI green on this branch

🤖 Generated with Claude Code

…config resolution

Extracted from PR #1187 — contains only state backend and adapter code,
no docs/adrs, no work/runtime/governance modules.

New files:
- lionagi/state/store.py — StateStore abstraction (SQLite + Postgres)
- lionagi/state/artifacts.py — ArtifactStore with content-addressed storage
- lionagi/state/postgres.py — PostgresStore backend (asyncpg-based)
- lionagi/state/schema_pg.sql — Postgres DDL
- lionagi/adapters/governed_base.py — GovernedAdapter base class
- lionagi/adapters/anthropic_agents.py — GovernedAnthropicAgent
- lionagi/adapters/crewai.py — GovernedCrew
- lionagi/adapters/langchain.py — GovernedChain
- lionagi/adapters/openai_agents.py — GovernedOpenAIAgent
- lionagi/config_resolution.py — resolve_config() helper

Modified (state layer improvements):
- lionagi/state/db.py — transaction() context manager, deferred-commit
  helper, and savepoints for nested transactions
- lionagi/state/health.py, persist.py, provenance.py, reasons.py,
  staleness.py, schema.sql — updated schema and helper functions
- lionagi/adapters/__init__.py — wires in governed adapter exports

Tests: 433 pass, 1 skip (tests/state/, tests/adapters/,
tests/test_config_resolution.py). Ruff clean on all changed .py files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ohdearquant ohdearquant marked this pull request as draft June 2, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant