Skip to content

Commit eb9182d

Browse files
committed
docs: update sop
1 parent 3f0d92f commit eb9182d

File tree

6 files changed

+84
-38
lines changed

6 files changed

+84
-38
lines changed

docs/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"pages": [
5151
"learn/skill-space",
5252
"learn/search-skills",
53-
"learn/tool"
53+
"learn/tool",
54+
"learn/design-complex"
5455
]
5556
},
5657
{

docs/learn/design-complex.mdx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: "Design a Complex Task Judgment"
3+
description: "Acontext allows you to add rules to judge what is a complex task."
4+
---
5+
6+
Acontext won't just learn every success/failed tasks into the skill space. It only learns the complex tasks.
7+
8+
## What is a Complex Task?
9+
10+
By default, the task complexity is judged based on these conditions:
11+
- **(c.1)** Wrong tool parameter passing that could be avoided: **normal**
12+
- **(c.2)** Back-and-forth retries due to wrong strategy (not errors): **normal**
13+
- **(c.3)** User provides feedback/preferences to correct agent's wrong decision: **critical**
14+
- **(c.4)** User explicitly emphasized saving this workflow or experience: **critical**
15+
16+
<Info>
17+
If one `critical` rule is satisfied, the task will be considered as a complex task.
18+
</Info>
19+
<Info>
20+
If at least two `normal` rules are satisfied, the task will be considered as a complex task.
21+
</Info>
22+
23+
## Design your own Complexity Scoring Rules
24+
You can append more rules to enrich the complexity judgment, by passing `config.yaml`:
25+
```yaml config.yaml
26+
sop_agent_custom_scoring_rules:
27+
- description: "User wants another theme of landing page"
28+
level: "normal"
29+
- description: "When the word 'save this as sop' appears in the user's message, it's a complex task"
30+
level: "critical"
31+
```

docs/learn/tool.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "Tools in Space"
2+
title: "Edit Agent Tools"
33
description: "Manage and organize tools that agents have learned and used across your projects"
44
---
55

docs/local.mdx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,30 @@ Once it's done, you can the following endpoints enabled:
1616
- Acontext Base URL: http://localhost:8029/api/v1
1717
- Acontext Dashboard: http://localhost:3000/
1818

19-
## Try some Examples
20-
### Interactive mode
21-
```bash
22-
acontenxt create
23-
```
19+
## Launch with Envs
20+
Place your `.env` file and run `acontext docker up` at the same directory:
21+
```bash
22+
cat .env
23+
acontext docker up
24+
```
25+
26+
27+
## Next Steps
28+
29+
<CardGroup cols={2}>
30+
31+
<Card title="Dashboard" icon="robot" href="/observe/dashboard">
32+
View your agent's tasks, conversations, and learned skills in one place
33+
</Card>
34+
<Card title="Store Messages" icon="message" href="/store/messages/multi-provider">
35+
Save agent conversations with context
36+
</Card>
37+
38+
<Card title="Enable Learning" icon="sparkles" href="/learn/skill-space">
39+
Let your agent learn from experience
40+
</Card>
41+
42+
<Card title="Configuration" icon="gear" href="/settings/runtime">
43+
Configure Acontext to your needs
44+
</Card>
45+
</CardGroup>

docs/observe/dashboard.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The skill viewer helps you understand which capabilities your agent have self-le
8080
Learn how to obtain agent tasks in detail, from SDK.
8181
</Card>
8282

83-
<Card title="Settings" icon="gear" href="/settings/core">
84-
Customize your Acontext Server.
83+
<Card title="Self-learning" icon="sparkles" href="/learn/skill-space">
84+
Learn how to enable your agent to self-learn skills and SOPs.
8585
</Card>
8686
</CardGroup>

src/server/core/tests/llm/test_sop_customization.py

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
Tests custom scoring rules functionality.
55
"""
6-
import pytest
6+
77
from acontext_core.llm.prompt.sop_customization import SOPPromptCustomization
88
from acontext_core.llm.prompt.task_sop import TaskSOPPrompt
99
from acontext_core.schema.config import CustomScoringRule, ProjectConfig
@@ -21,16 +21,14 @@ def test_build_custom_scoring_section_empty(self):
2121
def test_build_custom_scoring_section_normal(self):
2222
"""Test building custom scoring section with normal level rules"""
2323
rule1 = CustomScoringRule(
24-
description="If the task involves database operations",
25-
level="normal"
24+
description="If the task involves database operations", level="normal"
2625
)
2726
rule2 = CustomScoringRule(
28-
description="If the task requires file I/O",
29-
level="normal"
27+
description="If the task requires file I/O", level="normal"
3028
)
3129
customization = SOPPromptCustomization(custom_scoring_rules=[rule1, rule2])
3230
result = customization.build_custom_scoring_section(start_index=5)
33-
31+
3432
assert "(c.5)" in result
3533
assert "(c.6)" in result
3634
assert "If the task involves database operations" in result
@@ -40,12 +38,11 @@ def test_build_custom_scoring_section_normal(self):
4038
def test_build_custom_scoring_section_critical(self):
4139
"""Test building custom scoring section with critical level rules"""
4240
rule = CustomScoringRule(
43-
description="If the task requires external API calls",
44-
level="critical"
41+
description="If the task requires external API calls", level="critical"
4542
)
4643
customization = SOPPromptCustomization(custom_scoring_rules=[rule])
4744
result = customization.build_custom_scoring_section(start_index=5)
48-
45+
4946
assert "(c.5)" in result
5047
assert "If the task requires external API calls" in result
5148
assert "+ 3 points" in result # critical level = 3 points
@@ -56,7 +53,7 @@ def test_build_custom_scoring_section_mixed(self):
5653
rule2 = CustomScoringRule(description="Critical rule", level="critical")
5754
customization = SOPPromptCustomization(custom_scoring_rules=[rule1, rule2])
5855
result = customization.build_custom_scoring_section(start_index=5)
59-
56+
6057
assert "(c.5)" in result
6158
assert "(c.6)" in result
6259
assert "Normal rule" in result
@@ -76,7 +73,7 @@ def test_get_all_rule_indices_with_custom(self):
7673
rule2 = CustomScoringRule(description="Rule 2", level="critical")
7774
customization = SOPPromptCustomization(custom_scoring_rules=[rule1, rule2])
7875
indices = customization.get_all_rule_indices(base_count=4)
79-
76+
8077
assert len(indices) == 6
8178
assert indices == ["(c.1)", "(c.2)", "(c.3)", "(c.4)", "(c.5)", "(c.6)"]
8279

@@ -87,46 +84,44 @@ class TestTaskSOPPromptWithCustomization:
8784
def test_system_prompt_without_customization(self):
8885
"""Test system prompt generation without customization"""
8986
prompt = TaskSOPPrompt.system_prompt()
90-
87+
9188
# Should contain base rules
9289
assert "(c.1)" in prompt
9390
assert "(c.2)" in prompt
9491
assert "(c.3)" in prompt
9592
assert "(c.4)" in prompt
96-
93+
9794
# Should not contain custom rules
9895
assert "(c.5)" not in prompt
99-
96+
10097
# Report section should reference base rules only
10198
assert "Give your judgement on (c.1), (c.2), (c.3), (c.4)" in prompt
10299

103100
def test_system_prompt_with_customization(self):
104101
"""Test system prompt generation with customization"""
105102
rule1 = CustomScoringRule(
106-
description="If the task involves database operations",
107-
level="normal"
103+
description="If the task involves database operations", level="normal"
108104
)
109105
rule2 = CustomScoringRule(
110-
description="If the task requires external API calls",
111-
level="critical"
106+
description="If the task requires external API calls", level="critical"
112107
)
113108
customization = SOPPromptCustomization(custom_scoring_rules=[rule1, rule2])
114109
prompt = TaskSOPPrompt.system_prompt(customization=customization)
115-
110+
116111
# Should contain base rules
117112
assert "(c.1)" in prompt
118113
assert "(c.2)" in prompt
119114
assert "(c.3)" in prompt
120115
assert "(c.4)" in prompt
121-
116+
122117
# Should contain custom rules
123118
assert "(c.5)" in prompt
124119
assert "(c.6)" in prompt
125120
assert "If the task involves database operations" in prompt
126121
assert "If the task requires external API calls" in prompt
127122
assert "+ 1 point" in prompt # normal
128123
assert "+ 3 points" in prompt # critical
129-
124+
130125
# Report section should reference all rules
131126
assert "(c.5)" in prompt
132127
assert "(c.6)" in prompt
@@ -138,13 +133,13 @@ def test_system_prompt_customization_appended_not_replaced(self):
138133
rule = CustomScoringRule(description="Custom rule", level="normal")
139134
customization = SOPPromptCustomization(custom_scoring_rules=[rule])
140135
prompt = TaskSOPPrompt.system_prompt(customization=customization)
141-
136+
142137
# Base rules should still be present
143138
assert "(c.1)" in prompt
144139
assert "(c.2)" in prompt
145140
assert "(c.3)" in prompt
146141
assert "(c.4)" in prompt
147-
142+
148143
# Custom rule should be appended
149144
assert "(c.5)" in prompt
150145
assert "Custom rule" in prompt
@@ -159,10 +154,8 @@ def test_project_config_with_custom_rules(self):
159154
CustomScoringRule(description="Test rule 1", level="normal"),
160155
CustomScoringRule(description="Test rule 2", level="critical"),
161156
]
162-
config = ProjectConfig(
163-
sop_agent_custom_scoring_rules=custom_rules
164-
)
165-
157+
config = ProjectConfig(sop_agent_custom_scoring_rules=custom_rules)
158+
166159
assert len(config.sop_agent_custom_scoring_rules) == 2
167160
assert config.sop_agent_custom_scoring_rules[0].description == "Test rule 1"
168161
assert config.sop_agent_custom_scoring_rules[0].level == "normal"
@@ -172,7 +165,6 @@ def test_project_config_with_custom_rules(self):
172165
def test_project_config_without_custom_rules(self):
173166
"""Test ProjectConfig without custom scoring rules (default)"""
174167
config = ProjectConfig()
175-
168+
176169
assert config.sop_agent_custom_scoring_rules == []
177170
assert isinstance(config.sop_agent_custom_scoring_rules, list)
178-

0 commit comments

Comments
 (0)