Skip to content
Back to skills

Diagrid Agent Durability

ASecurity

Build an AI agent on Diagrid (formerly Catalyst) that survives crashes, in any framework or a hand-written model loop, each model call and tool call a recorded step, and wire its MCP server tools. Use for a Durable Agent or agent memory that survives restarts.

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentstypescriptpythonrustgojavaspringapi

Works with

  • claude code
  • terminal
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add diagridio/catalyst-ai --skill diagrid-agent-durability --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Diagrid Agent Durability?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Diagrid Agent Durability
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/diagridio-diagrid-agent-durability/badge)](https://www.skillsdirectory.com/skills/diagridio-diagrid-agent-durability)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: diagrid-agent-durability
description: Build an AI agent on Diagrid (formerly Catalyst) that survives crashes, in any framework or a hand-written model loop, each model call and tool call a recorded step, and wire its MCP server tools. Use for a Durable Agent or agent memory that survives restarts.
---

# Make an agent durable on Diagrid

Goal: end this skill with the user's agent running as a workflow, where each model call
and each tool call is a recorded step, fronted by an `Agent` resource, with one real run
started and a console link to it. A crash then resumes the run where it stopped instead
of starting it again and paying for every model call twice.

This skill is for **durability**. If the user wants an agent they already have deployed
as it is, without making it durable, that is `diagrid-deploy`. Verifying who is calling
the agent, or running its MCP tool calls as that user, is `diagrid-mcp-on-behalf-of`; a
request for both loads both.

## 1. Detect the language and the framework; do not ask

Read the repository before choosing anything.

| Found at the top level | Language |
| --- | --- |
| `pyproject.toml`, `requirements.txt`, `*.py` | Python |
| `*.csproj`, `*.sln`, `global.json` | .NET |
| `pom.xml`, `build.gradle` | Java |
| `go.mod` | Go |
| `package.json`, `tsconfig.json` | TypeScript |
| `Cargo.toml` | Rust |

Then read the dependencies for the framework, and pick the route:

| What the user has | Route |
| --- | --- |
| A framework with a Diagrid adapter: the 11 Python frameworks, Microsoft Agent Framework, Spring AI, langchaingo, Eino, Mastra, Goose | **Adapter.** Wrap the agent with that adapter's runner. [reference/adapters.md](reference/adapters.md) has the coordinate, the runner and how a run starts, per language |
| Its own loop that calls a model API directly, or a framework with no adapter whose loop the user is willing to take over | **Bring your own agent (BYOA).** The loop becomes the workflow: one activity per model call and one per tool call. [reference/byoa.md](reference/byoa.md), plus the language file it names |
| Fixed steps with a model called inside some of them, and no step chosen by the model | Not an agent. `diagrid-workflow-scaffold` |
| A framework with no adapter whose loop cannot be taken over | Say so. Wrapping its `run()` in one step is a retry, not durability. Offer the BYOA route or a framework that has an adapter |

Load only the reference for the route and the language you detected.

## 2. The `Agent` resource fronts the user's own app

The Diagrid resource for an agent is the **`Agent`** kind: a connectivity and archiving
resource in front of an agent that **the user's** app runs. Their process runs the loop
and the resource takes an endpoint and archive settings. Set `spec.endpoint` only when
Diagrid has to call into the process: another app invoking it through Diagrid, or pub/sub
delivery. A worker that only dials out to its sidecar, which is every run started from
this machine, leaves it out. If the user asks for Diagrid to
host or run the agent for them, say it is not something you can set up, and continue with
their own app fronted by an `Agent`. Never write "create an agent" unqualified: say
whether you mean the `Agent` resource or their agent code.

Create it with `diagrid_apply`, which needs a write role. Read
`diagrid_get_resource_schema` for the `Agent` kind first; do not write the manifest from
memory, because the platform rejects unknown fields and a guessed name that happens to be
accepted can mean something else. Run with `dry_run`, show the user, then apply. On
Diagrid, the `Agent` resource is what gives the agent its state, pub/sub and registry:
the platform creates `agent-registry` and refuses one created by hand. A sample's local
`resources/` files are for running without Diagrid.

## 3. Use the project named `default`, and budget it

**Do not create a project.** Every organization gets `default`, with managed pub/sub, a
managed KV store, the workflow store and agent infrastructure already attached. It is not
recreated if someone deletes it: check with `diagrid_list_projects`, and if it is gone,
ask which project to use.

A project holds **one managed pub/sub and one managed KV store** on every plan, so no plan
upgrade is the fix. A coordinator with specialists shares that one broker and separates
the agents by topic, one per specialist plus one for results. Every app, agent and MCP
server counts as one identity against a per-region allowance, so a coordinator plus four
specialists is five. Read the allowance with `diagrid_get_usage` rather than quoting a
figure.

## 4. Start the first run

Start the agent process with the connection values in its environment: `diagrid-develop`
section 3 is the one place that says how, using `diagrid_get_connection`. Then start a
run the way the route's reference says. For an adapter that is a request to the route its
runner serves, listed per language in
[reference/adapters.md](reference/adapters.md#how-a-run-starts); do not explore the
package to find it.

**A run started from this machine needs no tunnel.** The workflow worker dials out to
its sidecar on Diagrid, so the process needs no inbound port to run a workflow, and a
request to its own route on `localhost` starts one. An app tunnel
(`diagrid-app-tunnels`) is needed only when Diagrid has to call into the process: another
app invoking it through Diagrid, pub/sub delivery to it, or an MCP server on this machine
that the agent calls. Set one up only when the user asked for one of those.

Apps, agents and MCP servers are each backed by an identity (an "App ID" in some APIs).
Where a tool asks for or returns `appId`, it means that identity's name; read it from the
resource's `status.appIds`.

Report the run once it completes, with its console link (section 7).

## 5. The crash test is offered, not run

Proving durability means killing the process in the middle of a run and watching the run
resume. It takes minutes, so **run it only when the user asked for it**, in this request
or in answer to your offer. Otherwise, once the first run succeeds, offer it in one line
and stop.

When it runs:

- **Adapter:** start a run, wait until it is mid-run (a model call or a tool call in
  flight), kill the process, and start it again. The run must resume rather than restart.
  If it restarts, the agent is not durable: usually the workflow store or a component
  name.
- **BYOA:** the kill test in [reference/byoa.md](reference/byoa.md), section 12, which
  also checks the process id changed. A kill that matched nothing passes every other
  check.

Either way, the proof is **the answer of the run you killed**. After the restart, wait for
that same run id to complete and read its result: from the app's own route for the run, or
`diagrid_get_workflow_run`, whose output is withheld at the default data-sharing level. A
fresh run that answers correctly proves the agent works, not that the killed run resumed.

## 6. MCP tools go through the agent's own sidecar

An agent calls the tools of a Diagrid `MCPServer` through **its own sidecar's MCP
proxy**. That is the path Diagrid supports, and the one where the server's access policy
is enforced:

- **Discovery:** `GET $DAPR_HTTP_ENDPOINT/v1.0/diagrid/mcp` with
  `dapr-api-token: $DAPR_API_TOKEN` lists the servers this identity is granted, each with
  a `connect.path`.
- **Calls:** point any streamable HTTP MCP client at `$DAPR_HTTP_ENDPOINT` + that
  `connect.path` (`/v1.0/diagrid/mcp/<mcpserver-name>`), with the same header. There is
  no Diagrid-specific MCP SDK. The framework's own MCP client or the `mcp` package works
  unchanged.
- **Access is deny-all until granted.** Use `diagrid_grant_access` with
  `target_kind: mcp_server`, and grant only the tools the user asked for. A caller's
  `tools/list` then shows only the granted tools, and a call to any other tool is refused
  with 403. To verify a grant, make exactly those two calls as the agent's identity.

Wrap each MCP call in one of the agent's tools where the adapter has no MCP wiring of its
own, so it is recorded like any other tool call and a replayed run does not call it
twice. **Do not call MCP tools as workflows**, even though the Dapr Python SDK's
`DaprMCPClient` does: it does not go through app tunnels, and a call that cannot reach its
server leaves the parent workflow running forever. If the user's code already uses it,
say so and move it to the proxy.

## 7. Hand back a link, not a claim

Print each link in this format, with an empty line before and after it:

```
Open the agent in the Diagrid console:

  https://catalyst.diagrid.io/<route from the table below>
```

The first line says what the link opens. The URL goes alone on its own line, indented two
spaces. Do not write it as a markdown link with a label, because the Claude Code terminal
shows only the label, and do not wrap it in backticks.

| To show | Route |
| --- | --- |
| An agent | `/agents/<appId>/<agentId>` |
| The app it runs in | `/apps/details/<appId>` |
| A run of the agent's workflow | `/workflows/<appId>/<runId>` |
| An MCP server | `/mcp-servers/<id>` |

An agent's `<agentId>` is the `agent_id` on its registry record, from
`diagrid_list_agents` or `diagrid_get_agent`, not its name; a link built from the name
opens a page that cannot find the agent. An agent with no registry record yet takes its
app ID in both places. There is no project detail page and no quota page.

The project rides along as `?project=<name>` for a name such as `default`, or
`?projectId=<uid>` for a numeric uid. A number in `?project=` silently falls back to the
user's default project, so if you cannot tell which you hold, omit the parameter. If you
cannot build a link you trust, print the identifiers as plain text.

**An absent field is not an empty one.** At the default `metadata` data-sharing level,
Diagrid's MCP tools remove a run's `input`, `output` and `customStatus`. Never report a
missing payload as "the agent produced no output": say it was not shared at this
organization's data-sharing level and link the console run. Never forge a data-sharing
header, and never ask an administrator to raise the level so you can finish an answer.

## Rules

- **Use the Diagrid MCP tools for everything in Diagrid.**
- **Detect the language and the framework; do not ask.** Load only the reference you
  need.
- **Use the adapter when there is one.** Take the loop over only when there is not.
- **Read `diagrid_get_resource_schema` before applying a manifest.**
- **Do not create a project.** Use `default`.
- **Do not name a package coordinate you have not resolved**, and say plainly when a
  language has no installable adapter instead of guessing one.
- **No tunnel for a run started from this machine.**
- **The crash test is opt-in.** Offer it after the first run; run it when asked.
- **Never report a withheld field as an empty result**, and never guess at a console URL.

Files in this skill

  • SKILL.md10.7 KB
  • reference/adapters.md8.3 KB
  • reference/byoa.md20.2 KB
  • reference/byoa/dotnet.md17.2 KB
  • reference/byoa/go.md15.8 KB
  • reference/byoa/java.md18.3 KB
  • reference/byoa/python.md16 KB
  • reference/byoa/typescript.md13.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.