> ## Documentation Index
> Fetch the complete documentation index at: https://darwin.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mastra

> Add Darwin tools and durable Act thread state to a Mastra workflow.

Create typed Mastra tools around the Darwin SDK or use remote MCP where supported. Keep discovery and mutation tools separate.

Persist the selected target/capability IDs, `thread`, cursor, and idempotency keys in workflow state. Use `get_thread` after process restarts, delayed providers, or browser-based interactions.

Treat typed thread requests and operation states as the router for valid next steps and surface confirmation, approval, authentication, or payment review to the user instead of automatically continuing.

## Suggested workflow data

```typescript theme={null}
type DarwinWorkflowState = {
  targetAgent?: string;
  capability?: string;
  thread?: string;
  cursor?: string;
  retryIds: Record<string, string>;
  latestThread?: unknown;
};
```

Checkpoint before and after each write. After a process restart, load `thread` and the last consumed cursor, then call `get_thread` before choosing a node.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.