### Update Quickstart Example Session
Source: https://docs.activegraph.ai/about/changelog
Snippet indicating the need to update the quickstart example session file to reflect the new domain.
```text
examples/quickstart_session.txt
```
--------------------------------
### Postgres Event Store Setup
Source: https://docs.activegraph.ai/about/changelog
Instructions for setting up the PostgresEventStore, which adheres to the EventStore protocol. Requires installing the postgres extra.
```Shell
pip install activegraph[postgres]
```
--------------------------------
### Postgres Setup for Active Graph
Source: https://docs.activegraph.ai/guides/operating-in-production
Installs the necessary package for Postgres support and creates the database. The schema is created automatically on the first connection.
```bash
createdb activegraph_prod
# Schema is created lazily on first connection. No migration step.
pip install 'activegraph[postgres]' # pulls psycopg>=3.1,<4
```
--------------------------------
### Scaffolding a New Pack and Basic Setup
Source: https://docs.activegraph.ai/guides/authoring-packs
Commands to create a new pack, navigate into its directory, install it as an editable package, and run a smoke test. This also includes a Python command to verify the pack can be imported and accessed.
```bash
activegraph pack new my-pack
cd my-pack
pip install -e .
pytest # smoke test passes
python -c "import my_pack; print(my_pack.pack)"
```
--------------------------------
### Diagnose PackNotFoundError with Installed List
Source: https://docs.activegraph.ai/reference/errors/pack-not-found-error
This example shows how the error message includes the list of currently installed packs, aiding in diagnosis.
```text
PackNotFoundError: no installed pack named 'diligence'
What failed:
activegraph.packs.load_by_name('diligence') searched the
`activegraph.packs` entry-point group and found no pack with
that name.
installed: 'research', 'memory'
```
--------------------------------
### Run Active Graph Quickstart
Source: https://docs.activegraph.ai/
This command initiates the Active Graph quickstart process, running a bundled Diligence pack on fixtures. It requires no API key or configuration and completes in under 30 seconds, providing an immediate demonstration of the framework's functionality.
```bash
activegraph quickstart
```
--------------------------------
### Discovering Installed Packs
Source: https://docs.activegraph.ai/reference/api/packs
Demonstrates how to enumerate installed packs using the `activegraph.packs` entry point group. The discovery cache is per process.
```python
import activegraph
packs = activegraph.packs.get_all()
```
--------------------------------
### Quick Fix Examples for SQLite and Postgres URLs
Source: https://docs.activegraph.ai/reference/errors/invalid-store-url-error
Examples demonstrating the correct format for SQLite and Postgres store URLs, including relative and absolute paths for SQLite.
```bash
# SQLite file (note the slash count — three for relative, four for absolute):
activegraph inspect sqlite:///relative/path.db
activegraph inspect sqlite:////absolute/path.db
# Postgres database:
activegraph inspect postgres://host/dbname
activegraph inspect postgres://user:pass@host:port/dbname
```
--------------------------------
### Install OpenAI Provider for ActiveGraph
Source: https://docs.activegraph.ai/about/changelog
Install the OpenAIProvider for ActiveGraph. This can be done by installing the 'openai' or 'llm' extra.
```bash
pip install "activegraph[openai]"
```
```bash
pip install "activegraph[llm]"
```
--------------------------------
### Verify Package Installation and Functionality
Source: https://docs.activegraph.ai/about/publishing
This snippet demonstrates how to verify a published package by creating a virtual environment, installing the package, and checking its version and basic functionality.
```bash
python -m venv /tmp/verify-publish
source /tmp/verify-publish/bin/activate
pip install activegraph==1.0.0rc2
activegraph --version # should print 1.0.0rc2
activegraph quickstart # should run end-to-end against fixtures
deactivate
rm -rf /tmp/verify-publish
```
--------------------------------
### Install ActiveGraph with LLM Extras
Source: https://docs.activegraph.ai/reference/llm-providers
Install ActiveGraph with specific extras to include the desired LLM providers. Use '[anthropic]' for AnthropicProvider, '[openai]' for OpenAIProvider, or '[llm]' for both.
```bash
pip install "activegraph[anthropic]" # AnthropicProvider only
pip install "activegraph[openai]" # OpenAIProvider only
pip install "activegraph[llm]" # both providers
```
--------------------------------
### Pack Prompt File Frontmatter Example
Source: https://docs.activegraph.ai/reference/api/packs
Example of the required TOML frontmatter for a pack prompt file, including version and an optional name.
```toml
---
version = "1.0.0"
name = "optional_name"
---
```
--------------------------------
### Install ActiveGraph
Source: https://docs.activegraph.ai/quickstart
Installs the ActiveGraph package using pip and verifies the installation by checking the version.
```bash
pip install activegraph
activegraph --version
```
--------------------------------
### PostgreSQL Connection URL
Source: https://docs.activegraph.ai/reference/cli
Example of a PostgreSQL connection URL accepted by the CLI.
```bash
postgres://user:pass@host:port/dbname # also accepted: postgresql://
```
--------------------------------
### Check Pack Installation
Source: https://docs.activegraph.ai/reference/errors/pack-not-found-error
Use this command to verify if a specific pack distribution is installed in your environment.
```bash
pip show
```
--------------------------------
### Install or Upgrade ActiveGraph
Source: https://docs.activegraph.ai/about/changelog
Use pip to install or upgrade to the latest version of ActiveGraph.
```bash
pip install --upgrade activegraph==1.0.2
```
--------------------------------
### Interactive Custom Behavior
Source: https://docs.activegraph.ai/quickstart
Starts an interactive session to guide the user through writing their first custom behavior. This involves creating a Python file and implementing logic to flag specific claims.
```bash
activegraph quickstart --interactive
```
--------------------------------
### SQLite Connection URLs
Source: https://docs.activegraph.ai/reference/cli
Examples of valid SQLite connection URLs for the CLI, distinguishing between relative and absolute paths.
```bash
sqlite:///relative/path/to/run.db # three slashes — relative
sqlite:////absolute/path/to/run.db # four slashes — absolute
```
--------------------------------
### Pack Declaration Example
Source: https://docs.activegraph.ai/reference/api/packs
Illustrates the structure of a pack declaration, emphasizing that equality and hashing are based on name and version.
```python
from dataclasses import dataclass
@dataclass(frozen=True)
class Pack:
name: str
version: str
# ... other fields
```
--------------------------------
### Behavior Execution Trace
Source: https://docs.activegraph.ai/quickstart
This is an example of the trace output when a behavior runs. It shows the lifecycle of the behavior and any events it emits.
```text
[behavior.started] growth_flagger (matched object.created: claim#NN)
[event.emitted] growth.flagged claim_id=claim#NN growth=28
[behavior.completed] growth_flagger
```
--------------------------------
### Fork and diff runs using CLI
Source: https://docs.activegraph.ai/cookbook/common-patterns
Compare alternative hypotheses by forking a run and applying an override. This CLI example shows how to fork a run with a pack-setting override and then diff the results.
```bash
# Find the event before the setting matters (usually the goal
# event or a pack.loaded event):
activegraph inspect --run-id --tail 50
# Fork with the override (v1.1):
activegraph fork --run-id --at-event \
--label cautious \
--set diligence.confidence_threshold_for_review=0.9 \
--record
# Diff the two runs:
activegraph diff --run-a --run-b
```
--------------------------------
### Pattern Match Event Trace
Source: https://docs.activegraph.ai/concepts/patterns
This example shows the trace output for a pattern match event, indicating the behavior name and the number of matches found.
```text
[pattern.matched] evt_042 contradiction_detector matches=2
[behavior.started] contradiction_detector
```
--------------------------------
### Fork with Pack Setting Override
Source: https://docs.activegraph.ai/about/changelog
Example of using the `fork` command with a setting override for experimentation. This is a canonical Python API recipe.
```Shell
fork --set .=
```
--------------------------------
### Versioned Prompt Declaration
Source: https://docs.activegraph.ai/reference/api/packs
Example of a versioned prompt with a human-readable version and a truncated content hash for the replay contract.
```python
class PackPrompt:
version: str = "1.0.0"
content_hash: str = "a1b2c3d4e5f67890" # Truncated SHA-256
```
--------------------------------
### Discover and Load Packs by Name
Source: https://docs.activegraph.ai/guides/authoring-packs
Use the discover function to enumerate installed packs and load specific packs by their registered name. This is the standard mechanism for third-party pack distribution.
```python
from activegraph.packs import discover, load_by_name
for entry in discover():
print(entry.name, entry.version)
# runtime.load_pack( load_by_name("my-extension")) Just Works.
```
--------------------------------
### activegraph pack new
Source: https://docs.activegraph.ai/reference/cli
Scaffolds a new pack package skeleton, including configuration files and example stubs.
```APIDOC
## `pack new`
Scaffold a new pack package skeleton.
```
activegraph pack new [--output-dir ]
```
### Parameters
#### Path Parameters
* `` (string) - Required positional - Pack name. Becomes the Python module name and the `Pack(name=...)` declaration.
#### Query Parameters
* `--output-dir ` (string) - Optional - Directory under which to create the package. Defaults to the current directory.
### Description
Generates `pyproject.toml`, the Python package with stubs for object types, behaviors, tools, settings, an example prompt, a smoke test, and a README. After `cd ` and `pip install -e .`, the pack is discoverable via `activegraph pack list` and loadable via `Runtime.load_pack`.
The Authoring packs guide is the companion reference.
### Exits
* 0 on success
* 2 on bad arguments.
```
--------------------------------
### Combine Pattern Subscription with Event Type and Where Filters
Source: https://docs.activegraph.ai/concepts/patterns
This example demonstrates how to combine a pattern subscription with event type (`on`) and property (`where`) filters. All conditions must be met for the behavior to fire.
```python
@behavior(
name="contradiction_detector",
on=["object.created"],
where={"object.type": "claim"},
pattern="(c:claim)-[:contradicts]->(other:claim)",
)
```
--------------------------------
### Scanning Directory for Prompts
Source: https://docs.activegraph.ai/reference/api/packs
Scans a directory for `*.md` prompt files with TOML frontmatter. Each file must start with a version and optional name in the frontmatter.
```python
import activegraph
prompts = activegraph.packs.scan_directory("/path/to/prompts")
```
--------------------------------
### Register Pack via Python Entry Points
Source: https://docs.activegraph.ai/guides/authoring-packs
Register your pack under the 'activegraph.packs' entry point group in pyproject.toml for framework discovery. The framework can then enumerate installed packs.
```toml
# pyproject.toml of any pack
[project.entry-points."activegraph.packs"]
diligence = "activegraph.packs.diligence:pack"
```
--------------------------------
### Scaffold New Pack Package
Source: https://docs.activegraph.ai/reference/cli
Generates a new pack package skeleton, including configuration files and example code. The generated package can be installed and discovered by ActiveGraph.
```bash
activegraph pack new [--output-dir ]
```
--------------------------------
### Fixing MissingOptionalDependency with Pip
Source: https://docs.activegraph.ai/reference/errors/missing-optional-dependency
When encountering a MissingOptionalDependency error, the error message will specify the required package and the pip install command to resolve it. This example shows the typical fix for a missing Postgres dependency.
```bash
pip install 'activegraph[postgres]'
```
--------------------------------
### Override Prompt Template for Schema Echo
Source: https://docs.activegraph.ai/reference/errors/llm-behavior-error
Provides a custom 'prompt_template' for '@llm_behavior' to explicitly guide the model when it tends to echo the schema. Includes a synthesized example instance and instructions to return an instance.
```python
from activegraph import llm_behavior
@llm_behavior(
output_schema=ClaimList,
prompt_template=(
"{system}\n\n"
"{view}\n\n"
"Example response (this is the shape — substitute real values):\n"
'{{"claims": [{{"speaker": "CFO", "statement": "Revenue grew 28%.",
"confidence": 0.92}}]}}\n\n"
"{event}\n\n"
"{instruction}"
),
)
def extract_claims(event, graph, ctx, llm_output): ...
```
--------------------------------
### Runtime Initialization with Connection URLs
Source: https://docs.activegraph.ai/cookbook/migration-from-v0-7
Demonstrates how to initialize the Runtime using connection URLs, which became the canonical addressing form in v0.8. The v0.7 path argument is preserved as shorthand for SQLite.
```python
# v0.7:
rt = Runtime(graph, persist_to="/path/to/run.db")
```
```python
# v0.8+:
rt = Runtime(graph, persist_to="/path/to/run.db") # still works
rt = Runtime(graph, store=SQLiteEventStore("/path/to/run.db"))
rt = Runtime(graph, store=PostgresEventStore("postgres://host/db"))
```
--------------------------------
### Load Pack with Settings
Source: https://docs.activegraph.ai/about/changelog
Demonstrates how to load a pack into the runtime with specific settings. This operation is idempotent and raises errors for conflicts.
```Python
runtime.load_pack(pack, settings=...)
```
--------------------------------
### MyPack Entry Point Configuration
Source: https://docs.activegraph.ai/guides/authoring-packs
Configures the pack's entry point in `pyproject.toml` so ActiveGraph can discover and load it by name.
```toml
# pyproject.toml
[project.entry-points."activegraph.packs"]
my-pack = "my_pack:pack"
```
--------------------------------
### Initializing a Pack with Empty Settings
Source: https://docs.activegraph.ai/guides/authoring-packs
When a pack has no configurable settings, use `EmptySettings` for the `settings_schema`.
```python
from activegraph.packs import EmptySettings, Pack
pack = Pack(..., settings_schema=EmptySettings)
```
--------------------------------
### Install ActiveGraph v1.0.5
Source: https://docs.activegraph.ai/about/changelog
Installs or upgrades the ActiveGraph Python package to version 1.0.5.
```bash
pip install --upgrade activegraph==1.0.5
```
--------------------------------
### Loading a Tool Pack
Source: https://docs.activegraph.ai/reference/errors/missing-tool-error
Shows how to load a pack to make its tools available to the runtime. This is an alternative to registering individual tools.
```python
rt.load_pack(my_pack, settings=...)
```
--------------------------------
### Example UnsupportedPatternError Message
Source: https://docs.activegraph.ai/reference/errors/unsupported-pattern-error
This is an example of the error message format when a pattern fails to parse due to unexpected characters.
```text
UnsupportedPatternError: pattern does not parse: unexpected character at position 17
What failed:
While parsing the pattern: unexpected character at position 17.
at: '@'
```
--------------------------------
### Load a Pack
Source: https://docs.activegraph.ai/reference/errors/behavior-not-found-error
If the behavior is part of a pack, use this command to load the pack into the runtime. Ensure the pack name and any necessary settings are correctly provided.
```python
rt.load_pack(my_pack, settings=...)
```
--------------------------------
### Example of a behavior.failed trace event
Source: https://docs.activegraph.ai/reference/errors/llm-behavior-error
This is an example of a trace event emitted by the runtime when a behavior fails, indicating the behavior name and the reason for failure.
```text
[behavior.failed] evt_NNN your.behavior reason=llm.parse_error
```
--------------------------------
### Migrate and Fork with SQLite
Source: https://docs.activegraph.ai/reference/errors/incompatible-runtime-state
Use this snippet to migrate a runtime to a SQLite store before forking. This is necessary because runtime.fork() requires a SQLite-backed runtime.
```bash
# Migrate the run to a SQLite store first, then fork:
activegraph migrate --from --to sqlite:///fork-source.db
activegraph fork sqlite:///fork-source.db --run-id --at-event
```
--------------------------------
### URL parsing + helpers
Source: https://docs.activegraph.ai/reference/api/store
Provides a single entry point for opening a store from a URL, used by the runtime and CLI. It also includes a utility to parse store URLs and raise informative errors for invalid formats.
```APIDOC
## URL parsing + helpers
### Description
Opens a store for a given `run_id` at a specified `url`. This is the primary method used by the runtime and CLI to access event stores. It also includes functionality to parse store URLs and validate their format, raising `InvalidStoreURL` for malformed URLs.
### Method
Function
### Signature
`open_store(url, run_id)`
### Parameters
#### Path Parameters
- **url** (string) - Required - The URL of the store (e.g., `sqlite:///dev.db`, `postgres://...`).
- **run_id** (string) - Required - The ID of the run to open within the store.
### Returns
- **EventStore** - An instance of the EventStore.
```
--------------------------------
### Pack Conflict Error Message Example
Source: https://docs.activegraph.ai/reference/errors/pack-conflict-error
This is an example of the error message produced by the framework when a `PackConflictError` occurs. It clearly states the type of conflict and the names of the packs involved.
```text
PackConflictError: behavior name conflict: 'diligence.researcher'
declared by both pack 'diligence' and pack 'research'
```
--------------------------------
### Initialize RecordedLLMProvider
Source: https://docs.activegraph.ai/reference/llm-providers
Wrap a concrete LLM provider with RecordingLLMProvider to cache and replay LLM interactions. Fixtures are stored in the specified directory.
```python
from activegraph.llm import RecordingLLMProvider, OpenAIProvider
inner = OpenAIProvider()
provider = RecordingLLMProvider(inner, fixtures_dir="tests/fixtures/llm")
```
--------------------------------
### Loading and Running a Pack in User Code
Source: https://docs.activegraph.ai/guides/authoring-packs
Demonstrates how to load a pack by name and run a goal using the ActiveGraph Runtime. Allows specifying pack settings during loading.
```python
# user code
from activegraph import Runtime
from activegraph.packs import load_by_name
rt = Runtime(graph)
rt.load_pack(load_by_name("my_pack"), settings=MyPackSettings(threshold=0.8))
rt.run_goal("...")
```
--------------------------------
### Instantiate Runtime with RecordedLLMProvider for Offline Use
Source: https://docs.activegraph.ai/reference/errors/missing-provider-error
For offline replay or tests, use a RecordedLLMProvider. Specify the directory containing your fixture data.
```python
from activegraph.llm.recorded import RecordedLLMProvider
rt = Runtime(
Graph(),
llm_provider=RecordedLLMProvider(fixture_dir="path/to/fixtures"),
)
```
--------------------------------
### Upgrade ActiveGraph to v1.0.3
Source: https://docs.activegraph.ai/about/changelog
Install the latest version of ActiveGraph to benefit from recent improvements and fixes.
```bash
pip install --upgrade activegraph==1.0.3
```
--------------------------------
### activegraph pack list
Source: https://docs.activegraph.ai/reference/cli
Lists installed packs discovered via the `activegraph.packs` entry-point group.
```APIDOC
## `pack list`
List installed packs discovered via the `activegraph.packs` entry-point group.
```
activegraph pack list
```
### Description
Prints one pack per line: name, version, distribution name. The underlying mechanism is the same `discover()` API programmatically — see `load-by-name` in the API reference.
### Exits
* 0 always (an empty list is not an error).
```
--------------------------------
### Create New Pack
Source: https://docs.activegraph.ai/guides/operating-in-production
Creates a new pack with the specified name.
```bash
activegraph pack new
```
--------------------------------
### Handle PackNotFoundError in Code
Source: https://docs.activegraph.ai/reference/errors/pack-not-found-error
Demonstrates how to catch a PackNotFoundError and access its `name` and `installed` attributes for debugging.
```python
try:
p = load_by_name("diligence")
except PackNotFoundError as e:
print(e.name)
print(e.installed)
```
--------------------------------
### Running a Goal
Source: https://docs.activegraph.ai/concepts/graph
Initiates a goal in the runtime. Behaviors subscribed to the 'goal.created' event will react to this.
```python
rt.run_goal("Diligence: Northwind Robotics")
```
--------------------------------
### Diagnosing RuntimeContextRequiredError
Source: https://docs.activegraph.ai/reference/errors/runtime-context-required-error
This example shows how to catch the RuntimeContextRequiredError and access the name of the method that caused the error.
```python
try:
behavior(event, graph, ctx)
except RuntimeContextRequiredError as e:
print(e.method) # 'ctx.propose_object'
```
--------------------------------
### Upgrade ActiveGraph to a specific version
Source: https://docs.activegraph.ai/about/changelog
Use this command to upgrade your ActiveGraph installation to version 1.0.5.post2. This is a forward-compatible update.
```bash
pip install --upgrade activegraph==1.0.5.post2
```
--------------------------------
### Initialize Runtime with LLM Providers
Source: https://docs.activegraph.ai/reference/llm-providers
Instantiate the Runtime with either AnthropicProvider or OpenAIProvider. This choice determines the model family used for LLM interactions.
```python
from activegraph import Graph, Runtime
from activegraph.llm import AnthropicProvider, OpenAIProvider
rt = Runtime(Graph(), llm_provider=AnthropicProvider()) # or:
rt = Runtime(Graph(), llm_provider=OpenAIProvider())
```
--------------------------------
### Discover Packs via Python Entry Points
Source: https://docs.activegraph.ai/about/changelog
Code for discovering and loading packs using Python entry points. Includes functions for discovery, loading by name, and cache management.
```Python
activegraph.packs.discover()
```
```Python
activegraph.packs.load_by_name()
```
```Python
activegraph.packs.clear_discovery_cache()
```
--------------------------------
### Running a Behavior with a Runtime
Source: https://docs.activegraph.ai/reference/errors/runtime-context-required-error
Instantiate a Runtime and use it to run a goal, ensuring behaviors within the goal are executed with a runtime-bound context.
```python
from activegraph import Runtime, Graph
rt = Runtime(Graph(), llm_provider=...)
rt.run_goal("...") # behaviors fire with ctx bound to rt
```
--------------------------------
### Clearing Pack Discovery Cache
Source: https://docs.activegraph.ai/reference/api/packs
Resets the cached pack entry-point scan. This is necessary for tests that dynamically install packages.
```python
import activegraph
activegraph.packs.clear_discovery_cache()
```
--------------------------------
### List Packs
Source: https://docs.activegraph.ai/guides/operating-in-production
Lists available packs.
```bash
activegraph pack list
```
--------------------------------
### Implement a Custom LLMProvider
Source: https://docs.activegraph.ai/reference/llm-providers
Create a custom LLM provider by implementing the required methods: complete, estimate_cost, and count_tokens. The default_model and recognizes_model methods are optional but recommended for enhanced functionality.
```python
from decimal import Decimal
from activegraph.llm import LLMMessage, LLMResponse, LLMProvider
class MyProvider:
default_model = "my-model-name" # v1.0.2 #1 — used when @llm_behavior omits model=
def complete(self, *, system, messages, model, max_tokens,
temperature, top_p, output_schema, timeout_seconds,
tools=None) -> LLMResponse:
...
def estimate_cost(self, *, input_tokens, output_tokens, model) -> Decimal:
...
def count_tokens(self, *, system, messages, model) -> int:
...
def recognizes_model(self, name: str) -> bool: # v1.0.2 #1
return name.startswith("my-")
assert isinstance(MyProvider(), LLMProvider)
```
--------------------------------
### Catch and Inspect ReplayDivergenceError
Source: https://docs.activegraph.ai/reference/errors/replay-divergence-error
Example of catching a ReplayDivergenceError in Python and accessing its properties like event_id, kind, expected, and actual values.
```python
try:
rt = Runtime.load(url, run_id=parent_run, replay_strict=True)
except ReplayDivergenceError as e:
print(e.event_id, e.kind, e.expected, e.actual)
```
--------------------------------
### Instantiate Runtime with AnthropicProvider
Source: https://docs.activegraph.ai/reference/errors/missing-provider-error
Pass an `llm_provider` argument to the Runtime constructor when using LLM behaviors. This example shows how to use the AnthropicProvider.
```python
from activegraph import Runtime, Graph
from activegraph.llm.anthropic import AnthropicProvider
rt = Runtime(
Graph(),
llm_provider=AnthropicProvider(),
)
```
--------------------------------
### Gated Object Creation Approval
Source: https://docs.activegraph.ai/reference/api/packs
An example of an object creation that is gated behind a policy approval, requiring `runtime.approve(...)` to proceed.
```python
class ApprovalRequiredObject:
id: str
kind: Literal["object"] = "object"
# ... other fields
```
--------------------------------
### Testing Tutorial Snippets
Source: https://docs.activegraph.ai/about/changelog
This Python script tests tutorial snippets by running them as subprocesses. It asserts successful execution and idempotency on re-runs.
```python
tests/test_tutorial_snippets.py
```
--------------------------------
### Upgrade ActiveGraph to v1.0.4
Source: https://docs.activegraph.ai/about/changelog
Install the latest version of ActiveGraph to benefit from the latest features and fixes. This command upgrades the package to version 1.0.4.
```bash
pip install --upgrade activegraph==1.0.4
```
--------------------------------
### Declaring Policies in a Pack
Source: https://docs.activegraph.ai/concepts/policies
Example of how to declare policies within a Pack declaration. Specifies object types requiring approval and a setting for auto-approval.
```python
from activegraph.packs import Pack, PackPolicy
pack = Pack(
name="diligence",
version="0.1.0",
policies=[
PackPolicy(
name="memo_approval",
requires_approval=["memo"],
settings_key="auto_approve_memos",
),
...
],
...
)
```
--------------------------------
### Upgrade ActiveGraph Package
Source: https://docs.activegraph.ai/cookbook/migration-from-v0-7
Installs the latest version of the ActiveGraph package. Use `activegraph[all]` to include optional extras like anthropic, psycopg, and prometheus_client.
```bash
pip install --upgrade activegraph
```
--------------------------------
### Keep Loaded Version or Swap Versions
Source: https://docs.activegraph.ai/reference/errors/pack-version-conflict-error
Illustrates how to either keep the currently loaded pack version or swap to a new version by constructing a fresh Runtime. `load_pack` does not support in-place version swapping.
```python
# Keep the loaded version — don't load the new one. The runtime
# stays where it is.
# Or, swap versions by constructing a fresh Runtime:
rt = Runtime(Graph(), llm_provider=...)
rt.load_pack(new_version_of_pack, settings=...)
```
--------------------------------
### Show pack versions and prompt content hashes
Source: https://docs.activegraph.ai/cookbook/debugging
Use `activegraph inspect --pack-version` to display the versions of packs and hashes of prompt content used in a run. This is crucial for diagnosing prompt drift errors.
```bash
activegraph inspect --pack-version
```