---
title: "Framework and code"
description: "Framework, what the agent is built with; Middleware and Graph, the code around and between its model calls; and Source, a file to fingerprint."
source: "Guardian Agent SDK"
---
A definition records what an agent is built with and the code that shapes its behaviour, fingerprinted so that a change to that code gives a new definition.

## Framework

{/* generated api guardian_agent.Framework */}

What the agent is built with, and the versions that matter.

Package versions are part of the definition on purpose: upgrading one
gives the agent a new definition.

Example:

```python
ga.Framework("custom", packages=["my-agent"])  # installed versions
ga.Framework("langgraph", packages={"langgraph": "1.2.13"})
```

**Attributes:**

- **name** (`str`) – The framework, such as `"langgraph"` or `"custom"`.
- **packages** (`Mapping[str, str]`) – Package versions by name. Given a list of names, each
  installed package's version is looked up.

**Raises:**

- `ValueError` – A listed package isn't installed.

{/* end generated */}

## Middleware

{/* generated api guardian_agent.Middleware */}

Code that runs around the model calls, such as retries or routing.

Middleware keeps the order you give it, since order is behaviour.

**Attributes:**

- **name** (`str`) – The middleware's class or function name.
- **config** (`Mapping[str, Any] | None`) – Values it was constructed with (a prompt template, fallback
  models, limits), never values computed per request.
- **source_hash** (`str | None`) – `sha256:<hex>` of its source.

{/* end generated */}

## Graph

{/* generated api guardian_agent.Graph */}

The agent's graph: its nodes and the edges between them.

Nodes named by an edge are included for you.

Example:

```python
ga.Graph(edges=[("model", "tools", True), ("tools", "model")])
```

**Attributes:**

- **edges** (`Iterable[tuple[str, str] | tuple[str, str, bool]]`) – `(source, target)` or `(source, target, conditional)`.
- **nodes** (`Iterable[str]`) – Nodes no edge names.

{/* end generated */}

## Source

{/* generated api guardian_agent.Source */}

A source file to fingerprint, so editing it gives a new definition.

Example:

```python
ga.Source(Path("planner.py"))  # hashed now
```

**Attributes:**

- **path** (`str | PathLike[str]`) – The file, recorded as given (relative paths read best).
- **sha256** (`str | None`) – Its hex SHA-256; computed from the file when not given.

{/* end generated */}