Research Pipeline

A 3-step pipeline: a researcher gathers information, a writer drafts an article, and an editor polishes it. This is the most common starter pattern for content generation workflows.


Quick start (local)

# Save the YAML below as research-pipeline.yaml, then:
ark run research-pipeline.yaml --provider mock --watch \
  --input topic="distributed consensus algorithms"

# With Ollama:
OPENAI_BASE_URL=http://localhost:11434/v1 OPENAI_API_KEY=ollama \
  ark run research-pipeline.yaml --provider openai --watch \
  --input topic="distributed consensus algorithms"

YAML

apiVersion: arkonis.dev/v1alpha1
kind: ArkTeam
metadata:
  name: research-pipeline
  namespace: my-org
spec:
  output: "{{ .steps.editor.output }}"
  maxTokens: 60000
  roles:
    - name: researcher
      model: llama3.2
      systemPrompt: |
        You are a research specialist. Given a topic, provide a comprehensive
        summary including:
        - Key concepts and definitions
        - Recent developments (last 2 years)
        - Notable perspectives or debates
        - Practical applications

        Be thorough and specific. Bullet points are encouraged.
      limits:
        maxTokensPerCall: 8000
        timeoutSeconds: 120

    - name: writer
      model: llama3.2
      systemPrompt: |
        You are a technical writer. Transform research notes into a clear,
        well-structured article with:
        - An engaging introduction
        - Logical body sections with headers
        - Concrete examples where relevant
        - A conclusion summarizing key takeaways

        Target audience: technical professionals. Length: 600-800 words.
      limits:
        maxTokensPerCall: 8000
        timeoutSeconds: 120

    - name: editor
      model: llama3.2
      systemPrompt: |
        You are a senior editor. Review the draft article for:
        - Clarity and conciseness (cut anything redundant)
        - Logical flow between sections
        - Accuracy (flag any claims that seem suspect)
        - Consistent tone and voice

        Return the polished final article, ready to publish.
      limits:
        maxTokensPerCall: 8000
        timeoutSeconds: 120

  pipeline:
    - role: researcher
      inputs:
        prompt: "Research this topic in depth: {{ .input.topic }}"

    - role: writer
      dependsOn: [researcher]
      inputs:
        research: "{{ .steps.researcher.output }}"
        prompt: |
          Write a technical article based on the following research.
          Do not just summarize — craft a readable narrative.

    - role: editor
      dependsOn: [writer]
      inputs:
        draft: "{{ .steps.writer.output }}"
        prompt: "Edit and polish this article. Return only the final text."

Deploy to cluster

kubectl create namespace my-org --dry-run=client -o yaml | kubectl apply -f -
kubectl apply -f research-pipeline.yaml

# Verify agents are ready
kubectl get arkagents -n my-org

# Trigger a run
ark trigger research-pipeline -n my-org \
  --input '{"topic": "distributed consensus algorithms"}' \
  --watch --timeout 180s

Add a webhook trigger

To call this pipeline from an external application:

---
apiVersion: arkonis.dev/v1alpha1
kind: ArkEvent
metadata:
  name: research-trigger
  namespace: my-org
spec:
  source:
    type: webhook
  targets:
    - team: research-pipeline
kubectl apply -f research-pipeline.yaml

TOKEN=$(kubectl get secret research-trigger-webhook-token -n my-org \
  -o jsonpath='{.data.token}' | base64 -d)

curl -X POST \
  "http://ark-operator.my-org.svc.cluster.local:8092/triggers/my-org/research-trigger/fire?mode=sync&timeout=180s" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"topic": "Kubernetes operator patterns"}'

Expected output structure

  researcher       [running]
  researcher       [done]    3,842 tokens  12.1s
    └─ Key concepts: Consensus algorithms enable distributed systems...
  writer           [running]
  writer           [done]    2,104 tokens  8.4s
    └─ Distributed Consensus: Building Agreement at Scale...
  editor           [running]
  editor           [done]    1,986 tokens  7.2s
    └─ Distributed Consensus: Building Agreement at Scale...

Flow Succeeded in 27.7s — total: 7,932 tokens

See also


Apache 2.0 · ARKONIS