jac-sv-microservices

Splits Jac backends into microservices using compile-time HTTP client stubs from sv import.

Updated Jul 26, 2026
One-click install
npx skills add https://github.com/PMN123/trapdoor --skill jac-sv-microservices-pmn123
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jac-sv-microservices
Source: https://github.com/PMN123/trapdoor/tree/main/.agents/skills/jac-sv-microservices
Command: npx skills add https://github.com/PMN123/trapdoor --skill jac-sv-microservices-pmn123

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Calling one Jac server module from another deployed as a separate service normally requires hand-written HTTP clients and manual wiring. This Skill explains how sv import generates those client stubs at compile time, so the same source code runs as a monolith, a local cluster, or multiple Kubernetes deployments. ## Core Features & Use Cases - Compile-time service stubs: sv import from <module> generates synchronous HTTP client stubs, so cross-service calls read like normal function calls. - Provider discovery chain: test clients, programmatic registration, JAC_SV_<MOD>_URL environment variables, and automatic sibling spawning at jac start time. - Remote walker spawns and gateway mode: walker:pub symbols execute remotely on construction, and jac setup microservice runs the whole stack behind one API gateway with trace IDs and per-service RPC timeouts. - Use Case: Split an LLM-backed analytics worker out of your main Jac API, set JAC_SV_ANALYTICS_URL, and raise its rpc_timeout to 120 seconds so long generations do not time out at the gateway. ## Quick Start Show me how to split my Jac backend so calculator_service.jac calls functions in math_service.jac running as a separate service.

Frequently Asked Questions about jac-sv-microservices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I split a Jac backend into microservices?

Use `sv import from <module> { ... }` in the consumer server module. The Jac compiler generates HTTP client stubs, so calling `add(1, 2)` issues a POST to the provider's `/function/add` endpoint while the source reads like a normal import.

How does Jac discover the URL of a remote service?

Discovery follows a chain: registered test clients, programmatic `sv_client.register(module, url)`, the `JAC_SV_<UPPERCASED_MODULE>_URL` environment variable, then auto-spawn of the provider as a sibling process at `jac start` time.

Why does my cross-service Jac call fail with Unauthorized?

The provider symbol is not declared `:pub`. Non-pub functions and walkers are not callable across the service boundary; the stub compiles fine but the call fails at runtime with an Unauthorized error.

Can a Jac walker be executed on a remote service?

Yes. Importing a `walker:pub` via sv import means constructing it spawns and executes it remotely. `Greet(name="x")` POSTs to `/walker/Greet` on the provider and returns the finished instance with reports populated.

Why does my Jac microservice time out on LLM-backed calls?

The gateway's per-service `rpc_timeout` defaults to 10 seconds. For LLM-backed workers, set `rpc_timeout = 120.0` or higher under `[scale.microservices.services.NAME]` in jac.toml so long generations are not cut off.

What types can cross the Jac service boundary?

obj types (recursively hydrated), enums, primitives, lists, dicts, None, and live streaming generators cross the wire. Node/edge anchors, closures, and file handles do not; pass `jid(node)` strings and re-resolve with `jobj` on the other side.