Automated sequences of actions that coordinate the flow of data and interactions between different components of the Machina Sports platform. They define how your fan experiences respond to events, process data, and deliver personalized content.
workflow: name: "workflow-name" # Unique identifier for the workflow title: "Workflow Title" # Human-readable title description: "Workflow description" # Brief description of purpose context-variables: # Environment variables and API keys variable-name: key: "value" inputs: # Input parameters input-name: "$.get('parameter')" # JSONPath expressions for inputs outputs: # Output parameters output-name: "$.get('result')" # JSONPath expressions for outputs tasks: # Sequential tasks to execute - type: "task-type" # Type of task (connector, document, prompt, mapping) name: "task-name" # Unique name for the task description: "Task description" # Brief description # Task-specific configuration
- type: "connector" name: "fetch-team-data" connector: name: "sportradar-nba" command: "get-teams/{team_id}/{data_type}" command_attribute: team_id: "$.get('team_id')" data_type: "'profile.json'" inputs: api_key: "$.get('api_key')" outputs: team-profile: "$"
- type: "document" name: "load-similar-documents" config: action: "search" threshold-docs: 10 search-vector: true connector: name: "machina-ai" command: "invoke_embedding" model: "text-embedding-3-small" inputs: name: "'content-snippet'" search-query: "$.get('messages')" outputs: documents: "$.get('documents')"
- type: "prompt" name: "chat-completions-prompt" connector: name: "machina-ai" command: "invoke_prompt" model: "gpt-4o" inputs: documents: "$.get('documents')" messages: "$.get('messages')" outputs: message: "$.get('choices')[0].get('message').get('content')"
- type: "mapping" name: "sportradar-nba-team-mapping" inputs: team_profile: "$.get('team-profile')" outputs: team_id: "$.get('team_id')" team_name: "$.get('team_name')" # Additional mapped fields
- type: "document" name: "update-thread-document" condition: "$.get('document_id') is not None" # Task configuration
workflow: name: "chat-completions" title: "Chat Completions" description: "Workflow to execute a chat completion." context-variables: machina-ai: api_key: "$TEMP_CONTEXT_VARIABLE_SDK_OPENAI_API_KEY" inputs: messages: "$.get('messages', [])" outputs: message: "$.get('message')" workflow-status: "$.get('message') is not None and 'executed' or 'skipped'" tasks: # Load similar documents for context - type: "document" name: "load-similar-documents" config: action: "search" threshold-docs: 10 search-vector: true connector: name: "machina-ai" command: "invoke_embedding" model: "text-embedding-3-small" inputs: name: "'content-snippet'" search-query: "$.get('messages')" outputs: documents: "$.get('documents')" # Generate response using AI - type: "prompt" name: "chat-completions-prompt" connector: name: "machina-ai" command: "invoke_prompt" model: "gpt-4o" inputs: documents: "$.get('documents')" messages: "$.get('messages')" outputs: message: "$.get('choices')[0].get('message').get('content')"