-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy path36-inputs.vvm
More file actions
59 lines (47 loc) · 1.66 KB
/
36-inputs.vvm
File metadata and controls
59 lines (47 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# VVM Example 36: Module Inputs + Export Contract
# Demonstrates input declarations for parameterized modules and
# export-derived workflow outputs.
#
# This module can be:
# 1. Run directly with CLI: vvm run 36-inputs.vvm --input topic="AI"
# 2. Called from another module (see Sprint 2)
#
# Demonstrates:
# - Required inputs with description
# - Optional inputs with defaults
# - Inputs become bound variables
#
# Pattern: Declare what you need, let the caller provide it.
# === Inputs ===
# Inputs must appear before any executable statements.
# They become bound variables available throughout the program.
input topic: "The topic to research"
input depth: "Research depth (shallow, medium, deep)" = "medium"
# === Agent Definitions ===
# Agents are local to this module — they cannot be exported.
agent researcher(
model="sonnet",
prompt="""You research topics thoroughly.
Adjust depth based on instructions:
- shallow: Quick overview, key points only
- medium: Balanced coverage with supporting details
- deep: Comprehensive analysis with sources"""
)
agent summarizer(
model="haiku",
prompt="Create a one-sentence summary capturing the essence."
)
# === Workflow Logic ===
# Use the input variables in agent calls.
report = @researcher `Research {topic} at {depth} depth.
Produce a structured report with:
1. Key findings
2. Supporting evidence
3. Open questions`(pack(topic, depth))
summary = @summarizer `Summarize this research in one sentence.`(report)
# === Exports ===
# In VVM, exports are the workflow output contract surface.
# When this module is called, the result object contains exactly:
# { report: <ref>, summary: <ref> }
export report
export summary