viola-agent 0.2.1__tar.gz → 0.2.2__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.
- viola_agent-0.2.2/PKG-INFO +300 -0
- viola_agent-0.2.2/README.md +234 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/pyproject.toml +4 -2
- viola_agent-0.2.2/viola/api/openapi.py +632 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cli/commands.py +18 -0
- viola_agent-0.2.1/PKG-INFO +0 -198
- viola_agent-0.2.1/README.md +0 -133
- {viola_agent-0.2.1 → viola_agent-0.2.2}/.gitignore +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/LICENSE +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/THIRD_PARTY_NOTICES.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/__main__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/autocompact.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/context.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/hook.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/loop.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/memory.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/model_presets.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/profiles.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/progress_hook.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/runner.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/skills.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/subagent.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/base.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/context.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/cron.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/dream_workspace_tools.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/exec_session.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/file_state.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/loader.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/long_task.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/mcp.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/message.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/notebook.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/registry.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/runtime_state.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/sandbox.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/schema.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/search.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/self.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/shell.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/spawn.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/web.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/agent/tools/workspace_paths.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/api/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/api/server.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/api/twilio_media.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/api/twilio_webhook.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/api/whatsapp_response_template.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/billing.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/bus/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/bus/events.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/bus/queue.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/channels/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/channels/base.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/channels/manager.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/channels/registry.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cli/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cli/doctor.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cli/models.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cli/onboard.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cli/stream.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/command/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/command/builtin.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/command/router.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/config/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/config/loader.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/config/paths.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/config/schema.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cron/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cron/registry.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cron/service.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/cron/types.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/heartbeat/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/heartbeat/service.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/client.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/guards.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/runtime/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/runtime/cache.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/runtime/client.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/runtime/keys.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/runtime/lock.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/runtime/rate_limit.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/infra/redis/runtime/session.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/notify/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/notify/catalog.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/notify/service.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/notify/store.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/notify/templates.yaml +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/notify/twilio_content.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/notify/window.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/pairing/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/pairing/store.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/anthropic_provider.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/base.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/factory.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/fallback_provider.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/image_generation.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/openai_compat_provider.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/openai_responses/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/openai_responses/converters.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/openai_responses/parsing.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/registry.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/providers/transcription.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/runtime/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/runtime/background_tasks.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/runtime/whatsapp_outbound.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/security/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/security/network.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/session/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/session/goal_state.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/session/manager.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/settings.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/README.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/cron/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/github/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/long-goal/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/memory/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/my/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/my/references/examples.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/skill-creator/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/skill-creator/scripts/init_skill.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/skill-creator/scripts/package_skill.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/skill-creator/scripts/quick_validate.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/summarize/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/tmux/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/tmux/scripts/find-sessions.sh +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/tmux/scripts/wait-for-text.sh +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/update-setup/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/skills/weather/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/AGENTS.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/HEARTBEAT.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/SKILL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/SOUL.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/TOOLS.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/USER.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/_snippets/untrusted_content.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/consolidator_archive.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/dream_phase1.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/dream_phase2.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/evaluator.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/identity.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/max_iterations_message.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/platform_policy.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/skills_section.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/subagent_announce.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/subagent_system.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/agent/tool_contract.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/memory/MEMORY.md +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/templates/memory/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/__init__.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/artifacts.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/document.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/evaluator.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/gitstore.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/helpers.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/llm_runtime.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/logging_bridge.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/media_decode.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/path.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/progress_events.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/prompt_templates.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/restart.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/runtime.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/searchusage.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/subagent_channel_display.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/utils/tool_hints.py +0 -0
- {viola_agent-0.2.1 → viola_agent-0.2.2}/viola/viola.py +0 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: viola-agent
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Self-hosted WhatsApp AI agent (Twilio) with an OpenAI-compatible API
|
|
5
|
+
Project-URL: Homepage, https://github.com/virpluzteam/viola-agent
|
|
6
|
+
Project-URL: Source, https://github.com/virpluzteam/viola-agent
|
|
7
|
+
Project-URL: Issues, https://github.com/virpluzteam/viola-agent/issues
|
|
8
|
+
Author: Xubin Ren, the viola contributors
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: THIRD_PARTY_NOTICES.md
|
|
12
|
+
Keywords: agent,ai,chatbot,llm,twilio,whatsapp
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: <3.15,>=3.11
|
|
21
|
+
Requires-Dist: aiohttp<4.0.0,>=3.9.0
|
|
22
|
+
Requires-Dist: anthropic<1.0.0,>=0.45.0
|
|
23
|
+
Requires-Dist: boto3>=1.43.0
|
|
24
|
+
Requires-Dist: chardet<6.0.0,>=3.0.2
|
|
25
|
+
Requires-Dist: croniter<7.0.0,>=6.0.0
|
|
26
|
+
Requires-Dist: ddgs<10.0.0,>=9.5.5
|
|
27
|
+
Requires-Dist: dingtalk-stream<1.0.0,>=0.24.0
|
|
28
|
+
Requires-Dist: dulwich<1.0.0,>=0.22.0
|
|
29
|
+
Requires-Dist: filelock>=3.25.2
|
|
30
|
+
Requires-Dist: httpx<1.0.0,>=0.28.0
|
|
31
|
+
Requires-Dist: jinja2<4.0.0,>=3.1.0
|
|
32
|
+
Requires-Dist: json-repair<1.0.0,>=0.57.0
|
|
33
|
+
Requires-Dist: lark-oapi<2.0.0,>=1.5.0
|
|
34
|
+
Requires-Dist: loguru<1.0.0,>=0.7.3
|
|
35
|
+
Requires-Dist: mcp<2.0.0,>=1.26.0
|
|
36
|
+
Requires-Dist: msgpack<2.0.0,>=1.1.0
|
|
37
|
+
Requires-Dist: oauth-cli-kit<1.0.0,>=0.1.3
|
|
38
|
+
Requires-Dist: openai>=2.8.0
|
|
39
|
+
Requires-Dist: openpyxl<4.0.0,>=3.1.0
|
|
40
|
+
Requires-Dist: prompt-toolkit<4.0.0,>=3.0.50
|
|
41
|
+
Requires-Dist: pydantic-settings<3.0.0,>=2.12.0
|
|
42
|
+
Requires-Dist: pydantic<3.0.0,>=2.12.0
|
|
43
|
+
Requires-Dist: pypdf<6.0.0,>=5.0.0
|
|
44
|
+
Requires-Dist: python-docx<2.0.0,>=1.1.0
|
|
45
|
+
Requires-Dist: python-dotenv<2.0.0,>=1.0.0
|
|
46
|
+
Requires-Dist: python-pptx<2.0.0,>=1.0.0
|
|
47
|
+
Requires-Dist: python-socketio<6.0.0,>=5.16.0
|
|
48
|
+
Requires-Dist: python-socks[asyncio]<3.0.0,>=2.8.0; sys_platform != 'win32'
|
|
49
|
+
Requires-Dist: python-telegram-bot[socks]<23.0,>=22.6
|
|
50
|
+
Requires-Dist: pyyaml<7.0.0,>=6.0
|
|
51
|
+
Requires-Dist: qq-botpy<2.0.0,>=1.2.0
|
|
52
|
+
Requires-Dist: questionary<3.0.0,>=2.0.0
|
|
53
|
+
Requires-Dist: readability-lxml<1.0.0,>=0.8.4
|
|
54
|
+
Requires-Dist: redis[hiredis]<6.0.0,>=5.0.0
|
|
55
|
+
Requires-Dist: rich<15.0.0,>=14.0.0
|
|
56
|
+
Requires-Dist: slack-sdk<4.0.0,>=3.39.0
|
|
57
|
+
Requires-Dist: slackify-markdown<1.0.0,>=0.2.0
|
|
58
|
+
Requires-Dist: socksio<2.0.0,>=1.0.0
|
|
59
|
+
Requires-Dist: tiktoken<1.0.0,>=0.12.0
|
|
60
|
+
Requires-Dist: typer<1.0.0,>=0.20.0
|
|
61
|
+
Requires-Dist: websocket-client<2.0.0,>=1.9.0
|
|
62
|
+
Requires-Dist: websockets<17.0,>=16.0
|
|
63
|
+
Provides-Extra: twilio
|
|
64
|
+
Requires-Dist: twilio<10.0.0,>=9.0.0; extra == 'twilio'
|
|
65
|
+
Description-Content-Type: text/markdown
|
|
66
|
+
|
|
67
|
+
# viola-agent
|
|
68
|
+
|
|
69
|
+
A self-hosted WhatsApp AI agent. A company deploys one copy, fills in its own Twilio,
|
|
70
|
+
LLM (OpenRouter or UniAPI) and optional billing credentials, and gets an assistant its
|
|
71
|
+
customers and staff can message on WhatsApp. Its own backend can talk to the same agent
|
|
72
|
+
over an OpenAI-compatible API and send proactive WhatsApp messages.
|
|
73
|
+
|
|
74
|
+
- **One process, one port.** `viola serve` runs the Twilio webhook, the `/v1/*` API and
|
|
75
|
+
`/health`. Redis holds short-lived state (de-duplication, rate limits, the 24-hour
|
|
76
|
+
window); everything else lives in one data folder.
|
|
77
|
+
- **One deployment = one company.** Each deployment has its own `.env`, Twilio account,
|
|
78
|
+
public URL and data.
|
|
79
|
+
- **Safe defaults.** Twilio signatures are verified, every `/v1/*` call needs a server key,
|
|
80
|
+
and the agent has no tools until you list them in `config.json`.
|
|
81
|
+
- **WhatsApp's rules built in.** Free text inside the 24-hour window, approved templates
|
|
82
|
+
outside it, idempotent sends.
|
|
83
|
+
|
|
84
|
+
**Full setup guide: [docs/getting-started.md](docs/getting-started.md)**. It goes through
|
|
85
|
+
every `.env` variable, HTTPS, Twilio, templates, customisation, backups and
|
|
86
|
+
troubleshooting. The API contract is [docs/openapi.json](docs/openapi.json).
|
|
87
|
+
|
|
88
|
+
## Quick start (Docker)
|
|
89
|
+
|
|
90
|
+
You need Docker Compose v2, a Twilio account with a WhatsApp sender (the sandbox is fine
|
|
91
|
+
for a first test), an OpenRouter or UniAPI key, and a public HTTPS address for the
|
|
92
|
+
server.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git clone https://github.com/virpluzteam/viola-agent.git && cd viola-agent
|
|
96
|
+
cp .env.example .env && chmod 600 .env
|
|
97
|
+
# fill in TWILIO_*, PUBLIC_BASE_URL, LLM_API_KEY, LLM_MODEL_DEFAULT (see the guide)
|
|
98
|
+
docker compose up -d
|
|
99
|
+
docker compose exec viola viola doctor # checks every credential and service
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`docker compose up -d` pulls `ghcr.io/virpluzteam/viola-agent` (amd64 and arm64) and starts
|
|
103
|
+
it with Redis. Pin a release with `VIOLA_IMAGE=ghcr.io/virpluzteam/viola-agent:0.2.2` in
|
|
104
|
+
`.env`. The agent listens on `127.0.0.1:8900`; the next two steps make it reachable from
|
|
105
|
+
Twilio.
|
|
106
|
+
|
|
107
|
+
> The repository and image are private for now. Run `docker login ghcr.io` with an
|
|
108
|
+
> account (or a token with `read:packages`) that can read `virpluzteam` packages first.
|
|
109
|
+
|
|
110
|
+
### Without Docker
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
python3 -m venv .venv && .venv/bin/pip install 'viola-agent[twilio]'
|
|
114
|
+
cp .env.example .env # APP_ENV=development runs without Redis
|
|
115
|
+
.venv/bin/viola serve --port 8900
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Production (`APP_ENV=production`) requires `REDIS_URL`. Background tasks (cron reminders,
|
|
119
|
+
proactive delivery) run only with `VIOLA_API_BACKGROUND_TASKS=true`; the Docker image sets
|
|
120
|
+
it for you.
|
|
121
|
+
|
|
122
|
+
## Expose the webhook over HTTPS
|
|
123
|
+
|
|
124
|
+
Twilio must reach `https://<your domain>/twilio/webhook`. Set `PUBLIC_BASE_URL` to the
|
|
125
|
+
public base URL first: signatures are checked against it, and a mismatch rejects every
|
|
126
|
+
message with `403`. Only `/twilio/*` (and `/health`) needs to be public; keep `/v1/*` for
|
|
127
|
+
your own backend.
|
|
128
|
+
|
|
129
|
+
| Option | When | How |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| Bundled Caddy | Server with a public IP and a domain | `COMPOSE_PROFILES=caddy` and `VIOLA_DOMAIN=agent.example.com` in `.env`. Caddy gets the certificate and publishes only `/twilio/*` and `/health`. |
|
|
132
|
+
| Cloudflare Tunnel | No open ports; domain on Cloudflare | Named tunnel to `http://127.0.0.1:8900`, path `^/(twilio/.*\|health)$` |
|
|
133
|
+
| Your own reverse proxy | nginx / Caddy already on 80/443 | Proxy `/twilio/*` and `/health` to `127.0.0.1:8900` |
|
|
134
|
+
| ngrok | Development only | `ngrok http 8900`. Free hostnames change on restart, so update `PUBLIC_BASE_URL` and Twilio each time. |
|
|
135
|
+
|
|
136
|
+
Details: [Expose it over HTTPS](docs/getting-started.md#expose-it-over-https).
|
|
137
|
+
|
|
138
|
+
## Connect Twilio
|
|
139
|
+
|
|
140
|
+
In the Twilio Console, open your WhatsApp sender (sandbox: *Messaging → Try it out → Send
|
|
141
|
+
a WhatsApp message → Sandbox settings*) and set:
|
|
142
|
+
|
|
143
|
+
- **When a message comes in:** `https://<your domain>/twilio/webhook`, `POST`
|
|
144
|
+
- **Status callback URL** (optional): `https://<your domain>/twilio/status`
|
|
145
|
+
|
|
146
|
+
Message the number on WhatsApp; the agent answers within a few seconds. The webhook
|
|
147
|
+
replies `202` at once and sends the answer through Twilio when it's ready. Repeated
|
|
148
|
+
`MessageSid`s are ignored and each sender is rate-limited.
|
|
149
|
+
|
|
150
|
+
Each deployment uses its own domain. Two companies never share one webhook URL: a
|
|
151
|
+
deployment rejects signatures from any Twilio account but its own.
|
|
152
|
+
|
|
153
|
+
## Message templates
|
|
154
|
+
|
|
155
|
+
WhatsApp allows free text only within **24 hours** of the customer's last message. Outside
|
|
156
|
+
that window only Meta-approved templates may be sent. `/v1/notify`, cron reminders and
|
|
157
|
+
heartbeat all follow the same rule:
|
|
158
|
+
|
|
159
|
+
1. Window open and `fallback_text` given: the text is sent.
|
|
160
|
+
2. Otherwise, if the `template_id` is approved: the template is sent.
|
|
161
|
+
3. Otherwise nothing is sent, and the response is `422 template_required` with the reason.
|
|
162
|
+
This is the rule working, not a failure.
|
|
163
|
+
|
|
164
|
+
The bundled catalogue `viola/notify/templates.yaml` has welcome, reminder, follow-up and
|
|
165
|
+
generic notification templates in `en` and `zh_HK`. To use your own, copy it to
|
|
166
|
+
`$VIOLA_DATA_DIR/templates.yaml` (Docker: `./data/templates.yaml`) and edit it. Then
|
|
167
|
+
create the templates in your Twilio account and submit them to Meta:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
docker compose exec viola viola templates sync --dry-run # preview
|
|
171
|
+
docker compose exec viola viola templates sync # create + submit for approval
|
|
172
|
+
docker compose exec viola viola templates status # check approval later
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
ContentSids and approval statuses are kept in `content_sid_map.json` in the data folder.
|
|
176
|
+
Only `approved` templates are used.
|
|
177
|
+
|
|
178
|
+
## Calling the agent from your backend
|
|
179
|
+
|
|
180
|
+
Set `VIOLA_API_SERVER_KEY` in `.env`. Without it every `/v1/*` route returns `404`. Only
|
|
181
|
+
your **backend** calls the API; never put the key in a browser. During key rotation,
|
|
182
|
+
`VIOLA_API_SERVER_KEY_PREVIOUS` is accepted too.
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Talk to the agent as one of your users (OpenAI-compatible; "stream": true for SSE)
|
|
186
|
+
curl https://agent.example.com/v1/chat/completions \
|
|
187
|
+
-H "Authorization: Bearer $VIOLA_API_SERVER_KEY" -H "Content-Type: application/json" \
|
|
188
|
+
-d '{"user": "u_42", "session_id": "support-7",
|
|
189
|
+
"messages": [{"role": "user", "content": "What are your opening hours?"}]}'
|
|
190
|
+
|
|
191
|
+
# Send a proactive WhatsApp message
|
|
192
|
+
curl https://agent.example.com/v1/notify \
|
|
193
|
+
-H "Authorization: Bearer $VIOLA_API_SERVER_KEY" -H "Content-Type: application/json" \
|
|
194
|
+
-d '{"to": "+85212345678", "template_id": "reminder",
|
|
195
|
+
"variables": {"reminder_text": "your appointment is tomorrow at 10:00"},
|
|
196
|
+
"fallback_text": "Hi! Your appointment is tomorrow at 10:00.",
|
|
197
|
+
"idempotency_key": "appt-123-reminder"}'
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
- **Chat:** `user` is required and is the user your backend authenticated (the agent
|
|
201
|
+
doesn't check logins). History is kept per `portal:<user>:<session_id>`, and usage is
|
|
202
|
+
billed to `portal:<user>`. Send only the new message; the agent keeps the history.
|
|
203
|
+
- **Notify:** `200` sent, `422 template_required`, `502 twilio_error`, `409` key reused
|
|
204
|
+
with a different body (or still sending), `400` bad request. A repeated
|
|
205
|
+
`idempotency_key` never sends twice; the first result is returned for 7 days.
|
|
206
|
+
|
|
207
|
+
Every route, body, status code and limit is described in
|
|
208
|
+
[docs/openapi.json](docs/openapi.json) (OpenAPI 3.1). Load it into Swagger UI, Redoc or a
|
|
209
|
+
client generator, or print the version you're running with `viola openapi`.
|
|
210
|
+
|
|
211
|
+
## Configuration
|
|
212
|
+
|
|
213
|
+
| Where | What |
|
|
214
|
+
|---|---|
|
|
215
|
+
| `.env` | Secrets, deployment values and switches: Twilio, LLM, billing, Redis, server key. See [`.env.example`](.env.example). |
|
|
216
|
+
| `config.json` in the data folder (optional) | Behaviour: tools for each channel profile (`whatsapp`, `portal`), MCP servers, transcription language. Tools are **off** until listed. |
|
|
217
|
+
| `workspace/` in the data folder | Persona and instructions (`SOUL.md` and friends), chat history and memory |
|
|
218
|
+
|
|
219
|
+
When `.env` and `config.json` disagree, the environment wins.
|
|
220
|
+
|
|
221
|
+
### Feature switches
|
|
222
|
+
|
|
223
|
+
Off by default. Each one makes background LLM calls, and those calls are billed.
|
|
224
|
+
|
|
225
|
+
| Variable | What it does |
|
|
226
|
+
|---|---|
|
|
227
|
+
| `VIOLA_DREAM_ENABLED` | Periodically consolidates chat history into long-term memory |
|
|
228
|
+
| `VIOLA_HEARTBEAT_ENABLED` | Periodically runs the tasks in `workspace/HEARTBEAT.md` |
|
|
229
|
+
|
|
230
|
+
The startup summary shows the state of each switch; `viola doctor` also lists the tools
|
|
231
|
+
each profile can use.
|
|
232
|
+
|
|
233
|
+
## Data and backups
|
|
234
|
+
|
|
235
|
+
Everything the agent keeps is in one folder: `./data` with Docker (`VIOLA_DATA_PATH`), or
|
|
236
|
+
`$VIOLA_DATA_DIR` (default `~/.viola`) without it. That's `config.json`, the workspace
|
|
237
|
+
(chat history, memory, persona), media, `content_sid_map.json`, and the SQLite files
|
|
238
|
+
(billing outbox, notification idempotency). Back it up with the agent stopped:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
docker compose stop viola
|
|
242
|
+
tar czf viola-data-$(date +%F).tgz data/
|
|
243
|
+
docker compose start viola
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Redis only holds short-lived state and needs no backup.
|
|
247
|
+
|
|
248
|
+
## Updating
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
git pull # compose file and docs
|
|
252
|
+
docker compose pull && docker compose up -d
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
With a pinned `VIOLA_IMAGE`, change the tag first. With pip: `pip install -U 'viola-agent[twilio]'`.
|
|
256
|
+
|
|
257
|
+
## Development
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
python3.13 -m venv .venv && .venv/bin/pip install -e ".[twilio]" --group dev # pip >= 25.1; or: uv sync --all-extras
|
|
261
|
+
.venv/bin/ruff check viola/
|
|
262
|
+
.venv/bin/pytest
|
|
263
|
+
docker compose up -d --build # run this checkout instead of the released image
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Layout: `viola/` is the package (`viola/api/` has the HTTP routes, `viola/notify/` has
|
|
267
|
+
templates and proactive sends), `tests/` mirrors it, and `docs/` has the guides and the
|
|
268
|
+
OpenAPI document.
|
|
269
|
+
|
|
270
|
+
If you change a `/v1/*` route or its body, update the models in `viola/api/openapi.py` and
|
|
271
|
+
regenerate the document. `tests/api/test_openapi.py` fails when the document, the models
|
|
272
|
+
and the served routes disagree.
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
.venv/bin/viola openapi --output docs/openapi.json
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
CI (`.github/workflows/ci.yml`) runs ruff, pytest (Python 3.11–3.14, Linux and Windows),
|
|
279
|
+
a gitleaks scan of the full history (allowlist example values in `.gitleaks.toml`;
|
|
280
|
+
one-off false positives go in `.gitleaksignore`), a wheel
|
|
281
|
+
build and an image build with a smoke test (`.github/scripts/smoke-image.sh`).
|
|
282
|
+
|
|
283
|
+
### Releasing
|
|
284
|
+
|
|
285
|
+
1. Set `version` in `pyproject.toml` (e.g. `0.2.2`), regenerate `docs/openapi.json` (it
|
|
286
|
+
carries the version), and merge to `main`. Wait for CI to pass.
|
|
287
|
+
2. Tag that commit and push the tag:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
git tag v0.2.2 && git push origin v0.2.2
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
`.github/workflows/release.yml` checks the tag matches the version and runs CI. It then
|
|
294
|
+
publishes the wheel and sdist to PyPI, pushes the image to GHCR as `0.2.2`, `0.2` and
|
|
295
|
+
`latest`, and creates a GitHub release. One-time setup is described at the top of that
|
|
296
|
+
file.
|
|
297
|
+
|
|
298
|
+
## License
|
|
299
|
+
|
|
300
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# viola-agent
|
|
2
|
+
|
|
3
|
+
A self-hosted WhatsApp AI agent. A company deploys one copy, fills in its own Twilio,
|
|
4
|
+
LLM (OpenRouter or UniAPI) and optional billing credentials, and gets an assistant its
|
|
5
|
+
customers and staff can message on WhatsApp. Its own backend can talk to the same agent
|
|
6
|
+
over an OpenAI-compatible API and send proactive WhatsApp messages.
|
|
7
|
+
|
|
8
|
+
- **One process, one port.** `viola serve` runs the Twilio webhook, the `/v1/*` API and
|
|
9
|
+
`/health`. Redis holds short-lived state (de-duplication, rate limits, the 24-hour
|
|
10
|
+
window); everything else lives in one data folder.
|
|
11
|
+
- **One deployment = one company.** Each deployment has its own `.env`, Twilio account,
|
|
12
|
+
public URL and data.
|
|
13
|
+
- **Safe defaults.** Twilio signatures are verified, every `/v1/*` call needs a server key,
|
|
14
|
+
and the agent has no tools until you list them in `config.json`.
|
|
15
|
+
- **WhatsApp's rules built in.** Free text inside the 24-hour window, approved templates
|
|
16
|
+
outside it, idempotent sends.
|
|
17
|
+
|
|
18
|
+
**Full setup guide: [docs/getting-started.md](docs/getting-started.md)**. It goes through
|
|
19
|
+
every `.env` variable, HTTPS, Twilio, templates, customisation, backups and
|
|
20
|
+
troubleshooting. The API contract is [docs/openapi.json](docs/openapi.json).
|
|
21
|
+
|
|
22
|
+
## Quick start (Docker)
|
|
23
|
+
|
|
24
|
+
You need Docker Compose v2, a Twilio account with a WhatsApp sender (the sandbox is fine
|
|
25
|
+
for a first test), an OpenRouter or UniAPI key, and a public HTTPS address for the
|
|
26
|
+
server.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git clone https://github.com/virpluzteam/viola-agent.git && cd viola-agent
|
|
30
|
+
cp .env.example .env && chmod 600 .env
|
|
31
|
+
# fill in TWILIO_*, PUBLIC_BASE_URL, LLM_API_KEY, LLM_MODEL_DEFAULT (see the guide)
|
|
32
|
+
docker compose up -d
|
|
33
|
+
docker compose exec viola viola doctor # checks every credential and service
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`docker compose up -d` pulls `ghcr.io/virpluzteam/viola-agent` (amd64 and arm64) and starts
|
|
37
|
+
it with Redis. Pin a release with `VIOLA_IMAGE=ghcr.io/virpluzteam/viola-agent:0.2.2` in
|
|
38
|
+
`.env`. The agent listens on `127.0.0.1:8900`; the next two steps make it reachable from
|
|
39
|
+
Twilio.
|
|
40
|
+
|
|
41
|
+
> The repository and image are private for now. Run `docker login ghcr.io` with an
|
|
42
|
+
> account (or a token with `read:packages`) that can read `virpluzteam` packages first.
|
|
43
|
+
|
|
44
|
+
### Without Docker
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python3 -m venv .venv && .venv/bin/pip install 'viola-agent[twilio]'
|
|
48
|
+
cp .env.example .env # APP_ENV=development runs without Redis
|
|
49
|
+
.venv/bin/viola serve --port 8900
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Production (`APP_ENV=production`) requires `REDIS_URL`. Background tasks (cron reminders,
|
|
53
|
+
proactive delivery) run only with `VIOLA_API_BACKGROUND_TASKS=true`; the Docker image sets
|
|
54
|
+
it for you.
|
|
55
|
+
|
|
56
|
+
## Expose the webhook over HTTPS
|
|
57
|
+
|
|
58
|
+
Twilio must reach `https://<your domain>/twilio/webhook`. Set `PUBLIC_BASE_URL` to the
|
|
59
|
+
public base URL first: signatures are checked against it, and a mismatch rejects every
|
|
60
|
+
message with `403`. Only `/twilio/*` (and `/health`) needs to be public; keep `/v1/*` for
|
|
61
|
+
your own backend.
|
|
62
|
+
|
|
63
|
+
| Option | When | How |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| Bundled Caddy | Server with a public IP and a domain | `COMPOSE_PROFILES=caddy` and `VIOLA_DOMAIN=agent.example.com` in `.env`. Caddy gets the certificate and publishes only `/twilio/*` and `/health`. |
|
|
66
|
+
| Cloudflare Tunnel | No open ports; domain on Cloudflare | Named tunnel to `http://127.0.0.1:8900`, path `^/(twilio/.*\|health)$` |
|
|
67
|
+
| Your own reverse proxy | nginx / Caddy already on 80/443 | Proxy `/twilio/*` and `/health` to `127.0.0.1:8900` |
|
|
68
|
+
| ngrok | Development only | `ngrok http 8900`. Free hostnames change on restart, so update `PUBLIC_BASE_URL` and Twilio each time. |
|
|
69
|
+
|
|
70
|
+
Details: [Expose it over HTTPS](docs/getting-started.md#expose-it-over-https).
|
|
71
|
+
|
|
72
|
+
## Connect Twilio
|
|
73
|
+
|
|
74
|
+
In the Twilio Console, open your WhatsApp sender (sandbox: *Messaging → Try it out → Send
|
|
75
|
+
a WhatsApp message → Sandbox settings*) and set:
|
|
76
|
+
|
|
77
|
+
- **When a message comes in:** `https://<your domain>/twilio/webhook`, `POST`
|
|
78
|
+
- **Status callback URL** (optional): `https://<your domain>/twilio/status`
|
|
79
|
+
|
|
80
|
+
Message the number on WhatsApp; the agent answers within a few seconds. The webhook
|
|
81
|
+
replies `202` at once and sends the answer through Twilio when it's ready. Repeated
|
|
82
|
+
`MessageSid`s are ignored and each sender is rate-limited.
|
|
83
|
+
|
|
84
|
+
Each deployment uses its own domain. Two companies never share one webhook URL: a
|
|
85
|
+
deployment rejects signatures from any Twilio account but its own.
|
|
86
|
+
|
|
87
|
+
## Message templates
|
|
88
|
+
|
|
89
|
+
WhatsApp allows free text only within **24 hours** of the customer's last message. Outside
|
|
90
|
+
that window only Meta-approved templates may be sent. `/v1/notify`, cron reminders and
|
|
91
|
+
heartbeat all follow the same rule:
|
|
92
|
+
|
|
93
|
+
1. Window open and `fallback_text` given: the text is sent.
|
|
94
|
+
2. Otherwise, if the `template_id` is approved: the template is sent.
|
|
95
|
+
3. Otherwise nothing is sent, and the response is `422 template_required` with the reason.
|
|
96
|
+
This is the rule working, not a failure.
|
|
97
|
+
|
|
98
|
+
The bundled catalogue `viola/notify/templates.yaml` has welcome, reminder, follow-up and
|
|
99
|
+
generic notification templates in `en` and `zh_HK`. To use your own, copy it to
|
|
100
|
+
`$VIOLA_DATA_DIR/templates.yaml` (Docker: `./data/templates.yaml`) and edit it. Then
|
|
101
|
+
create the templates in your Twilio account and submit them to Meta:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
docker compose exec viola viola templates sync --dry-run # preview
|
|
105
|
+
docker compose exec viola viola templates sync # create + submit for approval
|
|
106
|
+
docker compose exec viola viola templates status # check approval later
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
ContentSids and approval statuses are kept in `content_sid_map.json` in the data folder.
|
|
110
|
+
Only `approved` templates are used.
|
|
111
|
+
|
|
112
|
+
## Calling the agent from your backend
|
|
113
|
+
|
|
114
|
+
Set `VIOLA_API_SERVER_KEY` in `.env`. Without it every `/v1/*` route returns `404`. Only
|
|
115
|
+
your **backend** calls the API; never put the key in a browser. During key rotation,
|
|
116
|
+
`VIOLA_API_SERVER_KEY_PREVIOUS` is accepted too.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Talk to the agent as one of your users (OpenAI-compatible; "stream": true for SSE)
|
|
120
|
+
curl https://agent.example.com/v1/chat/completions \
|
|
121
|
+
-H "Authorization: Bearer $VIOLA_API_SERVER_KEY" -H "Content-Type: application/json" \
|
|
122
|
+
-d '{"user": "u_42", "session_id": "support-7",
|
|
123
|
+
"messages": [{"role": "user", "content": "What are your opening hours?"}]}'
|
|
124
|
+
|
|
125
|
+
# Send a proactive WhatsApp message
|
|
126
|
+
curl https://agent.example.com/v1/notify \
|
|
127
|
+
-H "Authorization: Bearer $VIOLA_API_SERVER_KEY" -H "Content-Type: application/json" \
|
|
128
|
+
-d '{"to": "+85212345678", "template_id": "reminder",
|
|
129
|
+
"variables": {"reminder_text": "your appointment is tomorrow at 10:00"},
|
|
130
|
+
"fallback_text": "Hi! Your appointment is tomorrow at 10:00.",
|
|
131
|
+
"idempotency_key": "appt-123-reminder"}'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- **Chat:** `user` is required and is the user your backend authenticated (the agent
|
|
135
|
+
doesn't check logins). History is kept per `portal:<user>:<session_id>`, and usage is
|
|
136
|
+
billed to `portal:<user>`. Send only the new message; the agent keeps the history.
|
|
137
|
+
- **Notify:** `200` sent, `422 template_required`, `502 twilio_error`, `409` key reused
|
|
138
|
+
with a different body (or still sending), `400` bad request. A repeated
|
|
139
|
+
`idempotency_key` never sends twice; the first result is returned for 7 days.
|
|
140
|
+
|
|
141
|
+
Every route, body, status code and limit is described in
|
|
142
|
+
[docs/openapi.json](docs/openapi.json) (OpenAPI 3.1). Load it into Swagger UI, Redoc or a
|
|
143
|
+
client generator, or print the version you're running with `viola openapi`.
|
|
144
|
+
|
|
145
|
+
## Configuration
|
|
146
|
+
|
|
147
|
+
| Where | What |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `.env` | Secrets, deployment values and switches: Twilio, LLM, billing, Redis, server key. See [`.env.example`](.env.example). |
|
|
150
|
+
| `config.json` in the data folder (optional) | Behaviour: tools for each channel profile (`whatsapp`, `portal`), MCP servers, transcription language. Tools are **off** until listed. |
|
|
151
|
+
| `workspace/` in the data folder | Persona and instructions (`SOUL.md` and friends), chat history and memory |
|
|
152
|
+
|
|
153
|
+
When `.env` and `config.json` disagree, the environment wins.
|
|
154
|
+
|
|
155
|
+
### Feature switches
|
|
156
|
+
|
|
157
|
+
Off by default. Each one makes background LLM calls, and those calls are billed.
|
|
158
|
+
|
|
159
|
+
| Variable | What it does |
|
|
160
|
+
|---|---|
|
|
161
|
+
| `VIOLA_DREAM_ENABLED` | Periodically consolidates chat history into long-term memory |
|
|
162
|
+
| `VIOLA_HEARTBEAT_ENABLED` | Periodically runs the tasks in `workspace/HEARTBEAT.md` |
|
|
163
|
+
|
|
164
|
+
The startup summary shows the state of each switch; `viola doctor` also lists the tools
|
|
165
|
+
each profile can use.
|
|
166
|
+
|
|
167
|
+
## Data and backups
|
|
168
|
+
|
|
169
|
+
Everything the agent keeps is in one folder: `./data` with Docker (`VIOLA_DATA_PATH`), or
|
|
170
|
+
`$VIOLA_DATA_DIR` (default `~/.viola`) without it. That's `config.json`, the workspace
|
|
171
|
+
(chat history, memory, persona), media, `content_sid_map.json`, and the SQLite files
|
|
172
|
+
(billing outbox, notification idempotency). Back it up with the agent stopped:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
docker compose stop viola
|
|
176
|
+
tar czf viola-data-$(date +%F).tgz data/
|
|
177
|
+
docker compose start viola
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Redis only holds short-lived state and needs no backup.
|
|
181
|
+
|
|
182
|
+
## Updating
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
git pull # compose file and docs
|
|
186
|
+
docker compose pull && docker compose up -d
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
With a pinned `VIOLA_IMAGE`, change the tag first. With pip: `pip install -U 'viola-agent[twilio]'`.
|
|
190
|
+
|
|
191
|
+
## Development
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
python3.13 -m venv .venv && .venv/bin/pip install -e ".[twilio]" --group dev # pip >= 25.1; or: uv sync --all-extras
|
|
195
|
+
.venv/bin/ruff check viola/
|
|
196
|
+
.venv/bin/pytest
|
|
197
|
+
docker compose up -d --build # run this checkout instead of the released image
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Layout: `viola/` is the package (`viola/api/` has the HTTP routes, `viola/notify/` has
|
|
201
|
+
templates and proactive sends), `tests/` mirrors it, and `docs/` has the guides and the
|
|
202
|
+
OpenAPI document.
|
|
203
|
+
|
|
204
|
+
If you change a `/v1/*` route or its body, update the models in `viola/api/openapi.py` and
|
|
205
|
+
regenerate the document. `tests/api/test_openapi.py` fails when the document, the models
|
|
206
|
+
and the served routes disagree.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
.venv/bin/viola openapi --output docs/openapi.json
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
CI (`.github/workflows/ci.yml`) runs ruff, pytest (Python 3.11–3.14, Linux and Windows),
|
|
213
|
+
a gitleaks scan of the full history (allowlist example values in `.gitleaks.toml`;
|
|
214
|
+
one-off false positives go in `.gitleaksignore`), a wheel
|
|
215
|
+
build and an image build with a smoke test (`.github/scripts/smoke-image.sh`).
|
|
216
|
+
|
|
217
|
+
### Releasing
|
|
218
|
+
|
|
219
|
+
1. Set `version` in `pyproject.toml` (e.g. `0.2.2`), regenerate `docs/openapi.json` (it
|
|
220
|
+
carries the version), and merge to `main`. Wait for CI to pass.
|
|
221
|
+
2. Tag that commit and push the tag:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
git tag v0.2.2 && git push origin v0.2.2
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
`.github/workflows/release.yml` checks the tag matches the version and runs CI. It then
|
|
228
|
+
publishes the wheel and sdist to PyPI, pushes the image to GHCR as `0.2.2`, `0.2` and
|
|
229
|
+
`latest`, and creates a GitHub release. One-time setup is described at the top of that
|
|
230
|
+
file.
|
|
231
|
+
|
|
232
|
+
## License
|
|
233
|
+
|
|
234
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "viola-agent"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Self-hosted WhatsApp AI agent (Twilio) with an OpenAI-compatible API"
|
|
5
5
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
6
|
-
requires-python = ">=3.11,<3.
|
|
6
|
+
requires-python = ">=3.11,<3.15"
|
|
7
7
|
#license = {text = "MIT"}
|
|
8
8
|
license = "MIT"
|
|
9
9
|
authors = [
|
|
@@ -18,6 +18,7 @@ classifiers = [
|
|
|
18
18
|
"Programming Language :: Python :: 3.11",
|
|
19
19
|
"Programming Language :: Python :: 3.12",
|
|
20
20
|
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
21
22
|
]
|
|
22
23
|
license-files = [
|
|
23
24
|
"LICENSE",
|
|
@@ -82,6 +83,7 @@ dev = [
|
|
|
82
83
|
"ruff>=0.1.0",
|
|
83
84
|
"pymupdf>=1.25.0",
|
|
84
85
|
"fakeredis>=2.26.0",
|
|
86
|
+
"openapi-spec-validator>=0.7.1",
|
|
85
87
|
]
|
|
86
88
|
|
|
87
89
|
[project.urls]
|