@rong/agentscript 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +16 -10
- package/dist/parser/parser.js +14 -6
- package/dist/parser/tokenizer.js +2 -1
- package/dist/runtime/evaluator.js +8 -0
- package/docs/cn/context-engineering.md +1 -1
- package/docs/cn/final-expression-return.md +4 -4
- package/docs/cn/generate.md +35 -39
- package/docs/cn/language.md +67 -41
- package/docs/cn/use-as.md +10 -10
- package/docs/en/context-engineering.md +1 -1
- package/docs/en/final-expression-return.md +2 -2
- package/docs/en/generate.md +33 -37
- package/docs/en/language.md +67 -41
- package/docs/en/use-as.md +10 -10
- package/examples/changelog.as +1 -1
- package/examples/extract.as +1 -1
- package/examples/review.as +2 -2
- package/examples/summarize.as +1 -1
- package/examples/translate.as +1 -1
- package/package.json +1 -1
- package/tutorials/memory.as +4 -4
- package/tutorials/plan-execute.as +4 -4
- package/tutorials/react.as +5 -5
- package/tutorials/self-improve.as +8 -8
|
@@ -31,7 +31,7 @@ main agent PlanAndExecute {
|
|
|
31
31
|
}
|
|
32
32
|
]
|
|
33
33
|
|
|
34
|
-
for step in steps
|
|
34
|
+
for step in steps max 6 {
|
|
35
35
|
outcome = run_step(input.goal, step, results)
|
|
36
36
|
results.add(outcome.result)
|
|
37
37
|
|
|
@@ -73,7 +73,7 @@ main agent PlanAndExecute {
|
|
|
73
73
|
|
|
74
74
|
func finish(goal, results) {
|
|
75
75
|
use goal
|
|
76
|
-
use results.summary
|
|
76
|
+
use results.summary max 2k
|
|
77
77
|
|
|
78
78
|
generate({ input: "Create the final answer from executed steps", max_output: 800 }) -> {
|
|
79
79
|
ok boolean
|
|
@@ -91,7 +91,7 @@ agent Planner {
|
|
|
91
91
|
main func(input) {
|
|
92
92
|
use input.goal
|
|
93
93
|
use input.problem
|
|
94
|
-
use input.previous
|
|
94
|
+
use input.previous max 1k
|
|
95
95
|
|
|
96
96
|
generate({ input: "Create a three step plan", max_output: 600 }) -> {
|
|
97
97
|
step1 string
|
|
@@ -109,7 +109,7 @@ agent Executor {
|
|
|
109
109
|
main func(input) {
|
|
110
110
|
use input.goal
|
|
111
111
|
use input.step
|
|
112
|
-
use input.previous
|
|
112
|
+
use input.previous max 1k
|
|
113
113
|
|
|
114
114
|
query = Search.query(input.goal, input.step, input.previous)
|
|
115
115
|
raw = Search.search(query)
|
package/tutorials/react.as
CHANGED
|
@@ -12,11 +12,11 @@ main agent ResearchAgent {
|
|
|
12
12
|
use input.question
|
|
13
13
|
|
|
14
14
|
scratch = []
|
|
15
|
-
use scratch.summary
|
|
15
|
+
use scratch.summary max 2k
|
|
16
16
|
|
|
17
17
|
done = false
|
|
18
18
|
|
|
19
|
-
loop until done
|
|
19
|
+
loop until done max 4 {
|
|
20
20
|
thought = reason(input.question, scratch)
|
|
21
21
|
action = act(input.question, thought)
|
|
22
22
|
observation = observe(action)
|
|
@@ -30,7 +30,7 @@ main agent ResearchAgent {
|
|
|
30
30
|
|
|
31
31
|
func reason(question, scratch) {
|
|
32
32
|
use question
|
|
33
|
-
use scratch.summary
|
|
33
|
+
use scratch.summary max 1k
|
|
34
34
|
|
|
35
35
|
generate({ input: "Choose the next search focus", max_output: 300 }) -> {
|
|
36
36
|
focus string
|
|
@@ -68,7 +68,7 @@ main agent ResearchAgent {
|
|
|
68
68
|
|
|
69
69
|
func enough(question, scratch) {
|
|
70
70
|
use question
|
|
71
|
-
use scratch.summary
|
|
71
|
+
use scratch.summary max 1k
|
|
72
72
|
|
|
73
73
|
verdict = generate({ input: "Decide whether the observations are enough", max_output: 200 }) -> {
|
|
74
74
|
done boolean
|
|
@@ -79,7 +79,7 @@ main agent ResearchAgent {
|
|
|
79
79
|
|
|
80
80
|
func answer(question, scratch) {
|
|
81
81
|
use question
|
|
82
|
-
use scratch.summary
|
|
82
|
+
use scratch.summary max 2k
|
|
83
83
|
|
|
84
84
|
generate({ input: "Answer using only the observations", max_output: 800 }) -> {
|
|
85
85
|
ok boolean
|
|
@@ -10,13 +10,13 @@ main agent SelfImprover {
|
|
|
10
10
|
goal string
|
|
11
11
|
}) {
|
|
12
12
|
past = Lessons.query({
|
|
13
|
-
kind: "lesson"
|
|
14
|
-
text: input.goal
|
|
13
|
+
kind: "lesson",
|
|
14
|
+
text: input.goal,
|
|
15
15
|
limit: 5
|
|
16
16
|
})
|
|
17
17
|
|
|
18
18
|
use input.goal
|
|
19
|
-
use past
|
|
19
|
+
use past max 2k
|
|
20
20
|
|
|
21
21
|
result = generate({
|
|
22
22
|
input: "Answer the goal using any relevant lessons.",
|
|
@@ -28,15 +28,15 @@ main agent SelfImprover {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
lesson = reflect({
|
|
31
|
-
goal: input.goal
|
|
32
|
-
result: result
|
|
31
|
+
goal: input.goal,
|
|
32
|
+
result: result,
|
|
33
33
|
past: past
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
Lessons.add({
|
|
37
|
-
kind: "lesson"
|
|
38
|
-
text: lesson.insight
|
|
39
|
-
goal: input.goal
|
|
37
|
+
kind: "lesson",
|
|
38
|
+
text: lesson.insight,
|
|
39
|
+
goal: input.goal,
|
|
40
40
|
ok: result.ok
|
|
41
41
|
})
|
|
42
42
|
|