mana-ciel 0.2.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 (94) hide show
  1. mana_ciel-0.2.0/LICENSE +1 -0
  2. mana_ciel-0.2.0/PKG-INFO +206 -0
  3. mana_ciel-0.2.0/README.md +152 -0
  4. mana_ciel-0.2.0/pyproject.toml +72 -0
  5. mana_ciel-0.2.0/setup.cfg +4 -0
  6. mana_ciel-0.2.0/src/ciel/__init__.py +10 -0
  7. mana_ciel-0.2.0/src/ciel/acp/__init__.py +280 -0
  8. mana_ciel-0.2.0/src/ciel/adapters/__init__.py +219 -0
  9. mana_ciel-0.2.0/src/ciel/cli/__init__.py +5 -0
  10. mana_ciel-0.2.0/src/ciel/cli/board.py +106 -0
  11. mana_ciel-0.2.0/src/ciel/cli/chat.py +132 -0
  12. mana_ciel-0.2.0/src/ciel/cli/cost.py +88 -0
  13. mana_ciel-0.2.0/src/ciel/cli/flow.py +209 -0
  14. mana_ciel-0.2.0/src/ciel/cli/graph.py +238 -0
  15. mana_ciel-0.2.0/src/ciel/cli/loop.py +186 -0
  16. mana_ciel-0.2.0/src/ciel/cli/main.py +348 -0
  17. mana_ciel-0.2.0/src/ciel/cli/rbac.py +68 -0
  18. mana_ciel-0.2.0/src/ciel/cli/root.py +132 -0
  19. mana_ciel-0.2.0/src/ciel/cli/swarm.py +99 -0
  20. mana_ciel-0.2.0/src/ciel/common/__init__.py +42 -0
  21. mana_ciel-0.2.0/src/ciel/config.py +272 -0
  22. mana_ciel-0.2.0/src/ciel/credentials/__init__.py +287 -0
  23. mana_ciel-0.2.0/src/ciel/enterprise/__init__.py +63 -0
  24. mana_ciel-0.2.0/src/ciel/enterprise/audit.py +173 -0
  25. mana_ciel-0.2.0/src/ciel/enterprise/cost.py +124 -0
  26. mana_ciel-0.2.0/src/ciel/enterprise/ratelimit.py +124 -0
  27. mana_ciel-0.2.0/src/ciel/enterprise/rbac.py +167 -0
  28. mana_ciel-0.2.0/src/ciel/enterprise/secrets.py +156 -0
  29. mana_ciel-0.2.0/src/ciel/gateway/__init__.py +221 -0
  30. mana_ciel-0.2.0/src/ciel/gateway/adapter.py +160 -0
  31. mana_ciel-0.2.0/src/ciel/gateway/adapter_slack.py +187 -0
  32. mana_ciel-0.2.0/src/ciel/gateway/auth.py +109 -0
  33. mana_ciel-0.2.0/src/ciel/gateway/base.py +365 -0
  34. mana_ciel-0.2.0/src/ciel/gateway/mcp/__init__.py +20 -0
  35. mana_ciel-0.2.0/src/ciel/gateway/mcp/client.py +84 -0
  36. mana_ciel-0.2.0/src/ciel/gateway/mcp/integration.py +106 -0
  37. mana_ciel-0.2.0/src/ciel/gateway/mcp/server.py +122 -0
  38. mana_ciel-0.2.0/src/ciel/gateway/mcp/transports.py +69 -0
  39. mana_ciel-0.2.0/src/ciel/gateway/messaging.py +180 -0
  40. mana_ciel-0.2.0/src/ciel/gateway/server.py +189 -0
  41. mana_ciel-0.2.0/src/ciel/observability/__init__.py +195 -0
  42. mana_ciel-0.2.0/src/ciel/observability/metrics.py +152 -0
  43. mana_ciel-0.2.0/src/ciel/observability/otel.py +257 -0
  44. mana_ciel-0.2.0/src/ciel/orchestration/__init__.py +168 -0
  45. mana_ciel-0.2.0/src/ciel/orchestration/agent.py +464 -0
  46. mana_ciel-0.2.0/src/ciel/orchestration/board.py +207 -0
  47. mana_ciel-0.2.0/src/ciel/orchestration/budget.py +51 -0
  48. mana_ciel-0.2.0/src/ciel/orchestration/chat.py +222 -0
  49. mana_ciel-0.2.0/src/ciel/orchestration/flows.py +315 -0
  50. mana_ciel-0.2.0/src/ciel/orchestration/graph.py +570 -0
  51. mana_ciel-0.2.0/src/ciel/orchestration/queue.py +140 -0
  52. mana_ciel-0.2.0/src/ciel/orchestration/root.py +261 -0
  53. mana_ciel-0.2.0/src/ciel/orchestration/session.py +170 -0
  54. mana_ciel-0.2.0/src/ciel/orchestration/supervisor.py +109 -0
  55. mana_ciel-0.2.0/src/ciel/orchestration/topology.py +97 -0
  56. mana_ciel-0.2.0/src/ciel/providers/__init__.py +306 -0
  57. mana_ciel-0.2.0/src/ciel/runtime/__init__.py +395 -0
  58. mana_ciel-0.2.0/src/ciel/runtime/agent.py +197 -0
  59. mana_ciel-0.2.0/src/ciel/runtime/checkpoints.py +192 -0
  60. mana_ciel-0.2.0/src/ciel/runtime/compression.py +57 -0
  61. mana_ciel-0.2.0/src/ciel/runtime/context.py +113 -0
  62. mana_ciel-0.2.0/src/ciel/runtime/context_compression.py +64 -0
  63. mana_ciel-0.2.0/src/ciel/runtime/memory.py +220 -0
  64. mana_ciel-0.2.0/src/ciel/runtime/skills.py +99 -0
  65. mana_ciel-0.2.0/src/ciel/runtime/tools.py +404 -0
  66. mana_ciel-0.2.0/src/ciel/sandbox/__init__.py +73 -0
  67. mana_ciel-0.2.0/src/ciel/security/__init__.py +88 -0
  68. mana_ciel-0.2.0/src/ciel/security/approvals.py +150 -0
  69. mana_ciel-0.2.0/src/ciel/security/redaction.py +54 -0
  70. mana_ciel-0.2.0/src/mana_ciel.egg-info/PKG-INFO +206 -0
  71. mana_ciel-0.2.0/src/mana_ciel.egg-info/SOURCES.txt +92 -0
  72. mana_ciel-0.2.0/src/mana_ciel.egg-info/dependency_links.txt +1 -0
  73. mana_ciel-0.2.0/src/mana_ciel.egg-info/entry_points.txt +2 -0
  74. mana_ciel-0.2.0/src/mana_ciel.egg-info/requires.txt +42 -0
  75. mana_ciel-0.2.0/src/mana_ciel.egg-info/top_level.txt +1 -0
  76. mana_ciel-0.2.0/tests/test_agent_fase6_test.py +418 -0
  77. mana_ciel-0.2.0/tests/test_audit_fase7_test.py +150 -0
  78. mana_ciel-0.2.0/tests/test_board_persistence.py +93 -0
  79. mana_ciel-0.2.0/tests/test_chat_fase5_test.py +249 -0
  80. mana_ciel-0.2.0/tests/test_cost_fase7_test.py +88 -0
  81. mana_ciel-0.2.0/tests/test_fase8_adapters_test.py +313 -0
  82. mana_ciel-0.2.0/tests/test_fase8_hil_otel_test.py +341 -0
  83. mana_ciel-0.2.0/tests/test_flows_fase5_test.py +252 -0
  84. mana_ciel-0.2.0/tests/test_graph_fase5_test.py +286 -0
  85. mana_ciel-0.2.0/tests/test_observability_test.py +132 -0
  86. mana_ciel-0.2.0/tests/test_ratelimit_fase7_test.py +85 -0
  87. mana_ciel-0.2.0/tests/test_rbac_fase7_test.py +92 -0
  88. mana_ciel-0.2.0/tests/test_root_fase5_test.py +227 -0
  89. mana_ciel-0.2.0/tests/test_root_session_fase5_test.py +237 -0
  90. mana_ciel-0.2.0/tests/test_secrets_fase7_test.py +117 -0
  91. mana_ciel-0.2.0/tests/test_session_fase5_test.py +211 -0
  92. mana_ciel-0.2.0/tests/test_slack_adapter_test.py +149 -0
  93. mana_ciel-0.2.0/tests/test_streaming_test.py +206 -0
  94. mana_ciel-0.2.0/tests/test_toolcalls_integration_test.py +154 -0
@@ -0,0 +1 @@
1
+ [GNU Affero General Public License v3.0](./LICENSE)
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.4
2
+ Name: mana-ciel
3
+ Version: 0.2.0
4
+ Summary: Ciel Agent Framework - Enterprise multi-agent harness, model-agnostic, deploy-agnostic
5
+ Author: Ciel Agent Framework Authors
6
+ License: AGPL-3.0-or-later
7
+ Project-URL: Homepage, https://github.com/Ander-Labs/ciel-agent-framework
8
+ Project-URL: Repository, https://github.com/Ander-Labs/ciel-agent-framework
9
+ Project-URL: Issues, https://github.com/Ander-Labs/ciel-agent-framework/issues
10
+ Project-URL: Changelog, https://github.com/Ander-Labs/ciel-agent-framework/blob/main/CHANGELOG.md
11
+ Keywords: agent,harness,multi-agent,orchestration,llm,enterprise
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: pydantic>=2.6
20
+ Requires-Dist: pyyaml>=6.0
21
+ Requires-Dist: sqlalchemy>=2.0
22
+ Requires-Dist: aiofiles>=23.2
23
+ Requires-Dist: httpx>=0.27
24
+ Requires-Dist: tenacity>=9.0
25
+ Requires-Dist: rich>=13.7
26
+ Requires-Dist: typer>=0.12
27
+ Requires-Dist: croniter>=5.0
28
+ Requires-Dist: python-dotenv>=1.0
29
+ Requires-Dist: uv>=0.5
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8; extra == "dev"
32
+ Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
33
+ Provides-Extra: docs
34
+ Requires-Dist: mkdocs-material; extra == "docs"
35
+ Requires-Dist: mkdocstrings[python]; extra == "docs"
36
+ Provides-Extra: acp
37
+ Requires-Dist: fastapi>=0.112; extra == "acp"
38
+ Requires-Dist: uvicorn>=0.30; extra == "acp"
39
+ Provides-Extra: gateway
40
+ Requires-Dist: fastapi>=0.112; extra == "gateway"
41
+ Requires-Dist: uvicorn>=0.30; extra == "gateway"
42
+ Requires-Dist: mcp>=1.2; extra == "gateway"
43
+ Provides-Extra: security
44
+ Requires-Dist: python-dotenv>=1.0; extra == "security"
45
+ Provides-Extra: observability
46
+ Requires-Dist: opentelemetry-api>=1.20; extra == "observability"
47
+ Requires-Dist: opentelemetry-sdk>=1.20; extra == "observability"
48
+ Requires-Dist: prometheus-client>=0.20; extra == "observability"
49
+ Provides-Extra: messaging
50
+ Requires-Dist: slack-sdk>=3.27; extra == "messaging"
51
+ Provides-Extra: board
52
+ Requires-Dist: sqlalchemy>=2.0; extra == "board"
53
+ Dynamic: license-file
54
+
55
+ # Ciel Agent Framework
56
+
57
+ Enterprise-grade framework to build model-agnostic, deploy-agnostic autonomous agents and multi-agent systems with harness-first principles.
58
+
59
+ ## Packages
60
+
61
+ | Package | Purpose |
62
+ |---|---|
63
+ | `ciel` | Public SDK, CLI entrypoint |
64
+ | `ciel.providers` | Model provider interface + adapters |
65
+ | `ciel.runtime` | Agent runtime, tooling, memory, skills |
66
+ | `ciel.orchestration` | Multi-agent orchestration, durable state, supervisor |
67
+ | `ciel.gateway` | Platform adapters, messaging gateway |
68
+ | `ciel.security` | Approvals, secret redaction, PII scrubber, sandbox |
69
+ | `ciel.observability` | Traces, logs, metrics, audit |
70
+ | `ciel.entorno` | Execution backends: local, docker, ssh, processpool |
71
+ | `ciel.acp` | ACP server for IDE integrations |
72
+
73
+ ## Installation
74
+
75
+ ```bash
76
+ pip install mana-ciel # PyPI distribution name
77
+ # or, with uv:
78
+ uv pip install mana-ciel
79
+ ```
80
+
81
+ The import name stays `ciel`; the CLI command is `ciel`:
82
+
83
+ ```bash
84
+ ciel --help
85
+ ```
86
+
87
+ > Note: the PyPI package is named **mana-ciel** (the name `ciel` was already taken
88
+ > on PyPI). You still `import ciel` and run `ciel` — only the install name differs.
89
+
90
+ ## Requirements
91
+
92
+ - Python >= 3.11
93
+ - Package manager/distribution: **uv** (recommended) or pip
94
+
95
+ ## Example
96
+
97
+ End-to-end offline demo: `examples/end_to_end.py`
98
+
99
+ ```bash
100
+ uv run examples/end_to_end.py
101
+ ```
102
+
103
+ Covers:
104
+ - wiring 3 tools through `ciel.runtime.tools`
105
+ - running `DefaultAgentRuntime`
106
+ - persisting state with `MemoryStore`
107
+ - checkpoint/restore with `CheckpointStore`
108
+
109
+ ## Status
110
+
111
+ ### Fase 1 — Runtime básico: ✅ Cerrada
112
+ - `ciel.providers` OpenAI-compatible y Anthropic
113
+ - runtime agent loop con tool_calls
114
+ - tool registry/schema/dispatcher
115
+ - memoria SQLite + FTS5
116
+ - skills markdown + frontmatter
117
+ - checkpoint store
118
+ - project context discovery y render
119
+ - context compression head/tail/rewrite
120
+ - CLI: `ciel run`, `ciel chat -q`, `ciel compression`, `ciel checkpoints` y `ciel info`
121
+
122
+ ### Fase 2 — Gobierno enterprise: ✅ Cerrada
123
+ - políticas de approval (manual / smart / yolo) y redacción integradas al runtime
124
+ - redacción de secretos + PII scrubber
125
+ - auditoría JSONL por session/tenant, traces por tool call
126
+ - multi-tenancy en providers/sinks y validación explícita de `tenant_id`
127
+ - credential pools, rotación, sandbox de ejecución
128
+
129
+ ### Fase 3 — Multiagente durable: ✅ Cerrada
130
+ - orquestación durable por spec YAML (`AgentSpec`/`AgentStep`), supervisor con budget/rate-limit y topologías pipeline/fan-out/debate
131
+ - `KanbanBoard` con filtros por status, assignee y tenant; métricas e índices
132
+ - `DurableQueue` SQLite WAL
133
+ - CLI: `ciel swarm run`, `ciel board add/list/show/assign`
134
+
135
+ ### Fase 4 — Superficies y despliegue: ✅ Cerrada
136
+ - `ciel serve` (FastAPI compuesta: control gateway + host MCP `/mcp` + router webhook), offline-safe con echo provider
137
+ - `ciel.gateway.mcp` (cliente/servidor), `ciel.acp` (IDE)
138
+ - Dockerfile multi-stage (uv), `docker-compose.yml`, Helm chart `deploy/helm/ciel`
139
+ - `deploy/example-enterprise`, docs SDK públicas
140
+ - release v0.1.0 (wheels + CHANGELOG)
141
+
142
+ ### Fase 5 — Orquestación best-of-breed: ✅ Cerrada (`graph`, `flows`, `chat`, `root`, `session` entregados)
143
+ ADK.sub_agents + LangGraph + AutoGen.GroupChat + CrewAI.Flows.
144
+
145
+ Entregado en esta sesión:
146
+ - `ciel.orchestration.graph`: grafo de estado explícito (nodes/edges/estado) con checkpoint + reanudación/time-travel estilo LangGraph, montado sobre el `Supervisor` existente (hereda retry/timeout/budget).
147
+ - `ciel.orchestration.flows` (CrewAI.Flows): flows event-driven con `add_start`/`add_listen`/`add_router`/`add_branch`, estado mutable compartido y `resume` de long-running tras interrupción, sobre `Supervisor`.
148
+ - `ciel.orchestration.chat` (AutoGen.GroupChat): `GroupChat` + `GroupChatManager` multi-agente conversable, modelo-agnóstico y OFFLINE-SAFE (participantes = funciones locales sobre el transcripto; soporta `max_rounds`, `selector`, `terminate_keyword`, `terminate_if`).
149
+ - `ciel.orchestration.root` (ADK.sub_agents): `RootAgent` con ROUTING a `Specialist` agents sobre `Supervisor` (`router(prompt) -> nombre | None`, con `root_handler` de respaldo).
150
+ - `ciel.cli.graph`: `ciel graph demo|run|resume` (offline-safe).
151
+ - `ciel.cli.flow`: `ciel flow run|resume` (offline-safe, checkpointer opcional).
152
+ - `ciel.cli.chat`: `ciel chat group` (demo offline de 3 agentes que converge con TERMINATE).
153
+ - Checkpoint stores (`Graph`/`Flow`/`GroupChat`/`Root`) persisten sobre `MemoryStore` (multitenancy nativo).
154
+ - `ciel.orchestration.session` (ADK.session_state): `SessionStore` — session state persistente por tenant entre turnos, sobre `MemoryStore` (keys namespaced `session:`), con `append_turn`/`history`, `save_state`/`load_state`, `link_board_task`/`board_links` (integración board+session) y `list_sessions`.
155
+ - `ciel.RootRunner.route(prompt, *, session_id, session_store, tenant_id)` mantiene el historial de turnos entre invocaciones (rehidrata `RootState.history`).
156
+ - `ciel.cli.root`: `ciel root route <prompt>` (offline-safe, demo con 2 specialists + root handler; opciones `--db`/`--session-id`/`--tenant` para session state persistente).
157
+ - Tests de Fase 5: 37 tests verdes (graph 6, flows 6, chat 7, root 7, session 6, root+session 5).
158
+
159
+ Verificación actual: `uv run pytest tests/` → 153 passed, 1 skipped. `uv run ciel graph demo`, `uv run ciel flow run`, `uv run ciel chat group` y `uv run ciel root route` ejecutan offline.
160
+
161
+ ### Fase 6 — Agencia autónoma en bucle: ✅ Cerrada (`agent` entregado)
162
+ AutoGen/ADK: `EventLoop` durable + `AutonomousAgent` sobre `Supervisor` y `SessionStore`.
163
+
164
+ Entregado en esta sesión:
165
+ - `ciel.orchestration.agent` (AutoGen/ADK): agencia autónoma en bucle montada SOBRE `Supervisor` (cada intento de tarea hereda retry/timeout/budget) y SOBRE `SessionStore` (estado por tenant).
166
+ - `Task`: unidad de trabajo durable (`goal`, `payload`, `status`, `attempts`, `result`, `error`) con `snapshot()`/`from_snapshot()` y `mark_running()`/`mark_succeeded()`/`mark_failed()`.
167
+ - `EventLoop`: bucle durable con reintentos exponenciales (backoff `base_delay_s * 2^(n-1)` capped). `run(task, handler, *, run_id)` ejecuta con reintentos y persiste checkpoint tras cada intento; `resume(run_id, handler)` rehidrata desde `MemoryStore` y continúa, completando la tarea tras reinicio (criterio Fase 6). Idempotente si el checkpoint ya está `succeeded`/`failed`.
168
+ - `EventLoopCheckpointStore`: persistencia del estado del loop sobre `MemoryStore` (clave `loop:<run_id>`, multitenancy nativo).
169
+ - `AutonomousAgent`: orquestador de nivel superior; `run_goal(goal, handler, *, plan=None)` descompone el objetivo en tareas y las ejecuta vía `EventLoop`, persistiendo turnos de session por tenant.
170
+ - `ciel.cli.loop`: `ciel loop run <goal>` (offline-safe, handler echo local; `--run-id`/`--db`/`--tenant`/`--session-id`) y `ciel loop resume --run-id <id> --db <db>` (reanuda tras reinicio).
171
+ - Tests de Fase 6: batería verde en `tests/test_agent_fase6_test.py`.
172
+
173
+ Verificación actual: `uv run pytest tests/` → 153 + N passed, 1 skipped. `uv run ciel loop run "..." --db /tmp/l.sqlite3 --tenant t1` y `uv run ciel loop resume --run-id <id> --db /tmp/l.sqlite3` ejecutan offline.
174
+
175
+ ### Fase 7 — Enterprise duro: ✅ Cerrada (`enterprise` entregado)
176
+ RBAC/OIDC, audit inmutable, cost governance, secrets, rate-limit transversal.
177
+
178
+ Entregado en esta sesión:
179
+ - `ciel.enterprise` (OFFLINE-SAFE, sin dependencias duras): paquete de enterprise duro.
180
+ - `ciel.enterprise.rbac`: `RBACEngine` (roles admin/operator/viewer; permisos con comodín `category:*`; orden tenant>global>denegado) + `OIDCVerifier` (JWT local, `OIDC_AVAILABLE` por detección de PyJWT). Excepciones `RBACError`, `FeatureUnavailable`.
181
+ - `ciel.enterprise.audit`: `HashChainAuditSink(JsonlAuditSink)` — audit INMUTABLE (append-only hash-chained SHA-256); `verify()` detecta alteración; `last_hash()` para encadenar.
182
+ - `ciel.enterprise.cost`: `CostGovernor` (presupuesto por modelo/tenant, alertas y corte) — `estimate`/`record`/`spent`/`budget_of`/`remaining`/`allowed`/`check_budget` (lanza `BudgetExceededError`) / `alerted`. Capa transversal (no acopla al `Supervisor`).
183
+ - `ciel.enterprise.secrets`: `SecretStore` con backends pluggable por prioridad — `EnvSecretBackend`, `KubernetesSecretBackend` (OFFLINE-SAFE), `VaultSecretBackend` (requiere `hvac`; degrada a `FeatureUnavailable` si falta). `get`/`require` (lanza `SecretError`).
184
+ - `ciel.enterprise.ratelimit`: `TenantRateLimiter` — cuotas transversales por tenant/usuario con ventana deslizante en memoria; `check`/`consume` (lanza `RateLimitError`) / `reset` / `remaining`.
185
+ - `ciel rbac` / `ciel cost`: CLI offline-safe (Typer + Rich). `ciel rbac check|assign|list-roles`; `ciel cost record|status|check`.
186
+ - Tests de Fase 7: 29 tests verdes (rbac 7, audit 5, cost 6, secrets 5, ratelimit 6).
187
+
188
+ Verificación actual: `uv run pytest tests/` → 194 passed, 1 skipped. `uv run ciel rbac list-roles` y `uv run ciel cost status --tenant t1` ejecutan offline.
189
+
190
+ ### Fase 8 — Deploy HA + observabilidad + madurez: 🔄 EN PROGRESO
191
+ Helm HA, OTel centralizado, adapters de canal y HIL en grafo ya entregados y verificados por smoke test; tests formales, runbooks y release v0.2.0 en curso.
192
+
193
+ Entregado en esta sesión:
194
+ - **Helm HA**: chart `deploy/helm/ciel` con `replicaCount: 2`, `PodDisruptionBudget` (minAvailable 1), `HorizontalPodAutoscaler` (2–10 réplicas), `podAntiAffinity` y `topologySpreadConstraints`.
195
+ - **OTel centralizado** (`ciel.observability.otel`): `init_tracing(*, otlp_endpoint)` (OTLP o in-memory offline-safe), `current_tracer()`, `span_count()` (corregido para opentelemetry-sdk 1.x). Comando `ciel observe` y flag `--otel`/`--otel-endpoint` en `ciel serve`.
196
+ - **Adapters de canal** (`ciel.adapters`): `TeamsAdapter`, `DiscordAdapter`, `WebUIAdapter` + `FakeAdapter` (offline-safe).
197
+ - **Routers de gateway** (`ciel.gateway.messaging`): `create_teams_webhook_router`, `create_discord_webhook_router`, `create_webui_router`, montados en `ciel serve`.
198
+ - **Human-in-the-loop (HIL)** en `ciel.orchestration.graph`: `GraphNode.require_approval`, `GraphRunner.approve()`/`deny()` con chequeo RBAC (`approve:*`). Pausa y reanuda tras aprobación de rol autorizado.
199
+ - **Runbooks** (`docs/runbooks/`): deploy, incidente, rollback, backup de audit/board, escalado HPA.
200
+
201
+ Verificación actual (smoke): `ciel observe` confirma exporter; grafo con `require_approval` pausa y reanuda tras `approve:*`; tests formales de Fase 8 en curso (`test_fase8_hil_otel_test.py`, `test_fase8_adapters_test.py`).
202
+
203
+ ## License
204
+
205
+ - Core framework: **AGPL-3.0-or-later**
206
+ - Commercial dual license available for regulated deployments.
@@ -0,0 +1,152 @@
1
+ # Ciel Agent Framework
2
+
3
+ Enterprise-grade framework to build model-agnostic, deploy-agnostic autonomous agents and multi-agent systems with harness-first principles.
4
+
5
+ ## Packages
6
+
7
+ | Package | Purpose |
8
+ |---|---|
9
+ | `ciel` | Public SDK, CLI entrypoint |
10
+ | `ciel.providers` | Model provider interface + adapters |
11
+ | `ciel.runtime` | Agent runtime, tooling, memory, skills |
12
+ | `ciel.orchestration` | Multi-agent orchestration, durable state, supervisor |
13
+ | `ciel.gateway` | Platform adapters, messaging gateway |
14
+ | `ciel.security` | Approvals, secret redaction, PII scrubber, sandbox |
15
+ | `ciel.observability` | Traces, logs, metrics, audit |
16
+ | `ciel.entorno` | Execution backends: local, docker, ssh, processpool |
17
+ | `ciel.acp` | ACP server for IDE integrations |
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pip install mana-ciel # PyPI distribution name
23
+ # or, with uv:
24
+ uv pip install mana-ciel
25
+ ```
26
+
27
+ The import name stays `ciel`; the CLI command is `ciel`:
28
+
29
+ ```bash
30
+ ciel --help
31
+ ```
32
+
33
+ > Note: the PyPI package is named **mana-ciel** (the name `ciel` was already taken
34
+ > on PyPI). You still `import ciel` and run `ciel` — only the install name differs.
35
+
36
+ ## Requirements
37
+
38
+ - Python >= 3.11
39
+ - Package manager/distribution: **uv** (recommended) or pip
40
+
41
+ ## Example
42
+
43
+ End-to-end offline demo: `examples/end_to_end.py`
44
+
45
+ ```bash
46
+ uv run examples/end_to_end.py
47
+ ```
48
+
49
+ Covers:
50
+ - wiring 3 tools through `ciel.runtime.tools`
51
+ - running `DefaultAgentRuntime`
52
+ - persisting state with `MemoryStore`
53
+ - checkpoint/restore with `CheckpointStore`
54
+
55
+ ## Status
56
+
57
+ ### Fase 1 — Runtime básico: ✅ Cerrada
58
+ - `ciel.providers` OpenAI-compatible y Anthropic
59
+ - runtime agent loop con tool_calls
60
+ - tool registry/schema/dispatcher
61
+ - memoria SQLite + FTS5
62
+ - skills markdown + frontmatter
63
+ - checkpoint store
64
+ - project context discovery y render
65
+ - context compression head/tail/rewrite
66
+ - CLI: `ciel run`, `ciel chat -q`, `ciel compression`, `ciel checkpoints` y `ciel info`
67
+
68
+ ### Fase 2 — Gobierno enterprise: ✅ Cerrada
69
+ - políticas de approval (manual / smart / yolo) y redacción integradas al runtime
70
+ - redacción de secretos + PII scrubber
71
+ - auditoría JSONL por session/tenant, traces por tool call
72
+ - multi-tenancy en providers/sinks y validación explícita de `tenant_id`
73
+ - credential pools, rotación, sandbox de ejecución
74
+
75
+ ### Fase 3 — Multiagente durable: ✅ Cerrada
76
+ - orquestación durable por spec YAML (`AgentSpec`/`AgentStep`), supervisor con budget/rate-limit y topologías pipeline/fan-out/debate
77
+ - `KanbanBoard` con filtros por status, assignee y tenant; métricas e índices
78
+ - `DurableQueue` SQLite WAL
79
+ - CLI: `ciel swarm run`, `ciel board add/list/show/assign`
80
+
81
+ ### Fase 4 — Superficies y despliegue: ✅ Cerrada
82
+ - `ciel serve` (FastAPI compuesta: control gateway + host MCP `/mcp` + router webhook), offline-safe con echo provider
83
+ - `ciel.gateway.mcp` (cliente/servidor), `ciel.acp` (IDE)
84
+ - Dockerfile multi-stage (uv), `docker-compose.yml`, Helm chart `deploy/helm/ciel`
85
+ - `deploy/example-enterprise`, docs SDK públicas
86
+ - release v0.1.0 (wheels + CHANGELOG)
87
+
88
+ ### Fase 5 — Orquestación best-of-breed: ✅ Cerrada (`graph`, `flows`, `chat`, `root`, `session` entregados)
89
+ ADK.sub_agents + LangGraph + AutoGen.GroupChat + CrewAI.Flows.
90
+
91
+ Entregado en esta sesión:
92
+ - `ciel.orchestration.graph`: grafo de estado explícito (nodes/edges/estado) con checkpoint + reanudación/time-travel estilo LangGraph, montado sobre el `Supervisor` existente (hereda retry/timeout/budget).
93
+ - `ciel.orchestration.flows` (CrewAI.Flows): flows event-driven con `add_start`/`add_listen`/`add_router`/`add_branch`, estado mutable compartido y `resume` de long-running tras interrupción, sobre `Supervisor`.
94
+ - `ciel.orchestration.chat` (AutoGen.GroupChat): `GroupChat` + `GroupChatManager` multi-agente conversable, modelo-agnóstico y OFFLINE-SAFE (participantes = funciones locales sobre el transcripto; soporta `max_rounds`, `selector`, `terminate_keyword`, `terminate_if`).
95
+ - `ciel.orchestration.root` (ADK.sub_agents): `RootAgent` con ROUTING a `Specialist` agents sobre `Supervisor` (`router(prompt) -> nombre | None`, con `root_handler` de respaldo).
96
+ - `ciel.cli.graph`: `ciel graph demo|run|resume` (offline-safe).
97
+ - `ciel.cli.flow`: `ciel flow run|resume` (offline-safe, checkpointer opcional).
98
+ - `ciel.cli.chat`: `ciel chat group` (demo offline de 3 agentes que converge con TERMINATE).
99
+ - Checkpoint stores (`Graph`/`Flow`/`GroupChat`/`Root`) persisten sobre `MemoryStore` (multitenancy nativo).
100
+ - `ciel.orchestration.session` (ADK.session_state): `SessionStore` — session state persistente por tenant entre turnos, sobre `MemoryStore` (keys namespaced `session:`), con `append_turn`/`history`, `save_state`/`load_state`, `link_board_task`/`board_links` (integración board+session) y `list_sessions`.
101
+ - `ciel.RootRunner.route(prompt, *, session_id, session_store, tenant_id)` mantiene el historial de turnos entre invocaciones (rehidrata `RootState.history`).
102
+ - `ciel.cli.root`: `ciel root route <prompt>` (offline-safe, demo con 2 specialists + root handler; opciones `--db`/`--session-id`/`--tenant` para session state persistente).
103
+ - Tests de Fase 5: 37 tests verdes (graph 6, flows 6, chat 7, root 7, session 6, root+session 5).
104
+
105
+ Verificación actual: `uv run pytest tests/` → 153 passed, 1 skipped. `uv run ciel graph demo`, `uv run ciel flow run`, `uv run ciel chat group` y `uv run ciel root route` ejecutan offline.
106
+
107
+ ### Fase 6 — Agencia autónoma en bucle: ✅ Cerrada (`agent` entregado)
108
+ AutoGen/ADK: `EventLoop` durable + `AutonomousAgent` sobre `Supervisor` y `SessionStore`.
109
+
110
+ Entregado en esta sesión:
111
+ - `ciel.orchestration.agent` (AutoGen/ADK): agencia autónoma en bucle montada SOBRE `Supervisor` (cada intento de tarea hereda retry/timeout/budget) y SOBRE `SessionStore` (estado por tenant).
112
+ - `Task`: unidad de trabajo durable (`goal`, `payload`, `status`, `attempts`, `result`, `error`) con `snapshot()`/`from_snapshot()` y `mark_running()`/`mark_succeeded()`/`mark_failed()`.
113
+ - `EventLoop`: bucle durable con reintentos exponenciales (backoff `base_delay_s * 2^(n-1)` capped). `run(task, handler, *, run_id)` ejecuta con reintentos y persiste checkpoint tras cada intento; `resume(run_id, handler)` rehidrata desde `MemoryStore` y continúa, completando la tarea tras reinicio (criterio Fase 6). Idempotente si el checkpoint ya está `succeeded`/`failed`.
114
+ - `EventLoopCheckpointStore`: persistencia del estado del loop sobre `MemoryStore` (clave `loop:<run_id>`, multitenancy nativo).
115
+ - `AutonomousAgent`: orquestador de nivel superior; `run_goal(goal, handler, *, plan=None)` descompone el objetivo en tareas y las ejecuta vía `EventLoop`, persistiendo turnos de session por tenant.
116
+ - `ciel.cli.loop`: `ciel loop run <goal>` (offline-safe, handler echo local; `--run-id`/`--db`/`--tenant`/`--session-id`) y `ciel loop resume --run-id <id> --db <db>` (reanuda tras reinicio).
117
+ - Tests de Fase 6: batería verde en `tests/test_agent_fase6_test.py`.
118
+
119
+ Verificación actual: `uv run pytest tests/` → 153 + N passed, 1 skipped. `uv run ciel loop run "..." --db /tmp/l.sqlite3 --tenant t1` y `uv run ciel loop resume --run-id <id> --db /tmp/l.sqlite3` ejecutan offline.
120
+
121
+ ### Fase 7 — Enterprise duro: ✅ Cerrada (`enterprise` entregado)
122
+ RBAC/OIDC, audit inmutable, cost governance, secrets, rate-limit transversal.
123
+
124
+ Entregado en esta sesión:
125
+ - `ciel.enterprise` (OFFLINE-SAFE, sin dependencias duras): paquete de enterprise duro.
126
+ - `ciel.enterprise.rbac`: `RBACEngine` (roles admin/operator/viewer; permisos con comodín `category:*`; orden tenant>global>denegado) + `OIDCVerifier` (JWT local, `OIDC_AVAILABLE` por detección de PyJWT). Excepciones `RBACError`, `FeatureUnavailable`.
127
+ - `ciel.enterprise.audit`: `HashChainAuditSink(JsonlAuditSink)` — audit INMUTABLE (append-only hash-chained SHA-256); `verify()` detecta alteración; `last_hash()` para encadenar.
128
+ - `ciel.enterprise.cost`: `CostGovernor` (presupuesto por modelo/tenant, alertas y corte) — `estimate`/`record`/`spent`/`budget_of`/`remaining`/`allowed`/`check_budget` (lanza `BudgetExceededError`) / `alerted`. Capa transversal (no acopla al `Supervisor`).
129
+ - `ciel.enterprise.secrets`: `SecretStore` con backends pluggable por prioridad — `EnvSecretBackend`, `KubernetesSecretBackend` (OFFLINE-SAFE), `VaultSecretBackend` (requiere `hvac`; degrada a `FeatureUnavailable` si falta). `get`/`require` (lanza `SecretError`).
130
+ - `ciel.enterprise.ratelimit`: `TenantRateLimiter` — cuotas transversales por tenant/usuario con ventana deslizante en memoria; `check`/`consume` (lanza `RateLimitError`) / `reset` / `remaining`.
131
+ - `ciel rbac` / `ciel cost`: CLI offline-safe (Typer + Rich). `ciel rbac check|assign|list-roles`; `ciel cost record|status|check`.
132
+ - Tests de Fase 7: 29 tests verdes (rbac 7, audit 5, cost 6, secrets 5, ratelimit 6).
133
+
134
+ Verificación actual: `uv run pytest tests/` → 194 passed, 1 skipped. `uv run ciel rbac list-roles` y `uv run ciel cost status --tenant t1` ejecutan offline.
135
+
136
+ ### Fase 8 — Deploy HA + observabilidad + madurez: 🔄 EN PROGRESO
137
+ Helm HA, OTel centralizado, adapters de canal y HIL en grafo ya entregados y verificados por smoke test; tests formales, runbooks y release v0.2.0 en curso.
138
+
139
+ Entregado en esta sesión:
140
+ - **Helm HA**: chart `deploy/helm/ciel` con `replicaCount: 2`, `PodDisruptionBudget` (minAvailable 1), `HorizontalPodAutoscaler` (2–10 réplicas), `podAntiAffinity` y `topologySpreadConstraints`.
141
+ - **OTel centralizado** (`ciel.observability.otel`): `init_tracing(*, otlp_endpoint)` (OTLP o in-memory offline-safe), `current_tracer()`, `span_count()` (corregido para opentelemetry-sdk 1.x). Comando `ciel observe` y flag `--otel`/`--otel-endpoint` en `ciel serve`.
142
+ - **Adapters de canal** (`ciel.adapters`): `TeamsAdapter`, `DiscordAdapter`, `WebUIAdapter` + `FakeAdapter` (offline-safe).
143
+ - **Routers de gateway** (`ciel.gateway.messaging`): `create_teams_webhook_router`, `create_discord_webhook_router`, `create_webui_router`, montados en `ciel serve`.
144
+ - **Human-in-the-loop (HIL)** en `ciel.orchestration.graph`: `GraphNode.require_approval`, `GraphRunner.approve()`/`deny()` con chequeo RBAC (`approve:*`). Pausa y reanuda tras aprobación de rol autorizado.
145
+ - **Runbooks** (`docs/runbooks/`): deploy, incidente, rollback, backup de audit/board, escalado HPA.
146
+
147
+ Verificación actual (smoke): `ciel observe` confirma exporter; grafo con `require_approval` pausa y reanuda tras `approve:*`; tests formales de Fase 8 en curso (`test_fase8_hil_otel_test.py`, `test_fase8_adapters_test.py`).
148
+
149
+ ## License
150
+
151
+ - Core framework: **AGPL-3.0-or-later**
152
+ - Commercial dual license available for regulated deployments.
@@ -0,0 +1,72 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mana-ciel"
7
+ version = "0.2.0"
8
+ description = "Ciel Agent Framework - Enterprise multi-agent harness, model-agnostic, deploy-agnostic"
9
+ readme = "README.md"
10
+ license = { text = "AGPL-3.0-or-later" }
11
+ requires-python = ">=3.11"
12
+ authors = [
13
+ { name = "Ciel Agent Framework Authors" }
14
+ ]
15
+ keywords = ["agent", "harness", "multi-agent", "orchestration", "llm", "enterprise"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.14",
21
+ ]
22
+
23
+ dependencies = [
24
+ "pydantic>=2.6",
25
+ "pyyaml>=6.0",
26
+ "sqlalchemy>=2.0",
27
+ "aiofiles>=23.2",
28
+ "httpx>=0.27",
29
+ "tenacity>=9.0",
30
+ "rich>=13.7",
31
+ "typer>=0.12",
32
+ "croniter>=5.0",
33
+ "python-dotenv>=1.0",
34
+ "uv>=0.5",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/Ander-Labs/ciel-agent-framework"
39
+ Repository = "https://github.com/Ander-Labs/ciel-agent-framework"
40
+ Issues = "https://github.com/Ander-Labs/ciel-agent-framework/issues"
41
+ Changelog = "https://github.com/Ander-Labs/ciel-agent-framework/blob/main/CHANGELOG.md"
42
+
43
+ [project.optional-dependencies]
44
+ dev = ["pytest>=8", "pytest-asyncio>=0.24"]
45
+ docs = ["mkdocs-material", "mkdocstrings[python]"]
46
+ acp = ["fastapi>=0.112", "uvicorn>=0.30"]
47
+ gateway = ["fastapi>=0.112", "uvicorn>=0.30", "mcp>=1.2"]
48
+ security = ["python-dotenv>=1.0"]
49
+ observability = ["opentelemetry-api>=1.20", "opentelemetry-sdk>=1.20", "prometheus-client>=0.20"]
50
+ messaging = ["slack-sdk>=3.27"]
51
+ board = ["sqlalchemy>=2.0"]
52
+
53
+ [project.scripts]
54
+ ciel = "ciel.cli.main:app"
55
+
56
+ [tool.setuptools.packages.find]
57
+ where = ["src"]
58
+
59
+ [tool.setuptools.package-dir]
60
+ "" = "src"
61
+
62
+ [tool.ruff]
63
+ target-version = "py314"
64
+ line-length = 100
65
+
66
+ [tool.ruff.lint]
67
+ select = ["E", "F", "I", "UP", "B", "SIM"]
68
+ ignore = ["E501", "B008"]
69
+
70
+ [tool.pytest.ini_options]
71
+ testpaths = ["tests"]
72
+ addopts = "-q"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ from importlib.metadata import version as _pkg_version, PackageNotFoundError
2
+
3
+ try:
4
+ __version__ = _pkg_version("ciel")
5
+ except PackageNotFoundError: # pragma: no cover
6
+ __version__ = "0.1.0"
7
+
8
+ from ciel.security import ApprovalPolicy
9
+
10
+ __all__ = ["__version__", "ApprovalPolicy"]