Repository navigation
Expand file tree
/
Copy pathreact.as
More file actions
53 lines (44 loc) · 1.55 KB
/
Copy pathreact.as
File metadata and controls
53 lines (44 loc) · 1.55 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
import llm Qwen from "ollama://localhost:11434/qwen3.6"
import tool Env from "env://process"
main agent BasicReAct {
model Qwen
role "Diagnostic assistant"
description "Answer one question with a minimal Reason-Act-Observe flow."
main func(input {
question: string
}) {
env_name = "USER"
thought = reason(input.question, env_name)
action = Env.get({
name: env_name
})
observation = observe(input.question, env_name, action)
answer(input.question, thought, observation)
}
func reason(question, env_name) {
use question as "question"
use env_name as "planned tool input"
generate({ input: "Explain why this environment variable may help answer the question", max_output: 300 }) -> {
why
}
}
func observe(question, env_name, action) {
use question as "question"
use env_name as "environment variable"
use action.value as "environment value"
generate({ input: "Turn the tool result into a useful observation", max_output: 400 }) -> {
facts: list[string]
value_found: boolean
}
}
func answer(question, thought, observation) {
use question as "question"
use thought.why as "reasoning note"
use observation.facts max 1k as "observed facts"
use observation.value_found as "value found"
generate({ input: "Answer using only the observation", max_output: 500 }) -> {
answer
confidence
}
}
}