Snapshot of the installed OAC framework (/app/.opencode) including Claus's custom agents:
- agent/OpenArchitect.md (Aiden, the architect)
- agent/subagents/openagent.md (GMS sub-agent builder)
- agent/core/openagent.md, agent/core/opencoder.md (customized)
- agent/subagents/{code,core,development,system-builder}/*
- command/, context/, skills/, tool/, README.md, env.example
Excluded runtime artifacts: node_modules/, bin/opencode (184MB binary), lockfiles.
42 lines
1.2 KiB
Markdown
42 lines
1.2 KiB
Markdown
<!-- Context: development/workflow-example | Priority: high | Version: 1.0 | Updated: 2026-02-15 -->
|
|
|
|
# Example: Document Ingestion Workflow
|
|
|
|
**Purpose**: Demonstrates a multi-step workflow with parallel processing.
|
|
|
|
**Last Updated**: 2026-01-09
|
|
|
|
---
|
|
|
|
## Workflow Definition
|
|
```typescript
|
|
export const documentIngestionWorkflow = createWorkflow({
|
|
id: 'document-ingestion',
|
|
inputSchema: z.object({ filename: z.string(), fileBuffer: z.any() }),
|
|
outputSchema: z.object({ documentId: z.string(), success: z.boolean() }),
|
|
})
|
|
.then(uploadStep) // Step 1: Upload
|
|
.then(extractionStep) // Step 2: Extract Text
|
|
.parallel([ // Step 3: Process in parallel
|
|
classificationStep,
|
|
summarizationStep
|
|
])
|
|
.then(mergeResultsStep) // Step 4: Merge
|
|
.commit();
|
|
```
|
|
|
|
## Step Execution
|
|
```typescript
|
|
const uploadStep = createStep({
|
|
id: 'upload-document',
|
|
execute: async ({ inputData, mastra }) => {
|
|
const result = await documentUploadTool.execute(inputData, { mastra });
|
|
return result;
|
|
},
|
|
});
|
|
```
|
|
|
|
**Reference**: `src/mastra/workflows/document-ingestion-with-classification-workflow.ts`
|
|
**Related**:
|
|
- concepts/workflows.md
|
|
- concepts/agents-tools.md
|