|
| 1 | +--- |
| 2 | +title: Taurus Development Guide |
| 3 | +--- |
| 4 | + |
| 5 | +This guide is for contributors working on Taurus itself. |
| 6 | +It documents how Taurus is structured, how execution flows through the runtime, and how to run and test changes locally. |
| 7 | + |
| 8 | +## What Taurus Does |
| 9 | + |
| 10 | +Taurus is the execution runtime in the CodeZero execution block. |
| 11 | + |
| 12 | +- Consumes flow execution requests from NATS (`execution.*`) |
| 13 | +- Executes flow graphs via `taurus-core::runtime::engine::ExecutionEngine` |
| 14 | +- Emits lifecycle events to NATS (`runtime.emitter.<execution_id>`) |
| 15 | +- Delegates remote nodes to external services over NATS (`action.<service>.<execution_id>`) |
| 16 | +- Reports runtime status and usage to Aquila in dynamic mode |
| 17 | + |
| 18 | +## Workspace Layout |
| 19 | + |
| 20 | +| Path | Purpose | |
| 21 | +| --- | --- | |
| 22 | +| `crates/taurus` | Main runtime binary (startup, config, NATS worker, dynamic integrations) | |
| 23 | +| `crates/taurus-core` | Execution engine, compiler, runtime functions, errors, tracing | |
| 24 | +| `crates/taurus-provider` | Transport adapters (NATS emitter + NATS remote runtime) | |
| 25 | +| `crates/taurus-manual` | Manual CLI executor for running a single validation flow file | |
| 26 | +| `crates/taurus-tests` | Local execution-suite runner for JSON flow fixtures under `flows/` | |
| 27 | +| `flows/` | Example/validation flow cases used by `taurus-tests` | |
| 28 | + |
| 29 | +## Runtime Flow |
| 30 | + |
| 31 | +```mermaid |
| 32 | +graph TD |
| 33 | + NATS[NATS] |
| 34 | + Taurus[Taurus Runtime\ncrates/taurus] |
| 35 | + Core[ExecutionEngine\ncrates/taurus-core] |
| 36 | + Emitter[Runtime Emitter\ncrates/taurus-provider] |
| 37 | + Remote[Remote Runtime Adapter\ncrates/taurus-provider] |
| 38 | + Service[Remote Service / Action Runtime] |
| 39 | + Aquila[Aquila gRPC APIs\n(dynamic mode only)] |
| 40 | +
|
| 41 | + NATS -->|execution.*| Taurus |
| 42 | + Taurus --> Core |
| 43 | + Core --> Emitter |
| 44 | + Emitter -->|runtime.emitter.<execution_id>| NATS |
| 45 | + Core --> Remote |
| 46 | + Remote -->|action.<service>.<execution_id>| NATS |
| 47 | + NATS --> Service |
| 48 | + Taurus -->|runtime status + usage| Aquila |
| 49 | +``` |
| 50 | + |
| 51 | +### Execution details |
| 52 | + |
| 53 | +1. Taurus subscribes to queue subject `execution.*` with queue group `taurus`. |
| 54 | +2. Incoming payload is decoded as `tucana::shared::ExecutionFlow`. |
| 55 | +3. `ExecutionEngine::execute_flow_with_execution_id(...)` compiles and executes nodes. |
| 56 | +4. Local nodes run handlers from the built-in function registry. |
| 57 | +5. Non-local `definition_source` values are executed remotely via `RemoteRuntime`. |
| 58 | +6. Lifecycle events are emitted as `starting`, `ongoing`, `finished`, or `failed`. |
| 59 | + |
| 60 | +## Runtime Modes |
| 61 | + |
| 62 | +Taurus mode is controlled by `MODE`. |
| 63 | + |
| 64 | +### `dynamic` |
| 65 | + |
| 66 | +`dynamic` enables control-plane integrations: |
| 67 | + |
| 68 | +- Sends definitions to Aquila (retry loop until success) |
| 69 | +- Starts runtime status reporting (including heartbeat) |
| 70 | +- Sends runtime usage updates after each flow run |
| 71 | + |
| 72 | +### `static` |
| 73 | + |
| 74 | +`static` disables those control-plane interactions. |
| 75 | + |
| 76 | +- Taurus still executes flows from NATS |
| 77 | +- No definition push |
| 78 | +- No runtime status updates |
| 79 | +- No runtime usage updates |
| 80 | + |
| 81 | +## Environment Variables |
| 82 | + |
| 83 | +Defaults are defined in `crates/taurus/src/config/mod.rs`. |
| 84 | + |
| 85 | +| Name | Description | Default | |
| 86 | +| --- | --- | --- | |
| 87 | +| `ENVIRONMENT` | Running env | `development` | |
| 88 | +| `MODE` | Runtime mode (`dynamic` or `static`) | `dynamic` | |
| 89 | +| `NATS_URL` | NATS connection URL | `nats://localhost:4222` | |
| 90 | +| `AQUILA_URL` | Aquila gRPC endpoint (used in dynamic mode) | `http://localhost:50051` | |
| 91 | +| `AQUILA_TOKEN` | Auth token for Aquila runtime APIs | `token` | |
| 92 | +| `WITH_HEALTH_SERVICE` | Enables gRPC health server | `false` | |
| 93 | +| `GRPC_HOST` | Health server host | `127.0.0.1` | |
| 94 | +| `GRPC_PORT` | Health server port | `50051` | |
| 95 | +| `DEFINITIONS` | Path sent to `FlowUpdateService` for definition sync | `./definitions` | |
| 96 | +| `RUNTIME_STATUS_UPDATE_INTERVAL_SECONDS` | Heartbeat interval in dynamic mode (`0` disables heartbeat) | `30` | |
| 97 | + |
| 98 | +## Local Development |
| 99 | + |
| 100 | +### 1. Start dependencies |
| 101 | + |
| 102 | +At minimum, start a reachable NATS instance at `NATS_URL`. |
| 103 | + |
| 104 | +### 2. Configure environment |
| 105 | + |
| 106 | +Create `.env` in the repository root (you can copy from `.env-example` and extend it). |
| 107 | + |
| 108 | +### 3. Run Taurus |
| 109 | + |
| 110 | +```bash |
| 111 | +cargo run -p taurus |
| 112 | +``` |
| 113 | + |
| 114 | +### 4. Run the execution suite |
| 115 | + |
| 116 | +```bash |
| 117 | +cargo run -p tests |
| 118 | +``` |
| 119 | + |
| 120 | +This executes all JSON files in `./flows` and compares runtime outputs. |
| 121 | + |
| 122 | +### 5. Run one flow manually |
| 123 | + |
| 124 | +```bash |
| 125 | +cargo run -p manual -- --path ./flows/01_return_object.json --index 0 --nats-url nats://127.0.0.1:4222 |
| 126 | +``` |
| 127 | + |
| 128 | +This is useful when debugging one case or remote-execution behavior. |
| 129 | + |
| 130 | +## Testing |
| 131 | + |
| 132 | +- Core unit/integration tests: |
| 133 | + |
| 134 | +```bash |
| 135 | +cargo test -p taurus-core |
| 136 | +``` |
| 137 | + |
| 138 | +- Full workspace checks (recommended before merge): |
| 139 | + |
| 140 | +```bash |
| 141 | +cargo test |
| 142 | +``` |
| 143 | + |
| 144 | +## Extending Taurus |
| 145 | + |
| 146 | +### Add or modify built-in functions |
| 147 | + |
| 148 | +- Implement handler logic in `crates/taurus-core/src/runtime/functions/*` |
| 149 | +- Register function IDs via the `FUNCTIONS` arrays |
| 150 | +- Registration is aggregated through `ALL_FUNCTION_SETS` in `runtime/functions/mod.rs` |
| 151 | + |
| 152 | +### Remote execution routing rule |
| 153 | + |
| 154 | +In the compiler, a node is treated as local when `definition_source` is: |
| 155 | + |
| 156 | +- empty |
| 157 | +- `taurus` |
| 158 | +- prefixed with `draco` |
| 159 | + |
| 160 | +Any other source is routed as remote execution to that service name. |
0 commit comments