[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-77904":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":14,"stars7d":15,"stars30d":16,"stars90d":14,"forks30d":14,"starsTrendScore":17,"compositeScore":18,"rankGlobal":8,"rankLanguage":8,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":22,"topics":23,"createdAt":8,"pushedAt":8,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":14,"starSnapshotCount":14,"syncStatus":13,"lastSyncTime":27,"discoverSource":28},77904,"activegraph","yoheinakajima\u002Factivegraph","yoheinakajima",null,"Python",305,22,4,2,0,21,211,7,4.09,"Apache License 2.0",false,"main",true,[],"2026-06-12 02:03:45","# Active Graph\n\n> The graph is the world. Behaviors are physics. The trace is the proof.\n\nAn event-sourced reactive graph runtime for long-running, auditable,\nagentic systems. Behaviors react to a shared graph instead of talking\nto each other. Every change is traceable. Every run is resumable,\nforkable, and diff-able from its event log.\n\nIf chat-based agents are a group conversation, Active Graph is a\nshared workspace where everyone can see what changed, who changed\nit, and why.\n\n## Try it in 30 seconds\n\n```bash\npip install activegraph\nactivegraph quickstart\n```\n\nThe bundled Diligence pack runs against recorded fixtures: no API\nkey, no configuration, byte-deterministic output. You see what the\nframework does before you read about how it does it.\n\nThen walk the 10-minute tutorial:\n\n```bash\nactivegraph quickstart --interactive\n```\n\nIt scaffolds a behavior, runs it against the same fixtures, and ends\nwith the fork-and-diff workflow — the framework's most differentiated\ncapability.\n\n## Install\n\n```bash\npip install activegraph                    # core runtime + SQLite store + Diligence pack\npip install \"activegraph[llm]\"             # Anthropic + OpenAI providers\npip install \"activegraph[anthropic]\"       # Anthropic provider only\npip install \"activegraph[openai]\"          # OpenAI provider only (+ tiktoken)\npip install \"activegraph[postgres]\"        # Postgres-backed event store\npip install \"activegraph[prometheus]\"      # Prometheus metrics\npip install \"activegraph[all]\"             # everything\n```\n\nBoth LLM providers expose the same `LLMProvider` Protocol surface;\nswap one for the other without touching `@llm_behavior` definitions.\nThe [LLM providers reference](https:\u002F\u002Fdocs.activegraph.ai\u002Freference\u002Fllm-providers\u002F)\ncovers the side-by-side surface and the v1.0.1 limitations\n(OpenAI tool use is a v1.1 candidate).\n\nPython 3.11+. Two hard dependencies (`click` for the CLI, `pydantic`\nfor the pack format); persistence backends and provider integrations\nare opt-in extras.\n\n## What you get\n\n- **Event-sourced graph runtime.** Objects + typed relations + an\n  append-only event log. Every mutation is an event; the trace is the\n  audit trail.\n- **Reactive behaviors as first-class.** Function, class, LLM-backed,\n  or attached to typed edges (the relation-behavior primitive — edges\n  with logic). Subscriptions are event type + predicate + a Cypher\n  subset for graph-shape patterns.\n- **Fork-and-diff.** Branch any run at any event into an independent\n  fork, configure it differently, and structurally diff the result\n  against the parent. Cache replay means the shared prefix doesn't\n  re-execute (no new LLM calls). Most agent frameworks can't do this.\n- **Packs.** A pack bundles object types, behaviors, tools, prompts,\n  and policies for a specific domain. The bundled\n  [Diligence pack](activegraph\u002Fpacks\u002Fdiligence) is the reference:\n  8 object types, 7 behaviors, 3 tools, recorded fixtures.\n- **Per-error reference pages.** Every error message ends with a\n  `More:` link to a page that explains when it fires, why, and how to\n  fix it. Catalog at [docs.activegraph.ai\u002Freference\u002Ferrors](https:\u002F\u002Fdocs.activegraph.ai\u002Freference\u002Ferrors\u002F).\n\n## Concepts at a glance\n\nThe framework's twelve primitives, in roughly the order you meet them\nwhen reading a trace. Each links to its concept page on the doc site;\nread those when you want depth on one piece.\n\n- **Graph** — objects and typed relations forming the world the\n  framework reasons about. The graph is a projection of the event log;\n  every mutation is an event. [→ concepts\u002Fgraph](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fgraph\u002F)\n- **Events** — the append-only history. Every behavior fires in\n  response to events and produces more events; the trace is the\n  ordered log of all of them. [→ concepts\u002Fevents](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fevents\u002F)\n- **Behaviors** — the unit of reactive code. Function, class, or\n  LLM-backed; declares what events it subscribes to and what it\n  produces. The determinism contract is per-behavior. [→ concepts\u002Fbehaviors](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fbehaviors\u002F)\n- **Relations** — typed edges between objects, with their own\n  behaviors. The relation-behavior primitive — coordination logic on\n  the edge, not on either endpoint — is uncommon in other agent\n  frameworks. [→ concepts\u002Frelations](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Frelations\u002F)\n- **Patches** — proposed mutations with optimistic concurrency.\n  Behaviors propose patches; the runtime applies or rejects them;\n  rejections are events in their own right. [→ concepts\u002Fpatches](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fpatches\u002F)\n- **Views** — scoped reads of the graph for behavior context. Type\n  filters, depth filters, recent-event windows. Views are how\n  pattern-driven behaviors see only what they need to. [→ concepts\u002Fviews](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fviews\u002F)\n- **Frames** — bounded contexts for a run. Goal, constraints, budget,\n  and the registered behaviors for this frame. A run can have one\n  frame or many. [→ concepts\u002Fframes](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fframes\u002F)\n- **Policies** — approval and gating for behavior capabilities. Which\n  behaviors can call which tools, which mutations require human\n  approval, what the runtime refuses. [→ concepts\u002Fpolicies](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fpolicies\u002F)\n- **Patterns** — the Cypher subset for pattern subscriptions. Beyond\n  event-type + predicate, behaviors can subscribe to graph shapes\n  (claim-cited-by-evidence, task-blocks-task, …) with `NOT EXISTS`\n  and temporal predicates. [→ concepts\u002Fpatterns](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fpatterns\u002F)\n- **Replay** — re-execute a run from its event log. Strict mode\n  re-fires every behavior and fails on divergence; permissive mode\n  reconstructs state without re-firing. The LLM replay cache is what\n  makes fork cheap. [→ concepts\u002Freplay](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Freplay\u002F)\n- **Forking** — branch any run at any event into an independent\n  fork; structurally diff the fork against the parent. The framework's\n  mechanism for hypothesis testing on agentic systems. [→ concepts\u002Fforking](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Fforking\u002F)\n- **Failure model** — a behavior failure is a `behavior.failed`\n  event, not an exception. The audit trail captures failures as\n  first-class history. Exceptions live at runtime entry points only.\n  [→ concepts\u002Ffailure-model](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Ffailure-model\u002F)\n\n## The type system at a glance\n\nWhat's fixed and what's yours. The framework speaks a small vocabulary\nof event types — the verbs of what happened. The nouns and edges of\nyour domain are strings you choose.\n\n**Event types — fixed.** The runtime emits these; the trace, replay,\nand observability surfaces all key off them.\n\n- **Lifecycle:** `goal.created`, `runtime.idle`, `runtime.budget_exhausted`\n- **Graph:** `object.created`, `object.removed`, `relation.created`, `relation.removed`\n- **Behaviors:** `behavior.scheduled`, `behavior.started`, `behavior.completed`, `behavior.failed`, `relation_behavior.started`\n- **Patterns:** `pattern.matched`\n- **LLM:** `llm.requested`, `llm.responded`\n- **Tools:** `tool.requested`, `tool.responded`\n- **Patches:** `patch.proposed`, `patch.applied`, `patch.rejected`\n- **Approvals:** `approval.proposed`, `approval.granted`\n- **Packs:** `pack.loaded`\n\nBehaviors can also emit custom event types — any string. The\n`task.completed` signal in the example below is one: an\napplication-level event the `unblock` relation behavior subscribes\nto, flowing through the same log alongside the framework's own.\n\n**Object and relation types — yours.** Any string works. There is no\ncentral schema, no registration step, no enum to extend.\n`graph.add_object(\"claim\", {...})` creates a `claim` because you said\n`claim`; `graph.add_relation(a, b, \"depends_on\")` makes a\n`depends_on` edge because you said `depends_on`. Packs can attach\noptional Pydantic validation per type; absent a pack, the data passes\nthrough unchanged. The Diligence pack's object types (`claim`,\n`evidence`, `risk`, `memo`, …) and relation types (`supports`,\n`contradicts`, `references`, …) are an example ontology, not framework\nbase types — you design your own for your domain.\n\n**Patch states — fixed.** `proposed` → `applied` | `rejected`. Three\nvalues, two of them terminal.\n\nThe full model — composition, ontology design guidance, the Diligence\npack as a worked example — lives at\n[→ concepts\u002Ftype-system](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Ftype-system\u002F).\n\n## A small example\n\nThe relation-behavior primitive — coordination logic on the edge,\nnot on either endpoint:\n\n```python\nfrom activegraph import Graph, Runtime, behavior, relation_behavior\n\ngraph = Graph()\nruntime = Runtime(graph, budget={\"max_events\": 200, \"max_seconds\": 60})\n\n@behavior(name=\"planner\", on=[\"goal.created\"])\ndef planner(event, graph, ctx):\n    research = graph.add_object(\"task\", {\"title\": \"Research\", \"status\": \"open\"})\n    memo = graph.add_object(\"task\", {\"title\": \"Draft memo\", \"status\": \"blocked\"})\n    graph.add_relation(research.id, memo.id, \"depends_on\")\n\n@behavior(name=\"researcher\", on=[\"object.created\"], where={\"object.type\": \"task\"})\ndef researcher(event, graph, ctx):\n    task = event.payload[\"object\"]\n    if task[\"data\"][\"status\"] != \"open\" or \"Research\" not in task[\"data\"][\"title\"]:\n        return\n    graph.add_object(\"claim\", {\"text\": \"Market early but growing.\", \"confidence\": 0.7})\n    graph.emit(\"task.completed\", {\"task_id\": task[\"id\"]})\n\n@relation_behavior(name=\"unblock\", relation_type=\"depends_on\", on=[\"task.completed\"])\ndef unblock(relation, event, graph, ctx):\n    if event.payload[\"task_id\"] == relation.source:\n        graph.patch_object(relation.target, {\"status\": \"open\"})\n\nruntime.run_goal(\"Evaluate this startup idea\")\nruntime.print_trace()\n```\n\nThe `unblock` relation behavior fires only for events touching one of\nits edge endpoints. The conceptual deep-dive on edges-with-logic is\nin [`docs\u002Fconcepts\u002Frelations.md`](https:\u002F\u002Fdocs.activegraph.ai\u002Fconcepts\u002Frelations\u002F).\n\n## Documentation\n\n- **[docs.activegraph.ai](https:\u002F\u002Fdocs.activegraph.ai\u002F)** — full doc site:\n  concepts, guides, cookbook, CLI reference, API reference, the\n  per-error catalog.\n- **[10-minute tutorial](https:\u002F\u002Fdocs.activegraph.ai\u002Fquickstart\u002F)** — install\n  to a working custom behavior, including fork-and-diff.\n- **AI coding assistants** — the docs are machine-readable at\n  [docs.activegraph.ai\u002Fllms.txt](https:\u002F\u002Fdocs.activegraph.ai\u002Fllms.txt)\n  (structured index) and\n  [docs.activegraph.ai\u002Fllms-full.txt](https:\u002F\u002Fdocs.activegraph.ai\u002Fllms-full.txt)\n  (concatenated full content), generated from the same source markdown\n  as the rendered site. Built for AI agents evaluating the framework\n  via Claude Code, Cursor, Replit, and similar tooling.\n- **[CHANGELOG.md](CHANGELOG.md)** — every release, with per-version\n  migration notes.\n- **[CONTRACT.md](CONTRACT.md)** — locked design decisions, version\n  by version. Useful when you want to know *why* something is the way\n  it is.\n- **[examples\u002F](examples)** — runnable end-to-end demos:\n  [`diligence_real_run.py`](examples\u002Fdiligence_real_run.py),\n  [`resume_and_fork.py`](examples\u002Fresume_and_fork.py),\n  [`llm_claim_extraction.py`](examples\u002Fllm_claim_extraction.py),\n  [`diligence_with_tools.py`](examples\u002Fdiligence_with_tools.py),\n  [`operate_a_run.py`](examples\u002Foperate_a_run.py),\n  [`babyagi.py`](examples\u002Fbabyagi.py) — BabyAGI's autonomous agent loop,\n  rebuilt as three reactive behaviors over a shared graph.\n\n## What this is not\n\n- Not a chat framework. If your problem fits in one conversation, use\n  a chat framework.\n- Not a workflow engine. Workflows model control flow. This models\n  world state.\n- Not a rules engine, exactly. Rules engines forward-chain over\n  facts. This event-sources over a graph and supports LLM behaviors\n  as first-class.\n- Not a production graph database. The default store is SQLite,\n  optionally Postgres. For a high-throughput graph backend, plug one\n  in behind the `EventStore` protocol.\n- Not magic. Bad behaviors produce bad graphs. The runtime makes the\n  badness inspectable, not absent.\n\n## Status\n\n**v1.0 (stable)** (2026-05). The first-time-user gate per\n[CONTRACT v1.0 #C4](CONTRACT.md#v10-c4-v10-ships-as-v10-rc1-first-time-user-gate-is-owned-externally)\nran through three rcs; v1.0 final ships rc3 plus a tutorial-step-7\noutput fix and a README \"Concepts at a glance\" index. See\n[CHANGELOG.md](CHANGELOG.md) for the full v0 → v1.0 history and\nper-version migration notes.\n\nMajor shipped milestones:\n\n- **v1.0** — error hierarchy rewrite with per-error reference\n  pages, doc site at [docs.activegraph.ai](https:\u002F\u002Fdocs.activegraph.ai\u002F),\n  `activegraph quickstart` command, mypy `--strict` and docstring\n  coverage CI gates, wheel-completeness and deploy-verification CI\n  gates.\n- **v0.9** — pack format and the Diligence reference pack (8 object\n  types, 7 behaviors, 3 tools, recorded fixtures).\n- **v0.8** — operator surface: structured logging, Prometheus\n  metrics, `runtime.status()`, full `activegraph` CLI,\n  `PostgresEventStore`.\n- **v0.7** — `@tool` decorator, Cypher-subset pattern subscriptions,\n  temporal predicates.\n- **v0.6** — `@llm_behavior` with structured output, frame-aware\n  prompt construction, cost accounting.\n- **v0.5** — full event-log persistence, save\u002Fload across processes,\n  fork from any historical event, structural diff between runs.\n- **v0** — core runtime: graph, behaviors, relation behaviors,\n  patches with optimistic concurrency, views, frames, policies,\n  budgets, the trace.\n\nRoadmap items planned for v1.1 are tracked in\n[CONTRACT.md § v1.1](CONTRACT.md).\n\n## License\n\nActive Graph is licensed under the Apache License 2.0. See\n[LICENSE](LICENSE) for the full text and [NOTICE](NOTICE) for\nthe attribution that downstream redistributors must preserve.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for the current contribution\npolicy. The framework is in its early public phase: issues are open,\ndocumentation PRs are welcome, code PRs are maintainer-only with an\nissue-first discussion gate (the abstractions are still settling).\nThe policy relaxes as the contributor community matures.\n\n**Test discipline:** tests must remain deterministic. No live network\ncalls in CI. LLM and tool tests use recorded fixtures\n(`RecordedLLMProvider`, `RecordedToolProvider`). If a contribution\nadds a test that would only pass with a live API key or live HTTP,\nit cannot land.\n\n---\n\nThe graph is the world. Behaviors are physics. The trace is the proof.\n","Active Graph 是一个事件驱动的反应式图运行时，适用于需要长期运行、可审计且具有代理功能的系统。其核心功能包括基于事件的图数据存储、支持多种类型的行为（如函数、类或LLM支持的行为）以及独特的分支和差异比较能力，使得任何运行都可以被分支并在不同配置下进行结构化对比。此外，它还提供了包机制来封装特定领域的对象类型、行为、工具等资源。该项目适合于构建需要高度透明度与可追溯性的协作工作空间，特别是在多代理系统中跟踪变更来源及其原因的场景。使用Python编写，支持多种后端存储及LLM提供商集成。","2026-06-11 03:56:12","CREATED_QUERY"]