ya-agent-platform 0.58.3__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.
Files changed (31) hide show
  1. ya_agent_platform-0.58.3/.gitignore +153 -0
  2. ya_agent_platform-0.58.3/PKG-INFO +163 -0
  3. ya_agent_platform-0.58.3/README.md +134 -0
  4. ya_agent_platform-0.58.3/infra/dev.env +7 -0
  5. ya_agent_platform-0.58.3/infra/docker-compose.dev.yml +34 -0
  6. ya_agent_platform-0.58.3/pyproject.toml +78 -0
  7. ya_agent_platform-0.58.3/spec/000-platform-overview.md +86 -0
  8. ya_agent_platform-0.58.3/spec/001-system-architecture.md +112 -0
  9. ya_agent_platform-0.58.3/spec/002-bridge-contract.md +110 -0
  10. ya_agent_platform-0.58.3/spec/003-http-api.md +85 -0
  11. ya_agent_platform-0.58.3/spec/README.md +19 -0
  12. ya_agent_platform-0.58.3/start.sh +8 -0
  13. ya_agent_platform-0.58.3/tests/test_app.py +70 -0
  14. ya_agent_platform-0.58.3/tests/test_cli.py +75 -0
  15. ya_agent_platform-0.58.3/ya_agent_platform/__init__.py +4 -0
  16. ya_agent_platform-0.58.3/ya_agent_platform/__main__.py +3 -0
  17. ya_agent_platform-0.58.3/ya_agent_platform/alembic/env.py +71 -0
  18. ya_agent_platform-0.58.3/ya_agent_platform/alembic/script.py.mako +27 -0
  19. ya_agent_platform-0.58.3/ya_agent_platform/alembic/versions/__init__.py +1 -0
  20. ya_agent_platform-0.58.3/ya_agent_platform/alembic.ini +44 -0
  21. ya_agent_platform-0.58.3/ya_agent_platform/api/__init__.py +1 -0
  22. ya_agent_platform-0.58.3/ya_agent_platform/api/health.py +39 -0
  23. ya_agent_platform-0.58.3/ya_agent_platform/api/platform.py +61 -0
  24. ya_agent_platform-0.58.3/ya_agent_platform/app.py +136 -0
  25. ya_agent_platform-0.58.3/ya_agent_platform/cli.py +117 -0
  26. ya_agent_platform-0.58.3/ya_agent_platform/config.py +43 -0
  27. ya_agent_platform-0.58.3/ya_agent_platform/db/__init__.py +4 -0
  28. ya_agent_platform-0.58.3/ya_agent_platform/db/base.py +7 -0
  29. ya_agent_platform-0.58.3/ya_agent_platform/db/engine.py +25 -0
  30. ya_agent_platform-0.58.3/ya_agent_platform/db/tables.py +9 -0
  31. ya_agent_platform-0.58.3/ya_agent_platform/redis.py +7 -0
@@ -0,0 +1,153 @@
1
+ docs/source
2
+
3
+ # From https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
4
+
5
+ # Byte-compiled / optimized / DLL files
6
+ __pycache__/
7
+ *.py[cod]
8
+ *$py.class
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ .pybuilder/
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
90
+ __pypackages__/
91
+
92
+ # Celery stuff
93
+ celerybeat-schedule
94
+ celerybeat.pid
95
+
96
+ # SageMath parsed files
97
+ *.sage.py
98
+
99
+ # Environments
100
+ .env
101
+ .venv
102
+ env/
103
+ venv/
104
+ ENV/
105
+ env.bak/
106
+ venv.bak/
107
+
108
+ # Spyder project settings
109
+ .spyderproject
110
+ .spyproject
111
+
112
+ # Rope project settings
113
+ .ropeproject
114
+
115
+ # mkdocs documentation
116
+ /site
117
+
118
+ # mypy
119
+ .mypy_cache/
120
+ .pyright/
121
+ .dmypy.json
122
+ dmypy.json
123
+
124
+ # Pyre type checker
125
+ .pyre/
126
+
127
+ # pytype static type analyzer
128
+ .pytype/
129
+
130
+ # Cython debug symbols
131
+ cython_debug/
132
+
133
+ # Vscode config files
134
+ # .vscode/
135
+
136
+ # PyCharm
137
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
138
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
139
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
140
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
141
+ #.idea/
142
+
143
+ TO-DO.json
144
+ dev/
145
+ ya_agent_sdk/sandbox/shell/templates/public
146
+
147
+ # Sync automaticlly
148
+ yaacli/yaacli/skills/building-agents
149
+
150
+ # Frontend
151
+ node_modules/
152
+ apps/*/dist/
153
+ *.tsbuildinfo
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.4
2
+ Name: ya-agent-platform
3
+ Version: 0.58.3
4
+ Summary: Cloud-ready agent platform built on top of ya-agent-sdk
5
+ Project-URL: Repository, https://github.com/wh1isper/ya-mono
6
+ Author-email: wh1isper <jizhongsheng957@gmail.com>
7
+ Keywords: agent-platform,ai-agent,fastapi,python
8
+ Classifier: Framework :: FastAPI
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Requires-Python: <3.14,>=3.11
17
+ Requires-Dist: alembic>=1.16.0
18
+ Requires-Dist: click>=8.0
19
+ Requires-Dist: fastapi>=0.116.0
20
+ Requires-Dist: psycopg[binary]>=3.2.0
21
+ Requires-Dist: pydantic-settings>=2.0.0
22
+ Requires-Dist: pydantic>=2.12.0
23
+ Requires-Dist: redis[hiredis]>=6.0.0
24
+ Requires-Dist: sqlalchemy>=2.0.0
25
+ Requires-Dist: sse-starlette>=3.0.0
26
+ Requires-Dist: uvicorn[standard]>=0.35.0
27
+ Requires-Dist: ya-agent-sdk[all]==0.58.3
28
+ Description-Content-Type: text/markdown
29
+
30
+ # YA Agent Platform
31
+
32
+ Cloud-ready agent platform package for the `ya-mono` workspace.
33
+
34
+ ## Scope
35
+
36
+ This package initializes the backend service for a complete agent platform:
37
+
38
+ - management API for platform and workspace administration
39
+ - chat-facing API for first-party Chat UI
40
+ - bridge-facing API surface for IM connectors
41
+ - runtime integration points for `ya-agent-sdk`
42
+ - persistence scaffold with PostgreSQL, Redis, packaged Alembic migrations, and startup auto-migration
43
+ - specification documents that define the target architecture before full implementation
44
+
45
+ ## Current Layout
46
+
47
+ ```text
48
+ packages/ya-agent-platform/
49
+ ├── README.md
50
+ ├── infra/
51
+ │ ├── dev.env
52
+ │ └── docker-compose.dev.yml
53
+ ├── pyproject.toml
54
+ ├── spec/
55
+ ├── start.sh
56
+ ├── tests/
57
+ └── ya_agent_platform/
58
+ ├── alembic/
59
+ ├── alembic.ini
60
+ ├── api/
61
+ ├── app.py
62
+ ├── cli.py
63
+ ├── config.py
64
+ ├── db/
65
+ └── redis.py
66
+ ```
67
+
68
+ ## Quick Start
69
+
70
+ From the workspace root:
71
+
72
+ ```bash
73
+ uv sync --all-packages
74
+ make platform-infra-up
75
+ set -a && source packages/ya-agent-platform/infra/dev.env && set +a
76
+ uv run --package ya-agent-platform ya-agent-platform serve --reload
77
+ ```
78
+
79
+ The development server listens on `http://127.0.0.1:9042` by default.
80
+
81
+ ## Database and Redis Commands
82
+
83
+ Use the package CLI directly:
84
+
85
+ ```bash
86
+ uv run --package ya-agent-platform ya-agent-platform migrate
87
+ uv run --package ya-agent-platform ya-agent-platform db current
88
+ uv run --package ya-agent-platform ya-agent-platform db history
89
+ uv run --package ya-agent-platform ya-agent-platform db migrate "add workspace tables"
90
+ ```
91
+
92
+ Use the workspace Makefile wrappers:
93
+
94
+ ```bash
95
+ make platform-db-upgrade
96
+ make platform-db-current
97
+ make platform-db-history
98
+ make platform-db-migrate MSG="add workspace tables"
99
+ ```
100
+
101
+ ## Auto Migration
102
+
103
+ `YA_PLATFORM_AUTO_MIGRATE=true` is the default behavior.
104
+
105
+ - `ya-agent-platform serve` applies migrations before boot when `YA_PLATFORM_DATABASE_URL` is configured
106
+ - `ya-agent-platform migrate` runs migrations separately
107
+ - `start.sh` applies migrations before starting the server in container environments
108
+
109
+ ## Development Infrastructure
110
+
111
+ The dev compose file starts PostgreSQL and Redis:
112
+
113
+ ```bash
114
+ make platform-infra-up
115
+ make platform-infra-status
116
+ make platform-infra-down
117
+ ```
118
+
119
+ Default development URLs live in `packages/ya-agent-platform/infra/dev.env`.
120
+
121
+ ## Combined Docker Image
122
+
123
+ The repository root `Dockerfile` builds a single production image that contains:
124
+
125
+ - the `ya-agent-platform` backend
126
+ - the bundled `ya-agent-platform-web` frontend
127
+ - FastAPI static serving for the built web assets
128
+ - startup auto-migration support through `packages/ya-agent-platform/start.sh`
129
+
130
+ Build locally from the repository root:
131
+
132
+ ```bash
133
+ docker build -t ya-agent-platform:dev .
134
+ ```
135
+
136
+ Run locally:
137
+
138
+ ```bash
139
+ docker run --rm -p 9042:9042 ya-agent-platform:dev
140
+ ```
141
+
142
+ The container serves the combined application on `http://127.0.0.1:9042`.
143
+
144
+ ## Initial API Surface
145
+
146
+ - `GET /healthz` — service health probe with postgres and redis component status
147
+ - `GET /api/v1/platform/info` — platform metadata and enabled surfaces
148
+ - `GET /api/v1/platform/topology` — high-level component topology for the UI and tooling
149
+
150
+ ## Specification Set
151
+
152
+ - [`spec/README.md`](spec/README.md)
153
+ - [`spec/000-platform-overview.md`](spec/000-platform-overview.md)
154
+ - [`spec/001-system-architecture.md`](spec/001-system-architecture.md)
155
+ - [`spec/002-bridge-contract.md`](spec/002-bridge-contract.md)
156
+ - [`spec/003-http-api.md`](spec/003-http-api.md)
157
+
158
+ ## Next Build Phase
159
+
160
+ 1. add persistence models and first migrations
161
+ 2. add runtime orchestration and worker execution
162
+ 3. add bridge registry and delivery guarantees
163
+ 4. connect the web app to live platform endpoints
@@ -0,0 +1,134 @@
1
+ # YA Agent Platform
2
+
3
+ Cloud-ready agent platform package for the `ya-mono` workspace.
4
+
5
+ ## Scope
6
+
7
+ This package initializes the backend service for a complete agent platform:
8
+
9
+ - management API for platform and workspace administration
10
+ - chat-facing API for first-party Chat UI
11
+ - bridge-facing API surface for IM connectors
12
+ - runtime integration points for `ya-agent-sdk`
13
+ - persistence scaffold with PostgreSQL, Redis, packaged Alembic migrations, and startup auto-migration
14
+ - specification documents that define the target architecture before full implementation
15
+
16
+ ## Current Layout
17
+
18
+ ```text
19
+ packages/ya-agent-platform/
20
+ ├── README.md
21
+ ├── infra/
22
+ │ ├── dev.env
23
+ │ └── docker-compose.dev.yml
24
+ ├── pyproject.toml
25
+ ├── spec/
26
+ ├── start.sh
27
+ ├── tests/
28
+ └── ya_agent_platform/
29
+ ├── alembic/
30
+ ├── alembic.ini
31
+ ├── api/
32
+ ├── app.py
33
+ ├── cli.py
34
+ ├── config.py
35
+ ├── db/
36
+ └── redis.py
37
+ ```
38
+
39
+ ## Quick Start
40
+
41
+ From the workspace root:
42
+
43
+ ```bash
44
+ uv sync --all-packages
45
+ make platform-infra-up
46
+ set -a && source packages/ya-agent-platform/infra/dev.env && set +a
47
+ uv run --package ya-agent-platform ya-agent-platform serve --reload
48
+ ```
49
+
50
+ The development server listens on `http://127.0.0.1:9042` by default.
51
+
52
+ ## Database and Redis Commands
53
+
54
+ Use the package CLI directly:
55
+
56
+ ```bash
57
+ uv run --package ya-agent-platform ya-agent-platform migrate
58
+ uv run --package ya-agent-platform ya-agent-platform db current
59
+ uv run --package ya-agent-platform ya-agent-platform db history
60
+ uv run --package ya-agent-platform ya-agent-platform db migrate "add workspace tables"
61
+ ```
62
+
63
+ Use the workspace Makefile wrappers:
64
+
65
+ ```bash
66
+ make platform-db-upgrade
67
+ make platform-db-current
68
+ make platform-db-history
69
+ make platform-db-migrate MSG="add workspace tables"
70
+ ```
71
+
72
+ ## Auto Migration
73
+
74
+ `YA_PLATFORM_AUTO_MIGRATE=true` is the default behavior.
75
+
76
+ - `ya-agent-platform serve` applies migrations before boot when `YA_PLATFORM_DATABASE_URL` is configured
77
+ - `ya-agent-platform migrate` runs migrations separately
78
+ - `start.sh` applies migrations before starting the server in container environments
79
+
80
+ ## Development Infrastructure
81
+
82
+ The dev compose file starts PostgreSQL and Redis:
83
+
84
+ ```bash
85
+ make platform-infra-up
86
+ make platform-infra-status
87
+ make platform-infra-down
88
+ ```
89
+
90
+ Default development URLs live in `packages/ya-agent-platform/infra/dev.env`.
91
+
92
+ ## Combined Docker Image
93
+
94
+ The repository root `Dockerfile` builds a single production image that contains:
95
+
96
+ - the `ya-agent-platform` backend
97
+ - the bundled `ya-agent-platform-web` frontend
98
+ - FastAPI static serving for the built web assets
99
+ - startup auto-migration support through `packages/ya-agent-platform/start.sh`
100
+
101
+ Build locally from the repository root:
102
+
103
+ ```bash
104
+ docker build -t ya-agent-platform:dev .
105
+ ```
106
+
107
+ Run locally:
108
+
109
+ ```bash
110
+ docker run --rm -p 9042:9042 ya-agent-platform:dev
111
+ ```
112
+
113
+ The container serves the combined application on `http://127.0.0.1:9042`.
114
+
115
+ ## Initial API Surface
116
+
117
+ - `GET /healthz` — service health probe with postgres and redis component status
118
+ - `GET /api/v1/platform/info` — platform metadata and enabled surfaces
119
+ - `GET /api/v1/platform/topology` — high-level component topology for the UI and tooling
120
+
121
+ ## Specification Set
122
+
123
+ - [`spec/README.md`](spec/README.md)
124
+ - [`spec/000-platform-overview.md`](spec/000-platform-overview.md)
125
+ - [`spec/001-system-architecture.md`](spec/001-system-architecture.md)
126
+ - [`spec/002-bridge-contract.md`](spec/002-bridge-contract.md)
127
+ - [`spec/003-http-api.md`](spec/003-http-api.md)
128
+
129
+ ## Next Build Phase
130
+
131
+ 1. add persistence models and first migrations
132
+ 2. add runtime orchestration and worker execution
133
+ 3. add bridge registry and delivery guarantees
134
+ 4. connect the web app to live platform endpoints
@@ -0,0 +1,7 @@
1
+ # YA Agent Platform dev environment variables
2
+ # Source this file or pass to your shell: set -a && source packages/ya-agent-platform/infra/dev.env && set +a
3
+
4
+ YA_PLATFORM_DATABASE_URL=postgresql+psycopg://ya_platform:ya_platform@localhost:15433/ya_platform
5
+ YA_PLATFORM_REDIS_URL=redis://localhost:16380/0
6
+ YA_PLATFORM_AUTO_MIGRATE=true
7
+ YA_PLATFORM_RELOAD=true
@@ -0,0 +1,34 @@
1
+ services:
2
+ postgres:
3
+ image: postgres:17
4
+ container_name: ya-agent-platform-postgres
5
+ environment:
6
+ POSTGRES_USER: ya_platform
7
+ POSTGRES_PASSWORD: ya_platform
8
+ POSTGRES_DB: ya_platform
9
+ ports:
10
+ - "15433:5432"
11
+ volumes:
12
+ - ya-agent-platform-pgdata:/var/lib/postgresql/data
13
+ healthcheck:
14
+ test: ["CMD-SHELL", "pg_isready -U ya_platform -d ya_platform"]
15
+ interval: 5s
16
+ timeout: 3s
17
+ retries: 10
18
+
19
+ redis:
20
+ image: redis:7
21
+ container_name: ya-agent-platform-redis
22
+ ports:
23
+ - "16380:6379"
24
+ volumes:
25
+ - ya-agent-platform-redisdata:/data
26
+ healthcheck:
27
+ test: ["CMD", "redis-cli", "ping"]
28
+ interval: 5s
29
+ timeout: 3s
30
+ retries: 10
31
+
32
+ volumes:
33
+ ya-agent-platform-pgdata:
34
+ ya-agent-platform-redisdata:
@@ -0,0 +1,78 @@
1
+ [project]
2
+ name = "ya-agent-platform"
3
+ dynamic = ["version", "dependencies"]
4
+ description = "Cloud-ready agent platform built on top of ya-agent-sdk"
5
+ authors = [{ name = "wh1isper", email = "jizhongsheng957@gmail.com" }]
6
+ readme = "README.md"
7
+ keywords = ["python", "fastapi", "agent-platform", "ai-agent"]
8
+ requires-python = ">=3.11,<3.14"
9
+ classifiers = [
10
+ "Intended Audience :: Developers",
11
+ "Programming Language :: Python",
12
+ "Programming Language :: Python :: 3",
13
+ "Programming Language :: Python :: 3.11",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Programming Language :: Python :: 3.13",
16
+ "Framework :: FastAPI",
17
+ "Topic :: Software Development :: Libraries :: Python Modules",
18
+ ]
19
+
20
+ [project.urls]
21
+ Repository = "https://github.com/wh1isper/ya-mono"
22
+
23
+ [project.scripts]
24
+ ya-agent-platform = "ya_agent_platform.cli:cli"
25
+
26
+ [build-system]
27
+ requires = ["hatchling", "uv-dynamic-versioning>=0.7.0"]
28
+ build-backend = "hatchling.build"
29
+
30
+ [tool.hatch.version]
31
+ source = "uv-dynamic-versioning"
32
+
33
+ [tool.uv-dynamic-versioning]
34
+ vcs = "git"
35
+ style = "pep440"
36
+ bump = true
37
+
38
+ [tool.hatch.metadata.hooks.uv-dynamic-versioning]
39
+ dependencies = [
40
+ "alembic>=1.16.0",
41
+ "click>=8.0",
42
+ "fastapi>=0.116.0",
43
+ "psycopg[binary]>=3.2.0",
44
+ "pydantic>=2.12.0",
45
+ "pydantic-settings>=2.0.0",
46
+ "redis[hiredis]>=6.0.0",
47
+ "sqlalchemy>=2.0.0",
48
+ "sse-starlette>=3.0.0",
49
+ "uvicorn[standard]>=0.35.0",
50
+ "ya-agent-sdk[all]=={{ version }}",
51
+ ]
52
+
53
+ [tool.hatch.build.targets.wheel]
54
+ packages = ["ya_agent_platform"]
55
+ include = [
56
+ "ya_agent_platform/alembic.ini",
57
+ "ya_agent_platform/alembic/**/*.py",
58
+ "ya_agent_platform/alembic/script.py.mako",
59
+ ]
60
+
61
+ [tool.uv.sources]
62
+ ya-agent-sdk = { workspace = true }
63
+
64
+ [dependency-groups]
65
+ dev = [
66
+ "deptry>=0.22.0",
67
+ "httpx>=0.28.1",
68
+ "pre-commit>=2.20.0",
69
+ "pyright>=1.1.0",
70
+ "pytest>=7.2.0",
71
+ "pytest-asyncio>=0.25.3",
72
+ "ruff>=0.9.2",
73
+ ]
74
+
75
+ [tool.deptry]
76
+ ignore = ["DEP001"]
77
+ package_module_name_map = { "alembic" = "alembic", "click" = "click", "fastapi" = "fastapi", "httpx" = "httpx", "pre-commit" = "pre_commit", "psycopg" = "psycopg", "pydantic" = "pydantic", "pydantic-settings" = "pydantic_settings", "pytest" = "pytest", "pytest-asyncio" = "pytest_asyncio", "pyright" = "pyright", "redis" = "redis", "ruff" = "ruff", "sqlalchemy" = "sqlalchemy", "sse-starlette" = "sse_starlette", "uvicorn" = "uvicorn", "ya-agent-sdk" = "ya_agent_sdk" }
78
+ per_rule_ignores = { DEP003 = ["alembic", "click", "fastapi", "psycopg", "pydantic", "pydantic_settings", "redis", "sqlalchemy", "uvicorn", "ya_agent_sdk", "ya_agent_platform"], DEP004 = ["pytest"] }
@@ -0,0 +1,86 @@
1
+ # 000 Platform Overview
2
+
3
+ ## Goal
4
+
5
+ `ya-agent-platform` is a cloud-ready agent platform built on top of `ya-agent-sdk`.
6
+ It turns the SDK runtime model into an operated product surface with administration,
7
+ chat delivery, and external bridge integration.
8
+
9
+ ## Why This Exists
10
+
11
+ Netherbrain proved the core interaction loop:
12
+
13
+ - persistent runtime
14
+ - web chat
15
+ - IM integration
16
+
17
+ The next platform iteration targets stronger cloud assumptions:
18
+
19
+ - multiple first-party surfaces instead of a single embedded UI
20
+ - normalized bridge contracts instead of per-channel coupling
21
+ - clearer control plane and execution plane boundaries
22
+ - deployment topology that scales past homelab assumptions
23
+
24
+ ## Product Surfaces
25
+
26
+ 1. **Management Portal**
27
+ - manage workspaces, agents, presets, bridges, credentials, and policies
28
+ 2. **Chat UI**
29
+ - first-party browser interface for end users and operators
30
+ 3. **IM Bridges**
31
+ - adapters for Discord, Telegram, Slack, WeCom, email, and future channels
32
+ 4. **Runtime APIs**
33
+ - programmatic entry points for sessions, events, streaming, and tooling
34
+
35
+ ## Core Design Principles
36
+
37
+ - keep the runtime contract compatible with `ya-agent-sdk`
38
+ - separate control-plane concerns from conversation delivery
39
+ - normalize ingress and egress through a shared bridge event model
40
+ - prefer stateless edge adapters and durable central orchestration
41
+ - write the spec before expanding implementation breadth
42
+
43
+ ## Initial Domain Language
44
+
45
+ | Term | Meaning |
46
+ | ------------- | ------------------------------------------------------------------------ |
47
+ | Workspace | Top-level tenant or project boundary |
48
+ | Agent Profile | Reusable agent configuration and capability bundle |
49
+ | Session | Long-lived conversation state anchored to a workspace and agent |
50
+ | Surface | First-party interaction entry such as admin or chat |
51
+ | Bridge | Adapter that converts an external system into normalized platform events |
52
+ | Delivery | A single inbound or outbound message exchange across a surface or bridge |
53
+
54
+ ## System Context
55
+
56
+ ```mermaid
57
+ flowchart LR
58
+ Operator[Operator] --> Admin[Management Portal]
59
+ User[End User] --> ChatUI[Chat UI]
60
+ ExternalIM[External IM Systems] --> Bridges[IM Bridges]
61
+ Admin --> Platform[YA Agent Platform]
62
+ ChatUI --> Platform
63
+ Bridges --> Platform
64
+ Platform --> Runtime[ya-agent-sdk Runtime]
65
+ Platform --> Data[(Postgres / Redis / Object Storage)]
66
+ ```
67
+
68
+ ## Phase 1 Scope
69
+
70
+ Phase 1 establishes:
71
+
72
+ - backend service skeleton and local run path
73
+ - frontend shell for management and chat surfaces
74
+ - platform terminology and boundaries
75
+ - bridge protocol draft
76
+ - first HTTP API draft
77
+
78
+ ## Phase 2 Scope
79
+
80
+ Phase 2 adds:
81
+
82
+ - persistence model
83
+ - authn and authz model
84
+ - session orchestration
85
+ - streaming transport
86
+ - first real bridge implementation