[workchat] prepare the workflow framework (#218138)

## Summary

Setup the foundations of the workflow framework, adding types and
initial implementation.


## Examples

### Looping over some input to call the LLM

**workflow**
```typescript
{
      id: 'my_test_workflow',
      name: 'Just a test workflow',
      type: 'graph',
      inputs: [
        {
          name: 'input',
          type: 'array',
          required: true,
        },
      ],
      steps: [
        {
          id: 'mainLoop',
          type: NodeType.loop,
          configuration: {
            inputList: 'input',
            itemVar: 'prompt',
            output: {
              source: 'output',
              destination: 'results',
            },
            steps: [
              {
                id: 'step1',
                type: NodeType.prompt,
                configuration: {
                  prompt:
                    'How much is {prompt}? Please just output the result without anything else',
                  output: 'output',
                },
              },
            ],
          },
        },
      ],
      outputs: [
        {
          name: 'results',
          ref: 'results',
        },
      ],
    }
``` 

**Running**
```ts
workchatFramework.workflows.run({
    id: 'my_test_workflow',
    inputs: { input: ['3 + 3', '7 - 1', '4 * 6'] },
    request,
})
```

**Output**

```ts
 {
  runId: '6f254746-57fc-4fd3-8bfa-25014725f53f',
  output: { results: [ '6', '6', '24' ] }
}
```

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Pierre Gayvallet 2025-04-22 22:04:26 +02:00 committed by GitHub
parent afc004a520
commit 29a81d8972
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
169 changed files with 6023 additions and 5 deletions

View file

@ -819,6 +819,13 @@
"state",
"type"
],
"onechat_workflow": [
"access_control",
"access_control.public",
"categories",
"user_id",
"workflow_id"
],
"osquery-manager-usage-metric": [
"count",
"errors"

View file

@ -2749,6 +2749,27 @@
}
}
},
"onechat_workflow": {
"dynamic": false,
"properties": {
"access_control": {
"properties": {
"public": {
"type": "boolean"
}
}
},
"categories": {
"type": "keyword"
},
"user_id": {
"type": "keyword"
},
"workflow_id": {
"type": "keyword"
}
}
},
"osquery-manager-usage-metric": {
"properties": {
"count": {

View file

@ -195,3 +195,4 @@ pageLoadAssetSize:
wciIndexSource: 40000
wciSalesforce: 25000
workchatApp: 25000
workchatFramework: 25000