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