acps-scenario-buddy 1.0.0__tar.gz
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.
- acps_scenario_buddy-1.0.0/LICENSE +21 -0
- acps_scenario_buddy-1.0.0/PKG-INFO +235 -0
- acps_scenario_buddy-1.0.0/README.md +198 -0
- acps_scenario_buddy-1.0.0/pyproject.toml +75 -0
- acps_scenario_buddy-1.0.0/setup.cfg +4 -0
- acps_scenario_buddy-1.0.0/src/acps_scenario_buddy.egg-info/PKG-INFO +235 -0
- acps_scenario_buddy-1.0.0/src/acps_scenario_buddy.egg-info/SOURCES.txt +31 -0
- acps_scenario_buddy-1.0.0/src/acps_scenario_buddy.egg-info/dependency_links.txt +1 -0
- acps_scenario_buddy-1.0.0/src/acps_scenario_buddy.egg-info/entry_points.txt +2 -0
- acps_scenario_buddy-1.0.0/src/acps_scenario_buddy.egg-info/requires.txt +11 -0
- acps_scenario_buddy-1.0.0/src/acps_scenario_buddy.egg-info/top_level.txt +1 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/__init__.py +29 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/__main__.py +8 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/agents/__init__.py +8 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/agents/base.py +211 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/agents/culture.py +76 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/agents/guide.py +70 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/agents/npc.py +132 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/cli.py +66 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/culture_bank.py +226 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/demo.py +145 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/guide_bank.py +202 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/identity.py +88 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/leader.py +530 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/mesh.py +55 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/models.py +306 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/protocol.py +120 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/py.typed +0 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/registry.py +147 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/report.py +115 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/runtime.py +220 -0
- acps_scenario_buddy-1.0.0/src/scenario_buddy/scenarios.py +199 -0
- acps_scenario_buddy-1.0.0/tests/test_scenario_buddy.py +58 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ACPs Scenario Buddy Engineering
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: acps-scenario-buddy
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: An ACPs multi-agent companion for real-world English. A scenario NPC (waiter, hotel receptionist, doctor, passer-by) role-plays immersive dialogue; a Guide Agent supplies idiomatic rescue phrases the moment the learner gets stuck; a Culture Agent debriefs etiquette, tipping and small talk. Built on acps-sdk 2.1.0 with independent AIP v2 JSON-RPC services, ADP discovery, typed products and auditable task traces for travel, relocation and healthcare.
|
|
5
|
+
Author: ACPs Scenario Buddy Engineering
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://pypi.org/project/acps-scenario-buddy/
|
|
8
|
+
Project-URL: Source, https://github.com/acps-labs/acps-scenario-buddy
|
|
9
|
+
Keywords: acps,acps-sdk,multi-agent,english-conversation,scenario-roleplay,travel-english,culture-etiquette
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Education
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Education
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: acps-sdk==2.1.0
|
|
27
|
+
Requires-Dist: fastapi>=0.100.0
|
|
28
|
+
Requires-Dist: httpx>=0.25.0
|
|
29
|
+
Requires-Dist: pydantic>=2.0.0
|
|
30
|
+
Requires-Dist: uvicorn>=0.27.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.6.0; extra == "dev"
|
|
35
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# ACPs Scenario Buddy
|
|
39
|
+
|
|
40
|
+
**Scenario Buddy is a protocol-native multi-agent companion for real-world English.** An NPC Agent role-plays the waiter, hotel receptionist, doctor or passer-by; a Guide Agent steps in with immediately speakable rescue phrases when the learner stalls; a Culture Agent debriefs etiquette, tipping and small-talk norms after the scene.
|
|
41
|
+
|
|
42
|
+
The name joins **Scenario** (a concrete real-life setting such as ordering food, checking into a hotel, seeing a doctor or asking for directions) with **Buddy** (a companion that stays with the learner through the whole encounter rather than acting as a one-off quiz). Version **1.0.0** is a typed Python package and distributable wheel built on **`acps-sdk==2.1.0`**, not a notebook or a mocked chat script.
|
|
43
|
+
|
|
44
|
+
## Why it is useful
|
|
45
|
+
|
|
46
|
+
- **NPC Agent** opens the scene in character, tracks turn order, keeps the dialogue coherent, and flags hesitation it observes.
|
|
47
|
+
- **Guide Agent** receives the stalled utterance plus the NPC's last line and returns three contextual phrases with Chinese support and one delivery strategy.
|
|
48
|
+
- **Culture Agent** consumes the finished transcript and produces a structured briefing: etiquette, taboos, safe small talk, tipping and reusable patterns.
|
|
49
|
+
- **Scenario Leader** discovers skills through ADP, checks real HTTP heartbeats, orchestrates AIP v2 JSON-RPC tasks, routes rescues mid-turn, transfers typed memory and audits every stage transition.
|
|
50
|
+
|
|
51
|
+
The engine is deterministic and offline after installation: it needs no LLM key and makes no claim to be a calibrated speaking test. Every turn is reproducible, which makes the package suitable for classrooms, self-study routines and integration tests.
|
|
52
|
+
|
|
53
|
+
## Metadata description (under 500 characters)
|
|
54
|
+
|
|
55
|
+
> An ACPs multi-agent companion for real-world English. A scenario NPC (waiter, hotel receptionist, doctor, passer-by) role-plays immersive dialogue; a Guide Agent supplies idiomatic rescue phrases the moment the learner gets stuck; a Culture Agent debriefs etiquette, tipping and small talk. Built on acps-sdk 2.1.0 with independent AIP v2 JSON-RPC services, ADP discovery, typed products and auditable task traces for travel, relocation and healthcare.
|
|
56
|
+
|
|
57
|
+
## Collaboration architecture
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
Learner turns
|
|
61
|
+
│
|
|
62
|
+
▼
|
|
63
|
+
Scenario Leader ── ADP DiscoveryRequest + HTTP /healthz ──► Agent Registry
|
|
64
|
+
│
|
|
65
|
+
├── AIP v2 JSON-RPC ──► NPC Agent
|
|
66
|
+
│ opening → role-play turns → closing
|
|
67
|
+
│
|
|
68
|
+
├── AIP v2 JSON-RPC (only when stuck) ──► Guide Agent
|
|
69
|
+
│ trigger + stalled utterance + NPC line → 3 rescue phrases
|
|
70
|
+
│
|
|
71
|
+
├── AIP v2 JSON-RPC + full transcript ──► Culture Agent
|
|
72
|
+
│ etiquette + taboos + small talk + tipping
|
|
73
|
+
│
|
|
74
|
+
└── non-empty END_SESSION broadcast + ControlAck from all agents
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Every partner runs as an independent FastAPI/uvicorn service on an ephemeral loopback port. Commands and products use `acps-sdk==2.1.0` AIP models. Application envelopes carry validated `session_id`, `task_id`, `stage` and a non-empty typed payload; the stage machine rejects skipped or reversed phases.
|
|
78
|
+
|
|
79
|
+
## Project structure
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
acps-scenario-buddy/
|
|
83
|
+
├── pyproject.toml # setuptools metadata, dependencies, CLI, tool config
|
|
84
|
+
├── README.md
|
|
85
|
+
├── LICENSE
|
|
86
|
+
├── .gitignore
|
|
87
|
+
├── examples/
|
|
88
|
+
│ └── restaurant_demo.py # one-command public-API example
|
|
89
|
+
├── src/scenario_buddy/
|
|
90
|
+
│ ├── __init__.py # versioned public API
|
|
91
|
+
│ ├── __main__.py # python -m scenario_buddy
|
|
92
|
+
│ ├── py.typed # PEP 561 typing marker
|
|
93
|
+
│ ├── cli.py # scripted and interactive CLI
|
|
94
|
+
│ ├── demo.py # realistic four-turn fixtures per scenario
|
|
95
|
+
│ ├── leader.py # ADP discovery, AIP dispatch, rescue routing, fan-in
|
|
96
|
+
│ ├── mesh.py # lifecycle of three local partner services
|
|
97
|
+
│ ├── registry.py # ACS publication and ADP discovery
|
|
98
|
+
│ ├── runtime.py # AIP v2 JSON-RPC hosting and structured products
|
|
99
|
+
│ ├── protocol.py # message codec and four-stage state machine
|
|
100
|
+
│ ├── models.py # typed domain, wire and collaboration contracts
|
|
101
|
+
│ ├── identity.py # AIC identity helpers and project version
|
|
102
|
+
│ ├── scenarios.py # NPC openings, turn replies and visible goals
|
|
103
|
+
│ ├── guide_bank.py # stuck detection and contextual rescue phrases
|
|
104
|
+
│ ├── culture_bank.py # curated cultural debriefs
|
|
105
|
+
│ ├── report.py # human-readable Markdown renderer
|
|
106
|
+
│ └── agents/
|
|
107
|
+
│ ├── base.py # shared AIP task lifecycle and control handling
|
|
108
|
+
│ ├── npc.py # in-character role-play partner
|
|
109
|
+
│ ├── guide.py # just-in-time phrase rescue partner
|
|
110
|
+
│ └── culture.py # post-scene cultural debrief partner
|
|
111
|
+
└── tests/
|
|
112
|
+
└── test_scenario_buddy.py # protocol, stuck detection and full-mesh integration
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Install and run
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# from the repository root
|
|
119
|
+
python -m venv .venv
|
|
120
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
121
|
+
python -m pip install -e ".[dev]"
|
|
122
|
+
|
|
123
|
+
# one-command scripted restaurant demo
|
|
124
|
+
python -m scenario_buddy demo --scenario restaurant
|
|
125
|
+
|
|
126
|
+
# interactive practice (type your own English turns)
|
|
127
|
+
python -m scenario_buddy chat --scenario hotel
|
|
128
|
+
|
|
129
|
+
# or use the installed console script
|
|
130
|
+
scenario-buddy demo --scenario clinic --destination "Toronto, Canada"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The scripted demo needs no keyboard input. The `chat` command prompts for four turns and uses the same multi-agent pipeline.
|
|
134
|
+
|
|
135
|
+
### Expected demo excerpt
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
[NPC Agent · opening]
|
|
139
|
+
Good evening, welcome to The Thames Bistro. Do you have a reservation?
|
|
140
|
+
|
|
141
|
+
[Learner · turn 2/4]
|
|
142
|
+
I want the... uh... the chicken thing. How do you say?
|
|
143
|
+
|
|
144
|
+
[Guide Agent · rescue for turn 2]
|
|
145
|
+
Trigger: explicit help request: 'how do you say'
|
|
146
|
+
1. Could I have the grilled chicken, please?
|
|
147
|
+
请给我一份烤鸡,谢谢。 · Could I have… 是点餐最礼貌、最通用的句式。
|
|
148
|
+
2. What would you recommend?
|
|
149
|
+
您推荐什么? · 不确定菜名时,把选择权交给服务员。
|
|
150
|
+
3. Sorry, what do you call this dish in English?
|
|
151
|
+
不好意思,这道菜英文怎么说? · 直接问菜名,比沉默或只指菜单更自然。
|
|
152
|
+
Tip: 用 'Could I have…' 代替 'I want…' 更礼貌;先报菜名,再回答熟度(medium / well done)。
|
|
153
|
+
|
|
154
|
+
[NPC Agent · turn 2]
|
|
155
|
+
The grilled chicken is an excellent choice. How would you like it cooked — medium or well done?
|
|
156
|
+
|
|
157
|
+
[Culture Agent] Debrief ready: 英式餐厅点餐:礼貌句式、出餐节奏与小费
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The final report also contains the AIP task audit table, all four dialogue turns, the rescue log and the full cultural briefing.
|
|
161
|
+
|
|
162
|
+
## Programmatic API
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
import asyncio
|
|
166
|
+
|
|
167
|
+
from scenario_buddy import LearnerProfile, LocalAgentMesh, Scenario, ScenarioSession
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
async def main() -> None:
|
|
171
|
+
learner = LearnerProfile(
|
|
172
|
+
name="Alex Chen",
|
|
173
|
+
scenario=Scenario.RESTAURANT,
|
|
174
|
+
destination="London, UK",
|
|
175
|
+
)
|
|
176
|
+
turns = [
|
|
177
|
+
"Do you have a table for two, please?",
|
|
178
|
+
"I want the... uh... the chicken thing.",
|
|
179
|
+
"Medium, please. And a sparkling water.",
|
|
180
|
+
"Could we have the bill, please?",
|
|
181
|
+
]
|
|
182
|
+
with LocalAgentMesh() as mesh:
|
|
183
|
+
async with ScenarioSession(mesh.registry, learner) as session:
|
|
184
|
+
result = await session.run(turns)
|
|
185
|
+
print(result.culture.headline)
|
|
186
|
+
print(result.rescues[0].phrases[0].english)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
asyncio.run(main())
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Build the wheel and upload to PyPI
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
python -m pip install --upgrade build twine
|
|
196
|
+
python -m build
|
|
197
|
+
python -m twine check dist/*
|
|
198
|
+
|
|
199
|
+
# TestPyPI first
|
|
200
|
+
python -m twine upload --repository testpypi dist/*
|
|
201
|
+
|
|
202
|
+
# Production PyPI
|
|
203
|
+
export TWINE_USERNAME=__token__
|
|
204
|
+
export TWINE_PASSWORD=pypi-<your-api-token>
|
|
205
|
+
python -m twine upload dist/*
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Windows PowerShell equivalents:
|
|
209
|
+
|
|
210
|
+
```powershell
|
|
211
|
+
$env:TWINE_USERNAME = "__token__"
|
|
212
|
+
$env:TWINE_PASSWORD = "pypi-<your-api-token>"
|
|
213
|
+
python -m twine upload dist/*
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The build produces `dist/acps_scenario_buddy-1.0.0-py3-none-any.whl` and the source distribution.
|
|
217
|
+
|
|
218
|
+
## Verify the package
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
python -m pytest
|
|
222
|
+
python -m ruff check .
|
|
223
|
+
python -m twine check dist/*
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Design boundaries
|
|
227
|
+
|
|
228
|
+
- The scene scripts are curated and deterministic; they are designed for repeatable practice, not for open-ended generation.
|
|
229
|
+
- The Guide Agent triggers on observable signals (Chinese characters, explicit help phrases, hesitation markers, unfinished utterances) rather than on a hidden model.
|
|
230
|
+
- The Culture Agent provides general guidance for UK-oriented settings; regional norms vary and should be checked for a specific destination.
|
|
231
|
+
- AIP task state is held in the SDK's in-process `TaskManager`; this local mesh is intended for single-process practice and CI, not multi-tenant deployment.
|
|
232
|
+
|
|
233
|
+
## License
|
|
234
|
+
|
|
235
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# ACPs Scenario Buddy
|
|
2
|
+
|
|
3
|
+
**Scenario Buddy is a protocol-native multi-agent companion for real-world English.** An NPC Agent role-plays the waiter, hotel receptionist, doctor or passer-by; a Guide Agent steps in with immediately speakable rescue phrases when the learner stalls; a Culture Agent debriefs etiquette, tipping and small-talk norms after the scene.
|
|
4
|
+
|
|
5
|
+
The name joins **Scenario** (a concrete real-life setting such as ordering food, checking into a hotel, seeing a doctor or asking for directions) with **Buddy** (a companion that stays with the learner through the whole encounter rather than acting as a one-off quiz). Version **1.0.0** is a typed Python package and distributable wheel built on **`acps-sdk==2.1.0`**, not a notebook or a mocked chat script.
|
|
6
|
+
|
|
7
|
+
## Why it is useful
|
|
8
|
+
|
|
9
|
+
- **NPC Agent** opens the scene in character, tracks turn order, keeps the dialogue coherent, and flags hesitation it observes.
|
|
10
|
+
- **Guide Agent** receives the stalled utterance plus the NPC's last line and returns three contextual phrases with Chinese support and one delivery strategy.
|
|
11
|
+
- **Culture Agent** consumes the finished transcript and produces a structured briefing: etiquette, taboos, safe small talk, tipping and reusable patterns.
|
|
12
|
+
- **Scenario Leader** discovers skills through ADP, checks real HTTP heartbeats, orchestrates AIP v2 JSON-RPC tasks, routes rescues mid-turn, transfers typed memory and audits every stage transition.
|
|
13
|
+
|
|
14
|
+
The engine is deterministic and offline after installation: it needs no LLM key and makes no claim to be a calibrated speaking test. Every turn is reproducible, which makes the package suitable for classrooms, self-study routines and integration tests.
|
|
15
|
+
|
|
16
|
+
## Metadata description (under 500 characters)
|
|
17
|
+
|
|
18
|
+
> An ACPs multi-agent companion for real-world English. A scenario NPC (waiter, hotel receptionist, doctor, passer-by) role-plays immersive dialogue; a Guide Agent supplies idiomatic rescue phrases the moment the learner gets stuck; a Culture Agent debriefs etiquette, tipping and small talk. Built on acps-sdk 2.1.0 with independent AIP v2 JSON-RPC services, ADP discovery, typed products and auditable task traces for travel, relocation and healthcare.
|
|
19
|
+
|
|
20
|
+
## Collaboration architecture
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
Learner turns
|
|
24
|
+
│
|
|
25
|
+
▼
|
|
26
|
+
Scenario Leader ── ADP DiscoveryRequest + HTTP /healthz ──► Agent Registry
|
|
27
|
+
│
|
|
28
|
+
├── AIP v2 JSON-RPC ──► NPC Agent
|
|
29
|
+
│ opening → role-play turns → closing
|
|
30
|
+
│
|
|
31
|
+
├── AIP v2 JSON-RPC (only when stuck) ──► Guide Agent
|
|
32
|
+
│ trigger + stalled utterance + NPC line → 3 rescue phrases
|
|
33
|
+
│
|
|
34
|
+
├── AIP v2 JSON-RPC + full transcript ──► Culture Agent
|
|
35
|
+
│ etiquette + taboos + small talk + tipping
|
|
36
|
+
│
|
|
37
|
+
└── non-empty END_SESSION broadcast + ControlAck from all agents
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Every partner runs as an independent FastAPI/uvicorn service on an ephemeral loopback port. Commands and products use `acps-sdk==2.1.0` AIP models. Application envelopes carry validated `session_id`, `task_id`, `stage` and a non-empty typed payload; the stage machine rejects skipped or reversed phases.
|
|
41
|
+
|
|
42
|
+
## Project structure
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
acps-scenario-buddy/
|
|
46
|
+
├── pyproject.toml # setuptools metadata, dependencies, CLI, tool config
|
|
47
|
+
├── README.md
|
|
48
|
+
├── LICENSE
|
|
49
|
+
├── .gitignore
|
|
50
|
+
├── examples/
|
|
51
|
+
│ └── restaurant_demo.py # one-command public-API example
|
|
52
|
+
├── src/scenario_buddy/
|
|
53
|
+
│ ├── __init__.py # versioned public API
|
|
54
|
+
│ ├── __main__.py # python -m scenario_buddy
|
|
55
|
+
│ ├── py.typed # PEP 561 typing marker
|
|
56
|
+
│ ├── cli.py # scripted and interactive CLI
|
|
57
|
+
│ ├── demo.py # realistic four-turn fixtures per scenario
|
|
58
|
+
│ ├── leader.py # ADP discovery, AIP dispatch, rescue routing, fan-in
|
|
59
|
+
│ ├── mesh.py # lifecycle of three local partner services
|
|
60
|
+
│ ├── registry.py # ACS publication and ADP discovery
|
|
61
|
+
│ ├── runtime.py # AIP v2 JSON-RPC hosting and structured products
|
|
62
|
+
│ ├── protocol.py # message codec and four-stage state machine
|
|
63
|
+
│ ├── models.py # typed domain, wire and collaboration contracts
|
|
64
|
+
│ ├── identity.py # AIC identity helpers and project version
|
|
65
|
+
│ ├── scenarios.py # NPC openings, turn replies and visible goals
|
|
66
|
+
│ ├── guide_bank.py # stuck detection and contextual rescue phrases
|
|
67
|
+
│ ├── culture_bank.py # curated cultural debriefs
|
|
68
|
+
│ ├── report.py # human-readable Markdown renderer
|
|
69
|
+
│ └── agents/
|
|
70
|
+
│ ├── base.py # shared AIP task lifecycle and control handling
|
|
71
|
+
│ ├── npc.py # in-character role-play partner
|
|
72
|
+
│ ├── guide.py # just-in-time phrase rescue partner
|
|
73
|
+
│ └── culture.py # post-scene cultural debrief partner
|
|
74
|
+
└── tests/
|
|
75
|
+
└── test_scenario_buddy.py # protocol, stuck detection and full-mesh integration
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Install and run
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# from the repository root
|
|
82
|
+
python -m venv .venv
|
|
83
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
84
|
+
python -m pip install -e ".[dev]"
|
|
85
|
+
|
|
86
|
+
# one-command scripted restaurant demo
|
|
87
|
+
python -m scenario_buddy demo --scenario restaurant
|
|
88
|
+
|
|
89
|
+
# interactive practice (type your own English turns)
|
|
90
|
+
python -m scenario_buddy chat --scenario hotel
|
|
91
|
+
|
|
92
|
+
# or use the installed console script
|
|
93
|
+
scenario-buddy demo --scenario clinic --destination "Toronto, Canada"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The scripted demo needs no keyboard input. The `chat` command prompts for four turns and uses the same multi-agent pipeline.
|
|
97
|
+
|
|
98
|
+
### Expected demo excerpt
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
[NPC Agent · opening]
|
|
102
|
+
Good evening, welcome to The Thames Bistro. Do you have a reservation?
|
|
103
|
+
|
|
104
|
+
[Learner · turn 2/4]
|
|
105
|
+
I want the... uh... the chicken thing. How do you say?
|
|
106
|
+
|
|
107
|
+
[Guide Agent · rescue for turn 2]
|
|
108
|
+
Trigger: explicit help request: 'how do you say'
|
|
109
|
+
1. Could I have the grilled chicken, please?
|
|
110
|
+
请给我一份烤鸡,谢谢。 · Could I have… 是点餐最礼貌、最通用的句式。
|
|
111
|
+
2. What would you recommend?
|
|
112
|
+
您推荐什么? · 不确定菜名时,把选择权交给服务员。
|
|
113
|
+
3. Sorry, what do you call this dish in English?
|
|
114
|
+
不好意思,这道菜英文怎么说? · 直接问菜名,比沉默或只指菜单更自然。
|
|
115
|
+
Tip: 用 'Could I have…' 代替 'I want…' 更礼貌;先报菜名,再回答熟度(medium / well done)。
|
|
116
|
+
|
|
117
|
+
[NPC Agent · turn 2]
|
|
118
|
+
The grilled chicken is an excellent choice. How would you like it cooked — medium or well done?
|
|
119
|
+
|
|
120
|
+
[Culture Agent] Debrief ready: 英式餐厅点餐:礼貌句式、出餐节奏与小费
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The final report also contains the AIP task audit table, all four dialogue turns, the rescue log and the full cultural briefing.
|
|
124
|
+
|
|
125
|
+
## Programmatic API
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
import asyncio
|
|
129
|
+
|
|
130
|
+
from scenario_buddy import LearnerProfile, LocalAgentMesh, Scenario, ScenarioSession
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
async def main() -> None:
|
|
134
|
+
learner = LearnerProfile(
|
|
135
|
+
name="Alex Chen",
|
|
136
|
+
scenario=Scenario.RESTAURANT,
|
|
137
|
+
destination="London, UK",
|
|
138
|
+
)
|
|
139
|
+
turns = [
|
|
140
|
+
"Do you have a table for two, please?",
|
|
141
|
+
"I want the... uh... the chicken thing.",
|
|
142
|
+
"Medium, please. And a sparkling water.",
|
|
143
|
+
"Could we have the bill, please?",
|
|
144
|
+
]
|
|
145
|
+
with LocalAgentMesh() as mesh:
|
|
146
|
+
async with ScenarioSession(mesh.registry, learner) as session:
|
|
147
|
+
result = await session.run(turns)
|
|
148
|
+
print(result.culture.headline)
|
|
149
|
+
print(result.rescues[0].phrases[0].english)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
asyncio.run(main())
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Build the wheel and upload to PyPI
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
python -m pip install --upgrade build twine
|
|
159
|
+
python -m build
|
|
160
|
+
python -m twine check dist/*
|
|
161
|
+
|
|
162
|
+
# TestPyPI first
|
|
163
|
+
python -m twine upload --repository testpypi dist/*
|
|
164
|
+
|
|
165
|
+
# Production PyPI
|
|
166
|
+
export TWINE_USERNAME=__token__
|
|
167
|
+
export TWINE_PASSWORD=pypi-<your-api-token>
|
|
168
|
+
python -m twine upload dist/*
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Windows PowerShell equivalents:
|
|
172
|
+
|
|
173
|
+
```powershell
|
|
174
|
+
$env:TWINE_USERNAME = "__token__"
|
|
175
|
+
$env:TWINE_PASSWORD = "pypi-<your-api-token>"
|
|
176
|
+
python -m twine upload dist/*
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The build produces `dist/acps_scenario_buddy-1.0.0-py3-none-any.whl` and the source distribution.
|
|
180
|
+
|
|
181
|
+
## Verify the package
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
python -m pytest
|
|
185
|
+
python -m ruff check .
|
|
186
|
+
python -m twine check dist/*
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Design boundaries
|
|
190
|
+
|
|
191
|
+
- The scene scripts are curated and deterministic; they are designed for repeatable practice, not for open-ended generation.
|
|
192
|
+
- The Guide Agent triggers on observable signals (Chinese characters, explicit help phrases, hesitation markers, unfinished utterances) rather than on a hidden model.
|
|
193
|
+
- The Culture Agent provides general guidance for UK-oriented settings; regional norms vary and should be checked for a specific destination.
|
|
194
|
+
- AIP task state is held in the SDK's in-process `TaskManager`; this local mesh is intended for single-process practice and CI, not multi-tenant deployment.
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "acps-scenario-buddy"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "An ACPs multi-agent companion for real-world English. A scenario NPC (waiter, hotel receptionist, doctor, passer-by) role-plays immersive dialogue; a Guide Agent supplies idiomatic rescue phrases the moment the learner gets stuck; a Culture Agent debriefs etiquette, tipping and small talk. Built on acps-sdk 2.1.0 with independent AIP v2 JSON-RPC services, ADP discovery, typed products and auditable task traces for travel, relocation and healthcare."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{ name = "ACPs Scenario Buddy Engineering" }]
|
|
13
|
+
keywords = [
|
|
14
|
+
"acps",
|
|
15
|
+
"acps-sdk",
|
|
16
|
+
"multi-agent",
|
|
17
|
+
"english-conversation",
|
|
18
|
+
"scenario-roleplay",
|
|
19
|
+
"travel-english",
|
|
20
|
+
"culture-etiquette",
|
|
21
|
+
]
|
|
22
|
+
classifiers = [
|
|
23
|
+
"Development Status :: 5 - Production/Stable",
|
|
24
|
+
"Intended Audience :: Education",
|
|
25
|
+
"Intended Audience :: End Users/Desktop",
|
|
26
|
+
"Natural Language :: English",
|
|
27
|
+
"Operating System :: OS Independent",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Programming Language :: Python :: 3.13",
|
|
34
|
+
"Topic :: Education",
|
|
35
|
+
"Typing :: Typed",
|
|
36
|
+
]
|
|
37
|
+
dependencies = [
|
|
38
|
+
"acps-sdk==2.1.0",
|
|
39
|
+
"fastapi>=0.100.0",
|
|
40
|
+
"httpx>=0.25.0",
|
|
41
|
+
"pydantic>=2.0.0",
|
|
42
|
+
"uvicorn>=0.27.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.optional-dependencies]
|
|
46
|
+
dev = [
|
|
47
|
+
"build>=1.0.0",
|
|
48
|
+
"pytest>=8.0.0",
|
|
49
|
+
"ruff>=0.6.0",
|
|
50
|
+
"twine>=5.0.0",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.scripts]
|
|
54
|
+
scenario-buddy = "scenario_buddy.cli:main"
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
Homepage = "https://pypi.org/project/acps-scenario-buddy/"
|
|
58
|
+
Source = "https://github.com/acps-labs/acps-scenario-buddy"
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.packages.find]
|
|
61
|
+
where = ["src"]
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.package-data]
|
|
64
|
+
scenario_buddy = ["py.typed"]
|
|
65
|
+
|
|
66
|
+
[tool.pytest.ini_options]
|
|
67
|
+
testpaths = ["tests"]
|
|
68
|
+
pythonpath = ["src"]
|
|
69
|
+
addopts = "-q"
|
|
70
|
+
|
|
71
|
+
[tool.ruff]
|
|
72
|
+
line-length = 100
|
|
73
|
+
|
|
74
|
+
[tool.ruff.lint]
|
|
75
|
+
select = ["E", "F", "I", "UP", "B"]
|