agentic-bus 0.1.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.
Files changed (113) hide show
  1. agentic_bus-0.1.0/.gitignore +31 -0
  2. agentic_bus-0.1.0/CHANGELOG.md +79 -0
  3. agentic_bus-0.1.0/CONTRIBUTING.md +75 -0
  4. agentic_bus-0.1.0/Dockerfile +65 -0
  5. agentic_bus-0.1.0/LICENSE +22 -0
  6. agentic_bus-0.1.0/PKG-INFO +648 -0
  7. agentic_bus-0.1.0/README.md +571 -0
  8. agentic_bus-0.1.0/SECURITY.md +75 -0
  9. agentic_bus-0.1.0/app/__init__.py +1 -0
  10. agentic_bus-0.1.0/app/__main__.py +5 -0
  11. agentic_bus-0.1.0/app/agents/__init__.py +19 -0
  12. agentic_bus-0.1.0/app/agents/base/__init__.py +1 -0
  13. agentic_bus-0.1.0/app/agents/base/agent.py +380 -0
  14. agentic_bus-0.1.0/app/agents/examples/__init__.py +1 -0
  15. agentic_bus-0.1.0/app/agents/examples/intent_client_example.py +429 -0
  16. agentic_bus-0.1.0/app/agents/examples/logistics_agent/__init__.py +9 -0
  17. agentic_bus-0.1.0/app/agents/examples/logistics_agent/agent.py +230 -0
  18. agentic_bus-0.1.0/app/agents/examples/logistics_agent/demo_intent.py +354 -0
  19. agentic_bus-0.1.0/app/agents/examples/logistics_agent/seed_managed_agents.py +526 -0
  20. agentic_bus-0.1.0/app/agents/examples/logistics_agent/test_intent.py +230 -0
  21. agentic_bus-0.1.0/app/agents/factory.py +769 -0
  22. agentic_bus-0.1.0/app/agents/managed_server.py +380 -0
  23. agentic_bus-0.1.0/app/agents/mcp_bridge.py +368 -0
  24. agentic_bus-0.1.0/app/agents/requester.py +554 -0
  25. agentic_bus-0.1.0/app/cli.py +2276 -0
  26. agentic_bus-0.1.0/app/coordinator/__init__.py +1 -0
  27. agentic_bus-0.1.0/app/coordinator/admin/__init__.py +7 -0
  28. agentic_bus-0.1.0/app/coordinator/admin/api.py +1538 -0
  29. agentic_bus-0.1.0/app/coordinator/admin/audit.py +69 -0
  30. agentic_bus-0.1.0/app/coordinator/admin/schemas.py +487 -0
  31. agentic_bus-0.1.0/app/coordinator/admin/serializers.py +365 -0
  32. agentic_bus-0.1.0/app/coordinator/admin/service.py +364 -0
  33. agentic_bus-0.1.0/app/coordinator/execution/__init__.py +1 -0
  34. agentic_bus-0.1.0/app/coordinator/execution/supervisor.py +538 -0
  35. agentic_bus-0.1.0/app/coordinator/graph/__init__.py +1 -0
  36. agentic_bus-0.1.0/app/coordinator/graph/builder.py +174 -0
  37. agentic_bus-0.1.0/app/coordinator/intent/__init__.py +1 -0
  38. agentic_bus-0.1.0/app/coordinator/intent/processor.py +85 -0
  39. agentic_bus-0.1.0/app/coordinator/negotiation/__init__.py +1 -0
  40. agentic_bus-0.1.0/app/coordinator/negotiation/engine.py +341 -0
  41. agentic_bus-0.1.0/app/coordinator/runtime.py +2365 -0
  42. agentic_bus-0.1.0/app/coordinator/server.py +91 -0
  43. agentic_bus-0.1.0/app/coordinator/validation/__init__.py +1 -0
  44. agentic_bus-0.1.0/app/coordinator/validation/engine.py +182 -0
  45. agentic_bus-0.1.0/app/core/__init__.py +1 -0
  46. agentic_bus-0.1.0/app/core/auth/__init__.py +1 -0
  47. agentic_bus-0.1.0/app/core/auth/admin.py +85 -0
  48. agentic_bus-0.1.0/app/core/auth/oidc.py +124 -0
  49. agentic_bus-0.1.0/app/core/ibac/__init__.py +1 -0
  50. agentic_bus-0.1.0/app/core/ibac/engine.py +617 -0
  51. agentic_bus-0.1.0/app/core/llm/__init__.py +34 -0
  52. agentic_bus-0.1.0/app/core/llm/factory.py +269 -0
  53. agentic_bus-0.1.0/app/core/persistence/__init__.py +49 -0
  54. agentic_bus-0.1.0/app/core/persistence/database.py +97 -0
  55. agentic_bus-0.1.0/app/core/persistence/ibac_repository.py +171 -0
  56. agentic_bus-0.1.0/app/core/persistence/llm_repository.py +244 -0
  57. agentic_bus-0.1.0/app/core/persistence/managed_agent_repository.py +456 -0
  58. agentic_bus-0.1.0/app/core/persistence/mcp_server_repository.py +239 -0
  59. agentic_bus-0.1.0/app/core/persistence/models.py +690 -0
  60. agentic_bus-0.1.0/app/core/persistence/repository.py +306 -0
  61. agentic_bus-0.1.0/app/core/persistence/session_archive_repository.py +183 -0
  62. agentic_bus-0.1.0/app/core/persistence/tenant_repository.py +135 -0
  63. agentic_bus-0.1.0/app/core/persistence/user_repository.py +142 -0
  64. agentic_bus-0.1.0/app/core/protocol/__init__.py +1 -0
  65. agentic_bus-0.1.0/app/core/protocol/envelope.py +320 -0
  66. agentic_bus-0.1.0/app/core/protocol/export_schemas.py +149 -0
  67. agentic_bus-0.1.0/app/core/registry/__init__.py +1 -0
  68. agentic_bus-0.1.0/app/core/registry/capability_registry.py +203 -0
  69. agentic_bus-0.1.0/app/core/session/__init__.py +17 -0
  70. agentic_bus-0.1.0/app/core/session/manager.py +167 -0
  71. agentic_bus-0.1.0/app/core/session/memory.py +379 -0
  72. agentic_bus-0.1.0/app/core/telemetry/__init__.py +1 -0
  73. agentic_bus-0.1.0/app/core/telemetry/tracing.py +84 -0
  74. agentic_bus-0.1.0/app/core/transport/__init__.py +1 -0
  75. agentic_bus-0.1.0/app/core/transport/ws.py +201 -0
  76. agentic_bus-0.1.0/docker/coordinator-entrypoint.sh +98 -0
  77. agentic_bus-0.1.0/docker-compose.yml +112 -0
  78. agentic_bus-0.1.0/lip.md +1207 -0
  79. agentic_bus-0.1.0/pyproject.toml +143 -0
  80. agentic_bus-0.1.0/schemas/accept-payload.json +39 -0
  81. agentic_bus-0.1.0/schemas/complete-payload.json +28 -0
  82. agentic_bus-0.1.0/schemas/dissolve-payload.json +15 -0
  83. agentic_bus-0.1.0/schemas/envelope.json +114 -0
  84. agentic_bus-0.1.0/schemas/event-payload.json +61 -0
  85. agentic_bus-0.1.0/schemas/execute-payload.json +22 -0
  86. agentic_bus-0.1.0/schemas/index.json +17 -0
  87. agentic_bus-0.1.0/schemas/intent-payload.json +42 -0
  88. agentic_bus-0.1.0/schemas/offer-payload.json +85 -0
  89. agentic_bus-0.1.0/schemas/reject-payload.json +33 -0
  90. agentic_bus-0.1.0/tests/__init__.py +0 -0
  91. agentic_bus-0.1.0/tests/conftest.py +96 -0
  92. agentic_bus-0.1.0/tests/test_admin.py +264 -0
  93. agentic_bus-0.1.0/tests/test_agent_stats.py +244 -0
  94. agentic_bus-0.1.0/tests/test_auth.py +21 -0
  95. agentic_bus-0.1.0/tests/test_cli.py +568 -0
  96. agentic_bus-0.1.0/tests/test_execution_supervisor.py +390 -0
  97. agentic_bus-0.1.0/tests/test_graph.py +102 -0
  98. agentic_bus-0.1.0/tests/test_ibac.py +124 -0
  99. agentic_bus-0.1.0/tests/test_ibac_rules.py +700 -0
  100. agentic_bus-0.1.0/tests/test_intent_client.py +479 -0
  101. agentic_bus-0.1.0/tests/test_llm_config.py +181 -0
  102. agentic_bus-0.1.0/tests/test_llm_factory.py +150 -0
  103. agentic_bus-0.1.0/tests/test_managed_agents.py +658 -0
  104. agentic_bus-0.1.0/tests/test_mcp_bridge.py +370 -0
  105. agentic_bus-0.1.0/tests/test_negotiation.py +150 -0
  106. agentic_bus-0.1.0/tests/test_persistence.py +297 -0
  107. agentic_bus-0.1.0/tests/test_protocol.py +203 -0
  108. agentic_bus-0.1.0/tests/test_registry.py +136 -0
  109. agentic_bus-0.1.0/tests/test_session.py +60 -0
  110. agentic_bus-0.1.0/tests/test_session_memory.py +459 -0
  111. agentic_bus-0.1.0/tests/test_telemetry.py +26 -0
  112. agentic_bus-0.1.0/tests/test_tenants_users.py +252 -0
  113. agentic_bus-0.1.0/tests/test_validation.py +743 -0
@@ -0,0 +1,31 @@
1
+ # SQLite
2
+ *.db
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.pyc
7
+ *.pyo
8
+ *.egg-info/
9
+ dist/
10
+ build/
11
+ .eggs/
12
+
13
+ # Virtual environments
14
+ .venv/
15
+ venv/
16
+
17
+ # IDE
18
+ .vscode/
19
+ .idea/
20
+
21
+ # Environment (contains secrets – never commit)
22
+ .env
23
+
24
+ # Test / coverage
25
+ .pytest_cache/
26
+ htmlcov/
27
+ .coverage
28
+
29
+ # OS
30
+ .DS_Store
31
+ Thumbs.db
@@ -0,0 +1,79 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ The **protocol** version (`LIP_PROTOCOL_VERSION`) is versioned separately
8
+ from this package; protocol changes are called out explicitly below.
9
+
10
+ ## [Unreleased]
11
+
12
+ ### Added
13
+
14
+ - **`docker compose up` runs the whole stack with no API keys**: a local
15
+ model (Ollama), the coordinator with the paper's four logistics agents
16
+ seeded and running, and the dashboard on `:3000`. Previously the only way
17
+ to see the bus run was a clone, two dependency installs, an LLM provider
18
+ key, an interactive wizard and three manual processes.
19
+ - `[agents]`, `[mcp]` and `[all]` install extras. `crewai`/`crewai-tools`
20
+ (managed agents) and `langchain-mcp-adapters` (MCP bridge) were used at
21
+ runtime but declared nowhere, so `pip install agentic-bus` succeeded and
22
+ then failed with a bare `ModuleNotFoundError` the first time you used
23
+ either feature.
24
+ - `GET /health` — an unauthenticated, dependency-free liveness probe for
25
+ container orchestrators. Reports the serving status and LIP protocol
26
+ version; deliberately touches no database or LLM.
27
+ - A release workflow publishing to PyPI on a `v*` tag via Trusted Publishing
28
+ (no stored API token), gated on the tag matching `pyproject.toml`.
29
+ - A CI job that builds both Docker images, validates the compose file, and
30
+ asserts the lazily-imported extras are importable in the image.
31
+ - `protocol_version` on every message envelope (LIP `0.1.0`). Envelopes from
32
+ pre-versioning peers are read as `0.1.0`, so the change is backwards
33
+ compatible on the wire.
34
+ - Generated JSON Schemas for the envelope and every payload under `schemas/`,
35
+ produced by `python -m app.core.protocol.export_schemas`. CI fails if they
36
+ drift from the Pydantic models.
37
+ - `LICENSE` (MIT). The README and package metadata claimed MIT, but no
38
+ licence text was ever committed — until now the code was, strictly,
39
+ all rights reserved.
40
+ - Continuous integration: ruff, the test suite on Python 3.11/3.12/3.13, the
41
+ protocol schema check, and the dashboard build.
42
+ - `CONTRIBUTING.md`, `SECURITY.md`, `CHANGELOG.md`, and issue/PR templates.
43
+ - `SECURITY.md` documents the known limitations of LLM-evaluated IBAC.
44
+
45
+ ### Changed
46
+
47
+ - `agbus agent list` rejects an unknown `--status` instead of reporting an
48
+ empty result, which made a typo indistinguishable from "no agents".
49
+ - Package metadata now describes the project as the reference implementation
50
+ of the **Liquid Interfaces Protocol**, with homepage, repository, spec and
51
+ paper URLs for PyPI.
52
+ - Code comments that referred to "the Agentic Bus paper" now name the
53
+ Liquid Interfaces paper (`lip.md`) consistently.
54
+
55
+ ### Fixed
56
+
57
+ - The source distribution no longer ships the dashboard's `node_modules`.
58
+ Hatchling's default sdist sweeps the project directory and honours only the
59
+ *root* `.gitignore`, while `node_modules` is ignored by `ui/.gitignore` —
60
+ so the archive was 86 MB across 25,741 files, over PyPI's 100 MB per-file
61
+ limit. Now 243 KB across 113 files.
62
+ - The Swagger UI was documented at `/docs`; it is served at `/api/docs`.
63
+ - The README logo used a relative path, which does not render on PyPI where
64
+ the README becomes the project description.
65
+ - `resolve_tools` no longer aborts agent creation when an optional tool's
66
+ dependency chain fails to import. Only `ValueError` and `ImportError` were
67
+ caught, so an incompatible transitive dependency surfacing as
68
+ `AttributeError` took down the whole agent instead of skipping one tool.
69
+ - The test suite is hermetic. It previously inherited the developer's `.env`
70
+ through `load_dotenv(find_dotenv(usecwd=True))` at import time and shared
71
+ the host database, so 19 tests passed locally and failed on a clean
72
+ checkout. Every test now gets a scrubbed environment and its own migrated
73
+ database (`tests/conftest.py`).
74
+ - The install-wizard tests could hang the run indefinitely: a drifted answer
75
+ list fell through to the final "Start the coordinator server now?" prompt,
76
+ which defaults to *yes*, and booted a real coordinator. Exhausting the
77
+ answers now raises instead.
78
+ - Test assertions that still expected LLM settings in `.env` now assert
79
+ against the database, where the wizard has been writing them.
@@ -0,0 +1,75 @@
1
+ # Contributing to Agentic Bus
2
+
3
+ Agentic Bus is the reference implementation of the **Liquid Interfaces
4
+ Protocol (LIP)**. Protocol changes belong in the
5
+ [specification repository](https://github.com/draiven-io/liquid-interfaces);
6
+ runtime behaviour, the SDK, the dashboard and the CLI belong here.
7
+
8
+ ## Getting set up
9
+
10
+ ```bash
11
+ pip install -e ".[dev]"
12
+ ```
13
+
14
+ ```bash
15
+ pytest -q
16
+ ```
17
+
18
+ The suite is **hermetic**: it ignores your `.env`, needs no API keys, and
19
+ never touches the network. If a test needs configuration, it provides its
20
+ own — see `tests/conftest.py`. A test that only passes on your machine is a
21
+ bug in the test.
22
+
23
+ Lint before pushing:
24
+
25
+ ```bash
26
+ ruff check .
27
+ ```
28
+
29
+ ## Protocol changes
30
+
31
+ The wire format is defined by the Pydantic models in
32
+ `app/core/protocol/envelope.py`, and the JSON Schemas under `schemas/` are
33
+ **generated from them**:
34
+
35
+ ```bash
36
+ python -m app.core.protocol.export_schemas
37
+ ```
38
+
39
+ CI fails if the committed schemas drift from the models, so regenerate and
40
+ commit them in the same change. Anything that alters the wire format also
41
+ needs:
42
+
43
+ - a bump to `LIP_PROTOCOL_VERSION` (patch for editorial, minor for
44
+ backwards-compatible additions, major for anything that breaks an existing
45
+ implementation);
46
+ - a matching RFC in the specification repository.
47
+
48
+ Adding an optional field is a minor bump. Renaming or removing one, changing
49
+ a type, or adding a required field is a major bump — no exceptions, because
50
+ implementations in other languages have no way to discover the change
51
+ otherwise.
52
+
53
+ ## Pull requests
54
+
55
+ - Branch from `main`; keep one logical change per PR.
56
+ - Every behavioural change needs a test that fails without it.
57
+ - Update `CHANGELOG.md` under `## [Unreleased]`.
58
+ - CI must be green: lint, tests on Python 3.11/3.12/3.13, schema check, UI build.
59
+
60
+ ## Reporting bugs
61
+
62
+ Open an issue using the bug template. A reproduction — the intent text, the
63
+ registered agents, and the session transcript — is worth more than a
64
+ description, because most coordination failures depend on what the model
65
+ returned during negotiation.
66
+
67
+ For anything security-related, do **not** open an issue. See
68
+ [SECURITY.md](SECURITY.md).
69
+
70
+ ## Code style
71
+
72
+ Match the surrounding code. The codebase favours explicit docstrings that
73
+ explain *why* a component exists and cite the relevant section of the paper
74
+ (`lip.md`) where one applies. Keep that convention: this is a reference
75
+ implementation, and the code is read as documentation of the protocol.
@@ -0,0 +1,65 @@
1
+ # Agentic Bus coordinator — WebSocket bus (8765) + Admin REST API (8766).
2
+ #
3
+ # Built with the [agents] extra so the coordinator can run the CrewAI-backed
4
+ # managed agents it auto-starts on boot, and [mcp] so MCP servers registered
5
+ # through the dashboard can be bridged onto the bus.
6
+
7
+ FROM python:3.12-slim AS builder
8
+
9
+ # Building crewai's dependency tree needs a compiler for a few sdists.
10
+ RUN apt-get update \
11
+ && apt-get install -y --no-install-recommends build-essential \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ WORKDIR /build
15
+
16
+ # Install into an isolated prefix that the runtime stage copies wholesale,
17
+ # leaving the toolchain behind.
18
+ ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
19
+
20
+ # LICENSE is required at build time: pyproject.toml declares
21
+ # `license = { file = "LICENSE" }`, and hatchling reads it to fill in the
22
+ # package metadata.
23
+ COPY pyproject.toml README.md LICENSE ./
24
+ COPY app ./app
25
+
26
+ RUN pip install --prefix=/install ".[agents,mcp]"
27
+
28
+
29
+ FROM python:3.12-slim AS runtime
30
+
31
+ LABEL org.opencontainers.image.title="Agentic Bus" \
32
+ org.opencontainers.image.description="Reference implementation of the Liquid Interfaces Protocol" \
33
+ org.opencontainers.image.source="https://github.com/draiven-io/agentic-bus" \
34
+ org.opencontainers.image.licenses="MIT"
35
+
36
+ # curl is used by the compose healthcheck.
37
+ RUN apt-get update \
38
+ && apt-get install -y --no-install-recommends curl \
39
+ && rm -rf /var/lib/apt/lists/*
40
+
41
+ COPY --from=builder /install /usr/local
42
+
43
+ # The database lives on a volume; the app writes nothing else at runtime.
44
+ RUN useradd --create-home --uid 10001 agbus \
45
+ && mkdir -p /data \
46
+ && chown agbus:agbus /data
47
+
48
+ WORKDIR /app
49
+ COPY --chown=agbus:agbus app ./app
50
+ COPY --chown=agbus:agbus docker/coordinator-entrypoint.sh /usr/local/bin/coordinator-entrypoint.sh
51
+ RUN chmod +x /usr/local/bin/coordinator-entrypoint.sh
52
+
53
+ USER agbus
54
+
55
+ ENV AGBUS_HOST=0.0.0.0 \
56
+ AGBUS_PORT=8765 \
57
+ AGBUS_API_PORT=8766 \
58
+ AGBUS_DATABASE_URL=sqlite:////data/agbus.db \
59
+ PYTHONUNBUFFERED=1
60
+
61
+ # 8765 = LIP WebSocket transport, 8766 = admin REST API.
62
+ EXPOSE 8765 8766
63
+
64
+ ENTRYPOINT ["coordinator-entrypoint.sh"]
65
+ CMD ["agbus", "serve"]
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dhiogo José Correa de Sá, Carlos Pereira Lopes Filho,
4
+ Carlos Eduardo Schmiedel, and the Agentic Bus contributors
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.