> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blockx.chaintable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Service API

> Task submission, watching, queries, and synchronous invocation over gRPC.

The gRPC services define BlockX's external execution contract. Use the service for your deployment; request configuration bytes contain JSON for the selected Call Builder or Writer Plugin.

## Worker task operations

In the BlockX repository, `api/grpc/worker/worker.proto` defines the Worker service, and `api/grpc/bundleworker/bundle_worker.proto` defines the bundle service identity.

| RPC | Request | Response |
| - | - | - |
| `RequestTaskSlot` | `task_id`, `ttl_ms` | `slot_id`, `state`, `alloc_seq` |
| `SubmitTask` | `task`, optional `slot_id` | Current `state` |
| `GetTaskResult` | `task_id` | Identifier, state, and terminal result if available |
| `WatchTasks` | `task_ids` | Stream of current snapshots and terminal updates |

Keep Watch attached during execution. Its lifetime participates in task execution; see [execution semantics](/concepts/execution-semantics).

## TaskInput

| Field | Type | Meaning |
| - | - | - |
| `task_id` | `string` | Caller-supplied task identifier |
| `function_call_config` | `{type, config}` | Registered Call Builder name and JSON bytes |
| `result_handler` | `{type, config}` | Optional Writer Plugin name and JSON bytes |
| `task_timeout_ms` | `int64` | Execution duration in milliseconds; zero uses the Worker default; negative or excessive values are rejected |

The Go JSON representation uses `functionCallConfig`, `resultHandler`, and `taskTimeoutMs`. These names differ from the protobuf field names. Plugin configuration retains its own JSON keys; see [task configuration](/reference/task-configuration).

## Coordinator placement

`CoordinatorService.ReserveWorkerSlot` and `BundleCoordinatorService.ReserveWorkerSlot` reserve capacity on the corresponding deployment. Supply `task_id`, then use the returned `worker_addr` and `slot_id` to submit. The Coordinator selects resources; the Worker executes and reports the task.

Protocol sources: `api/grpc/coordinator/coordinator.proto` and `api/grpc/bundlecoordinator/bundle_coordinator.proto`.

## Synchronous invocation

Defined in `api/grpc/syncinvoker/sync_invoker.proto`.

| RPC | Input | Output |
| - | - | - |
| `Invoke` | One function source, `args_json`, optional `deadline_unix_ms` | `call_id`, `success`, `result_json` or `failure`, execution and queue durations |
| `DebugInvoke` | Same input shape | Invocation result plus `debug_output` |
| `Precheck` | `source_code` | Audit verdict and findings, without execution |

Choose exactly one of `function_id` or `inline_source`. `args_json` contains a JSON array. `deadline_unix_ms` is an absolute deadline, unlike the task's duration field.

## Related docs

* [Invoke and debug](/guides/synchronous-invocation)
* [Results and errors](/reference/results-and-errors)
* [Internal protocols](/architecture/protocols)
* [Submit a task with Go](/development/submit-task-example)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.