diff --git a/docs/ai-quickstart.mdx b/docs/ai-quickstart.mdx index 7106983f..bfa810a3 100644 --- a/docs/ai-quickstart.mdx +++ b/docs/ai-quickstart.mdx @@ -74,7 +74,7 @@ Invoke the agent via the Restate UI playground: go to `http://localhost:9070`, c Or invoke via `curl`: ```shell -curl localhost:8080/agent/run --json '{"prompt": "What is the weather in San Francisco?"}' +curl localhost:8080/restate/call/agent/run --json '{"prompt": "What is the weather in San Francisco?"}' ``` Output: `The weather in San Francisco is currently 23°C and sunny.`. @@ -240,7 +240,7 @@ Invoke the agent via the Restate UI playground: go to `http://localhost:9070`, c Or invoke via `curl`: ```shell -curl localhost:8080/agent/run --json '{"message": "What is the weather in San Francisco?"}' +curl localhost:8080/restate/call/agent/run --json '{"message": "What is the weather in San Francisco?"}' ``` Output: `The weather in San Francisco is sunny and 23°C.` @@ -386,7 +386,7 @@ Invoke the agent via the Restate UI playground: go to `http://localhost:9070`, c Or invoke via `curl`: ```shell -curl localhost:8080/agent/run --json '{ +curl localhost:8080/restate/call/agent/run --json '{ "message": "What is the weather like in San Francisco?", "user_id": "user-123" }' @@ -565,7 +565,7 @@ Invoke the agent via the Restate UI playground: go to `http://localhost:9070`, c Or invoke via `curl`: ```shell -curl localhost:8080/agent/run --json '{"message": "What is the weather in San Francisco?"}' +curl localhost:8080/restate/call/agent/run --json '{"message": "What is the weather in San Francisco?"}' ``` Output: `The weather in San Francisco is sunny and 23°C.` @@ -705,7 +705,7 @@ Invoke the agent via the Restate UI playground: go to `http://localhost:9070`, c Or invoke via `curl`: ```shell -curl localhost:8080/agent/run --json '{"message": "What is the weather in San Francisco?"}' +curl localhost:8080/restate/call/agent/run --json '{"message": "What is the weather in San Francisco?"}' ``` Output: `The weather in San Francisco is sunny and 23°C.` @@ -844,7 +844,7 @@ Invoke the agent via the Restate UI playground: go to `http://localhost:9070`, c Or invoke via `curl`: ```shell -curl localhost:8080/agent/run --json '{"message": "What is the weather in San Francisco?"}' +curl localhost:8080/restate/call/agent/run --json '{"message": "What is the weather in San Francisco?"}' ``` Output: `The weather in San Francisco is currently 23°C and sunny.` @@ -1026,7 +1026,7 @@ Invoke the agent via the Restate UI playground: go to `http://localhost:9070`, c Or invoke via `curl`: ```shell -curl localhost:8080/agent/chat --json '{"message": "What is the weather in San Francisco?"}' +curl localhost:8080/restate/call/agent/chat --json '{"message": "What is the weather in San Francisco?"}' ``` Output: `The weather in San Francisco is currently 23°C and sunny.` diff --git a/docs/ai/patterns/chat-ui-integration.mdx b/docs/ai/patterns/chat-ui-integration.mdx index fe308151..7a8d3627 100644 --- a/docs/ai/patterns/chat-ui-integration.mdx +++ b/docs/ai/patterns/chat-ui-integration.mdx @@ -91,15 +91,15 @@ You can also call Restate services using plain HTTP requests without the SDK. For example, in JavaScript: ```javascript {"CODE_LOAD::ts/src/ai/guides/chat-ui/http_requests.js#here"} // Request-response -const response = await fetch("http://localhost:8080/my-agent/run", { +const response = await fetch("http://localhost:8080/restate/call/my-agent/run", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: "How are you?" }), }); const result = await response.json(); -// Fire-and-forget: add /send to the URL -await fetch("http://localhost:8080/my-agent/run/send", { +// Fire-and-forget: use the /restate/send/... path +await fetch("http://localhost:8080/restate/send/my-agent/run", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: "How are you?" }), @@ -113,7 +113,7 @@ await fetch("http://localhost:8080/my-agent/run/send", { You can let Restate deduplicate requests by adding an idempotency key to the header of your request. ```javascript {"CODE_LOAD::ts/src/ai/guides/chat-ui/http_requests.js#idempotency"} -await fetch("http://localhost:8080/my-agent/run/send", { +await fetch("http://localhost:8080/restate/send/my-agent/run", { method: "POST", headers: { "Content-Type": "application/json", @@ -136,7 +136,7 @@ There are three ways to do this: ```javascript {"CODE_LOAD::ts/src/ai/guides/chat-ui/http_requests.js#attach"} // start the invocation -const handle = await fetch("http://localhost:8080/agent/run/send", { +const handle = await fetch("http://localhost:8080/restate/send/agent/run", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify("How are you?"), @@ -145,9 +145,9 @@ const handle = await fetch("http://localhost:8080/agent/run/send", { // retrieve the invocationId const { invocationId, status } = await handle.json(); -// retrieve the result +// retrieve the result by attaching to the invocation id const result = await fetch( - `http://localhost:8080/restate/invocation/${invocationId}/attach`, + `http://localhost:8080/restate/attach/${invocationId}`, { method: "GET" } ); await result.json(); @@ -156,12 +156,18 @@ await result.json(); 3. If you started the invocation with an idempotency key, then you can use that to attach to it. This does not start the invocation as opposed to point 1: ```javascript {"CODE_LOAD::ts/src/ai/guides/chat-ui/http_requests.js#attach_idem"} -// start the invocation with idempotency key +// attach via the idempotency key of an earlier invocation const idempotencyKey = "abc-123"; -const result = await fetch( - `http://localhost:8080/restate/invocation/agent/run/${idempotencyKey}/attach`, - { method: "GET" } -); +const result = await fetch(`http://localhost:8080/restate/attach`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + type: "idempotency", + service: "agent", + handler: "run", + idempotencyKey, + }), +}); await result.json(); ``` diff --git a/docs/ai/patterns/competitive-racing.mdx b/docs/ai/patterns/competitive-racing.mdx index d9c36c13..addb6ff4 100644 --- a/docs/ai/patterns/competitive-racing.mdx +++ b/docs/ai/patterns/competitive-racing.mdx @@ -81,7 +81,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/RacingAgent/run \ +curl localhost:8080/restate/call/RacingAgent/run \ --json '{ "message": "What is the best approach to learn machine learning?" }' @@ -126,7 +126,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/RacingAgent/run \ +curl localhost:8080/restate/call/RacingAgent/run \ --json '{ "message": "What is the best approach to learn machine learning?" }' diff --git a/docs/ai/patterns/human-in-the-loop.mdx b/docs/ai/patterns/human-in-the-loop.mdx index d62b0efd..f4377f83 100644 --- a/docs/ai/patterns/human-in-the-loop.mdx +++ b/docs/ai/patterns/human-in-the-loop.mdx @@ -88,9 +88,9 @@ Register the agents with Restate: restate deployments register http://localhost:9080 --force --yes # dev only: overrides previous registrations ``` -Use `curl` with `/send` to start the claim asynchronously, without waiting for the result: +Use `curl` with the `send` verb to start the claim asynchronously, without waiting for the result: ```bash -curl localhost:8080/HumanClaimApprovalAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalAgent/run \ --json '{"prompt": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -145,9 +145,9 @@ Register the agents with Restate: restate deployments register http://localhost:9080 --force --yes # dev only: overrides previous registrations ``` -Use `curl` with `/send` to start the claim asynchronously, without waiting for the result: +Use `curl` with the `send` verb to start the claim asynchronously, without waiting for the result: ```bash -curl localhost:8080/HumanClaimApprovalAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -203,9 +203,9 @@ Register the agents with Restate: restate deployments register http://localhost:9080 --force --yes # dev only: overrides previous registrations ``` -Use `curl` with `/send` to start the claim asynchronously, without waiting for the result: +Use `curl` with the `send` verb to start the claim asynchronously, without waiting for the result: ```bash -curl localhost:8080/HumanClaimApprovalAgent/user-123/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalAgent/user-123/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg.", "session_id": "session-123"}' ``` @@ -260,9 +260,9 @@ Register the agents with Restate: restate deployments register http://localhost:9080 --force --yes # dev only: overrides previous registrations ``` -Use `curl` with `/send` to start the claim asynchronously, without waiting for the result: +Use `curl` with the `send` verb to start the claim asynchronously, without waiting for the result: ```bash -curl localhost:8080/HumanClaimApprovalAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -317,9 +317,9 @@ Register the agents with Restate: restate deployments register http://localhost:9080 --force --yes # dev only: overrides previous registrations ``` -Use `curl` with `/send` to start the claim asynchronously, without waiting for the result: +Use `curl` with the `send` verb to start the claim asynchronously, without waiting for the result: ```bash -curl localhost:8080/HumanClaimApprovalAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -388,9 +388,9 @@ Register the services with Restate: restate deployments register http://localhost:9080 --force --yes # dev only: overrides previous registrations ``` -Use `curl` with `/send` to start the moderation asynchronously: +Use `curl` with the `send` verb to start the moderation asynchronously: ```bash -curl localhost:8080/HumanClaimApprovalAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -475,9 +475,9 @@ Register the services with Restate: restate deployments register http://localhost:9080 --force --yes # dev only: overrides previous registrations ``` -Use `curl` with `/send` to start the claim asynchronously, without waiting for the result: +Use `curl` with the `send` verb to start the claim asynchronously, without waiting for the result: ```bash -curl localhost:8080/HumanClaimApprovalAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -543,7 +543,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the service: ```bash -curl localhost:8080/HumanClaimApprovalWithTimeoutsAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalWithTimeoutsAgent/run \ --json '{"prompt": "Process my hospital bill of 3000USD for a broken leg."}' ``` Restart the service and check in the UI how the process will block for the remaining time without starting over. @@ -591,7 +591,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the service: ```bash -curl localhost:8080/HumanClaimApprovalWithTimeoutsAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalWithTimeoutsAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` Restart the service and check in the UI how the process will block for the remaining time without starting over. @@ -641,7 +641,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the service: ```bash -curl localhost:8080/HumanClaimApprovalWithTimeoutsAgent/user-123/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalWithTimeoutsAgent/user-123/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg.", "session_id": "session-123"}' ``` Restart the service and check in the UI how the process will block for the remaining time without starting over. @@ -693,7 +693,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the service: ```bash -curl localhost:8080/HumanClaimApprovalWithTimeoutsAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalWithTimeoutsAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` Restart the service and check in the UI how the process will block for the remaining time without starting over. @@ -741,7 +741,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the service: ```bash -curl localhost:8080/HumanClaimApprovalWithTimeoutsAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalWithTimeoutsAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` Restart the service and check in the UI how the process will block for the remaining time without starting over. @@ -784,7 +784,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the service: ```bash -curl localhost:8080/HumanClaimApprovalWithTimeoutsAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalWithTimeoutsAgent/run \ --json '{"prompt": "Process my hospital bill of 3000USD for a broken leg."}' ``` Restart the service and check in the UI how the process will block for the remaining time without starting over. @@ -832,7 +832,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the service: ```bash -curl localhost:8080/HumanClaimApprovalWithTimeoutsAgent/run/send \ +curl localhost:8080/restate/send/HumanClaimApprovalWithTimeoutsAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` Restart the service and check in the UI how the process will block for the remaining time without starting over. diff --git a/docs/ai/patterns/interrupt-regenerate.mdx b/docs/ai/patterns/interrupt-regenerate.mdx index 35c0948f..3f2db804 100644 --- a/docs/ai/patterns/interrupt-regenerate.mdx +++ b/docs/ai/patterns/interrupt-regenerate.mdx @@ -160,24 +160,24 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove **Happy path** — one message, one full response: ```bash -curl localhost:8080/CodingAgent/alice/message \ +curl localhost:8080/restate/call/CodingAgent/alice/message \ --json '{"content":"Write me a small todo CLI in TypeScript."}' # Wait a few seconds, then: -curl localhost:8080/CodingAgent/alice/getHistory +curl localhost:8080/restate/call/CodingAgent/alice/getHistory ``` **Interruption path** — fire a first message, then interrupt before it finishes: ```bash # Fire-and-forget the first message -curl localhost:8080/CodingAgent/bob/message/send \ +curl localhost:8080/restate/send/CodingAgent/bob/message \ --json '{"content":"Build a Fastify app with user auth."}' # Immediately interrupt with new context -curl localhost:8080/CodingAgent/bob/message \ +curl localhost:8080/restate/call/CodingAgent/bob/message \ --json '{"content":"Actually, use Hono instead of Fastify."}' -curl localhost:8080/CodingAgent/bob/getHistory +curl localhost:8080/restate/call/CodingAgent/bob/getHistory ``` Open the Restate UI at `http://localhost:9070` to inspect the invocations — the first `CodingTask.runTask` shows status `cancelled`, and the second `completed`. @@ -296,24 +296,24 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove **Happy path**: one message, one full response: ```bash -curl localhost:8080/CodingAgent/alice/message \ +curl localhost:8080/restate/call/CodingAgent/alice/message \ --json '{"content":"Write me a small todo CLI in Python."}' # Wait a few seconds, then: -curl localhost:8080/CodingAgent/alice/get_history +curl localhost:8080/restate/call/CodingAgent/alice/get_history ``` **Interruption path**: fire a first message, then interrupt before it finishes: ```bash # Fire-and-forget the first message -curl localhost:8080/CodingAgent/bob/message/send \ +curl localhost:8080/restate/send/CodingAgent/bob/message \ --json '{"content":"Build a Flask app with user auth."}' # Immediately interrupt with new context -curl localhost:8080/CodingAgent/bob/message \ +curl localhost:8080/restate/call/CodingAgent/bob/message \ --json '{"content":"Actually, use FastAPI instead of Flask."}' -curl localhost:8080/CodingAgent/bob/get_history +curl localhost:8080/restate/call/CodingAgent/bob/get_history ``` Open the Restate UI at `http://localhost:9070` to inspect the invocations — the first `CodingTask.run_task` shows status `cancelled`, and the second `completed`. diff --git a/docs/ai/patterns/multi-agent.mdx b/docs/ai/patterns/multi-agent.mdx index 33a0cbda..9453cb41 100644 --- a/docs/ai/patterns/multi-agent.mdx +++ b/docs/ai/patterns/multi-agent.mdx @@ -113,7 +113,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -190,7 +190,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/session123/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/session123/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -276,7 +276,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/user123/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/user123/run --json '{ "amount": 3000, "category": "orthopedic", "date": "2024-10-01", @@ -361,7 +361,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -456,7 +456,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/session123/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/session123/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -542,7 +542,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/AgentRouter/answer \ +curl localhost:8080/restate/call/AgentRouter/answer \ --json '{"message": "I was charged twice for my subscription last month"}' ``` @@ -612,7 +612,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/AgentRouter/answer \ +curl localhost:8080/restate/call/AgentRouter/answer \ --json '{"message": "I was charged twice for my subscription last month"}' ``` diff --git a/docs/ai/patterns/notify-when-ready.mdx b/docs/ai/patterns/notify-when-ready.mdx index 5a41c047..7b03ff58 100644 --- a/docs/ai/patterns/notify-when-ready.mdx +++ b/docs/ai/patterns/notify-when-ready.mdx @@ -135,17 +135,17 @@ If you need help with a specific SDK, please reach out to us via [Discord](https Or send requests via the terminal. - First, start the agent asynchronously by adding `/send` to the end of the URL: + First, start the agent asynchronously by using the `send` verb: ```shell - curl localhost:8080/AsyncNotificationsAgent/msg-123/run/send \ + curl localhost:8080/restate/send/AsyncNotificationsAgent/msg-123/run \ --json '"Write a 1000-word description of Durable Execution"' ``` Then, asynchronously call the `on_notify` handler to send the agent response via email once it's ready: ```shell - curl localhost:8080/AsyncNotificationsAgent/msg-123/on_notify/send \ + curl localhost:8080/restate/send/AsyncNotificationsAgent/msg-123/on_notify \ --json '"me@mail.com"' ``` diff --git a/docs/ai/patterns/parallelization.mdx b/docs/ai/patterns/parallelization.mdx index 8d2577d8..181ab286 100644 --- a/docs/ai/patterns/parallelization.mdx +++ b/docs/ai/patterns/parallelization.mdx @@ -94,7 +94,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request: ```bash -curl localhost:8080/ParallelToolClaimAgent/run --json '{ +curl localhost:8080/restate/call/ParallelToolClaimAgent/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -147,7 +147,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request: ```bash -curl localhost:8080/ParallelToolClaimAgent/run --json '{ +curl localhost:8080/restate/call/ParallelToolClaimAgent/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -199,7 +199,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request: ```bash -curl localhost:8080/ParallelToolClaimAgent/user123/run --json '{ +curl localhost:8080/restate/call/ParallelToolClaimAgent/user123/run --json '{ "amount": 3000, "category": "orthopedic", "date": "2024-10-01", @@ -255,7 +255,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request: ```bash -curl localhost:8080/ParallelToolClaimAgent/run --json '{ +curl localhost:8080/restate/call/ParallelToolClaimAgent/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -308,7 +308,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request: ```bash -curl localhost:8080/ParallelToolClaimAgent/run --json '{ +curl localhost:8080/restate/call/ParallelToolClaimAgent/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -395,7 +395,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ParallelToolAgent/run \ +curl localhost:8080/restate/call/ParallelToolAgent/run \ --json '{"message": "What is the weather in San Francisco and New York?"}' ``` @@ -464,7 +464,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ParallelToolAgent/run \ +curl localhost:8080/restate/call/ParallelToolAgent/run \ --json '{"message": "What is the weather in San Francisco and New York?"}' ``` diff --git a/docs/ai/patterns/remote-agents.mdx b/docs/ai/patterns/remote-agents.mdx index 7028ef7a..461c7361 100644 --- a/docs/ai/patterns/remote-agents.mdx +++ b/docs/ai/patterns/remote-agents.mdx @@ -125,7 +125,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -209,7 +209,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/session123/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/session123/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -305,7 +305,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/user123/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/user123/run --json '{ "amount": 3000, "category": "orthopedic", "date": "2024-10-01", @@ -385,7 +385,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -453,7 +453,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents: ```bash -curl localhost:8080/MultiAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/MultiAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -556,7 +556,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/RemoteAgentRouter/answer \ +curl localhost:8080/restate/call/RemoteAgentRouter/answer \ --json '{"message": "I was charged twice for my subscription last month"}' ``` @@ -645,7 +645,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/RemoteAgentRouter/answer \ +curl localhost:8080/restate/call/RemoteAgentRouter/answer \ --json '{"message": "I was charged twice for my subscription last month"}' ``` diff --git a/docs/ai/patterns/sessions.mdx b/docs/ai/patterns/sessions.mdx index 93c1fb62..f61ca1d9 100644 --- a/docs/ai/patterns/sessions.mdx +++ b/docs/ai/patterns/sessions.mdx @@ -95,19 +95,19 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Ask the agent to do some task. Specify the Virtual Object ID in the URL, for example for `session123`: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "make a poem about durable execution"}' ``` Continue the conversation with the same session ID. The agent remembers previous context: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "shorten it to 2 lines"}' ``` Send a message to a different session. It starts a completely separate conversation: ```bash -curl localhost:8080/Chat/session456/message \ +curl localhost:8080/restate/call/Chat/session456/message \ --json '{"message": "what are the benefits of durable execution?"}' ``` @@ -154,13 +154,13 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Ask the agent to do some task. Specify the Virtual Object ID in the URL, for example for `session123`: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "Make a poem about durable execution."}' ``` Continue the conversation with the same session ID. The agent remembers previous context: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "Shorten it to 2 lines."}' ``` @@ -168,7 +168,7 @@ Go to the state tab of the UI to view the conversation history. Send a message to a different session. It starts a completely separate conversation: ```bash -curl localhost:8080/Chat/session456/message \ +curl localhost:8080/restate/call/Chat/session456/message \ --json '{"message": "What are the benefits of durable execution?"}' ``` @@ -221,13 +221,13 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Ask the agent to do some task. Specify the Virtual Object ID in the URL, for example for `session123`: ```bash -curl localhost:8080/Chat/user123/message \ +curl localhost:8080/restate/call/Chat/user123/message \ --json '{"message": "Make a poem about durable execution.", "session_id": "session-123"}' ``` Continue the conversation with the same user and session ID. The agent remembers previous context: ```bash -curl localhost:8080/Chat/user123/message \ +curl localhost:8080/restate/call/Chat/user123/message \ --json '{"message": "Shorten it to 2 lines.", "session_id": "session-123"}' ``` @@ -235,7 +235,7 @@ Go to the state tab of the UI to view the conversation history. Send a message to a different user. It starts a completely separate conversation: ```bash -curl localhost:8080/Chat/user456/message \ +curl localhost:8080/restate/call/Chat/user456/message \ --json '{"message": "What are the benefits of durable execution?", "session_id": "session-567"}' ``` @@ -288,13 +288,13 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Ask the agent to do some task. Specify the Virtual Object ID in the URL, for example for `session123`: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "Make a poem about durable execution."}' ``` Continue the conversation with the same session ID. The agent remembers previous context: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "Shorten it to 2 lines."}' ``` @@ -302,7 +302,7 @@ Go to the state tab of the UI to view the conversation history. Send a message to a different session. It starts a completely separate conversation: ```bash -curl localhost:8080/Chat/session456/message \ +curl localhost:8080/restate/call/Chat/session456/message \ --json '{"message": "What are the benefits of durable execution?"}' ``` @@ -354,13 +354,13 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Ask the agent to do some task. Specify the Virtual Object ID in the URL, for example for `session123`: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "Make a poem about durable execution."}' ``` Continue the conversation with the same session ID. The agent remembers previous context: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "Shorten it to 2 lines."}' ``` @@ -368,7 +368,7 @@ Go to the state tab of the UI to view the conversation history. Send a message to a different session. It starts a completely separate conversation: ```bash -curl localhost:8080/Chat/session456/message \ +curl localhost:8080/restate/call/Chat/session456/message \ --json '{"message": "What are the benefits of durable execution?"}' ``` @@ -436,19 +436,19 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Ask the agent to do some task. Specify the Virtual Object ID in the URL, for example for `session123`: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "make a poem about durable execution"}' ``` Continue the conversation with the same session ID. The agent remembers previous context: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "shorten it to 2 lines"}' ``` Send a message to a different session. It starts a completely separate conversation: ```bash -curl localhost:8080/Chat/session456/message \ +curl localhost:8080/restate/call/Chat/session456/message \ --json '{"message": "what are the benefits of durable execution?"}' ``` @@ -506,19 +506,19 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Ask the agent to do some task. Specify the Virtual Object ID in the URL, for example for `session123`: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "make a poem about durable execution"}' ``` Continue the conversation with the same session ID. The agent remembers previous context: ```bash -curl localhost:8080/Chat/session123/message \ +curl localhost:8080/restate/call/Chat/session123/message \ --json '{"message": "shorten it to 2 lines"}' ``` Send a message to a different session. It starts a completely separate conversation: ```bash -curl localhost:8080/Chat/session456/message \ +curl localhost:8080/restate/call/Chat/session456/message \ --json '{"message": "what are the benefits of durable execution?"}' ``` @@ -588,14 +588,14 @@ Different session keys run in parallel with no interference. Send several messages concurrently to different chat sessions: ```bash -curl localhost:8080/Chat/session123/message/send --json '{"message": "make a poem about durable execution"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what are the benefits of durable execution?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "how does workflow orchestration work?"}' & -curl localhost:8080/Chat/session123/message/send --json '{"message": "can you make it rhyme better?"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what about fault tolerance in distributed systems?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "give me a practical example"}' & -curl localhost:8080/Chat/session101/message/send --json '{"message": "explain event sourcing in simple terms"}' & -curl localhost:8080/Chat/session202/message/send --json '{"message": "what is the difference between async and sync processing?"}' +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "make a poem about durable execution"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what are the benefits of durable execution?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "how does workflow orchestration work?"}' & +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "can you make it rhyme better?"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what about fault tolerance in distributed systems?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "give me a practical example"}' & +curl localhost:8080/restate/send/Chat/session101/message --json '{"message": "explain event sourcing in simple terms"}' & +curl localhost:8080/restate/send/Chat/session202/message --json '{"message": "what is the difference between async and sync processing?"}' ``` The UI shows how Restate queues the requests per session to ensure consistency: @@ -608,14 +608,14 @@ The UI shows how Restate queues the requests per session to ensure consistency: Send several messages concurrently to different chat sessions: ```bash -curl localhost:8080/Chat/session123/message/send --json '{"message": "make a poem about durable execution"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what are the benefits of durable execution?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "how does workflow orchestration work?"}' & -curl localhost:8080/Chat/session123/message/send --json '{"message": "can you make it rhyme better?"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what about fault tolerance in distributed systems?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "give me a practical example"}' & -curl localhost:8080/Chat/session101/message/send --json '{"message": "explain event sourcing in simple terms"}' & -curl localhost:8080/Chat/session202/message/send --json '{"message": "what is the difference between async and sync processing?"}' +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "make a poem about durable execution"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what are the benefits of durable execution?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "how does workflow orchestration work?"}' & +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "can you make it rhyme better?"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what about fault tolerance in distributed systems?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "give me a practical example"}' & +curl localhost:8080/restate/send/Chat/session101/message --json '{"message": "explain event sourcing in simple terms"}' & +curl localhost:8080/restate/send/Chat/session202/message --json '{"message": "what is the difference between async and sync processing?"}' ``` The UI shows how Restate queues the requests per session to ensure consistency: @@ -628,14 +628,14 @@ The UI shows how Restate queues the requests per session to ensure consistency: Send several messages concurrently to different users: ```bash -curl localhost:8080/Chat/user123/message/send --json '{"message": "make a poem about durable execution", "session_id": "session-123"}' & -curl localhost:8080/Chat/user456/message/send --json '{"message": "what are the benefits of durable execution?", "session_id": "session-567"}' & -curl localhost:8080/Chat/user789/message/send --json '{"message": "how does workflow orchestration work?", "session_id": "session-999"}' & -curl localhost:8080/Chat/user123/message/send --json '{"message": "can you make it rhyme better?", "session_id": "session-123"}' & -curl localhost:8080/Chat/user456/message/send --json '{"message": "what about fault tolerance in distributed systems?", "session_id": "session-567"}' & -curl localhost:8080/Chat/user789/message/send --json '{"message": "give me a practical example", "session_id": "session-999"}' & -curl localhost:8080/Chat/user101/message/send --json '{"message": "explain event sourcing in simple terms", "session_id": "session-123"}' & -curl localhost:8080/Chat/user202/message/send --json '{"message": "what is the difference between async and sync processing?", "session_id": "session-123"}' +curl localhost:8080/restate/send/Chat/user123/message --json '{"message": "make a poem about durable execution", "session_id": "session-123"}' & +curl localhost:8080/restate/send/Chat/user456/message --json '{"message": "what are the benefits of durable execution?", "session_id": "session-567"}' & +curl localhost:8080/restate/send/Chat/user789/message --json '{"message": "how does workflow orchestration work?", "session_id": "session-999"}' & +curl localhost:8080/restate/send/Chat/user123/message --json '{"message": "can you make it rhyme better?", "session_id": "session-123"}' & +curl localhost:8080/restate/send/Chat/user456/message --json '{"message": "what about fault tolerance in distributed systems?", "session_id": "session-567"}' & +curl localhost:8080/restate/send/Chat/user789/message --json '{"message": "give me a practical example", "session_id": "session-999"}' & +curl localhost:8080/restate/send/Chat/user101/message --json '{"message": "explain event sourcing in simple terms", "session_id": "session-123"}' & +curl localhost:8080/restate/send/Chat/user202/message --json '{"message": "what is the difference between async and sync processing?", "session_id": "session-123"}' ``` The UI shows how Restate queues the requests per session to ensure consistency: @@ -648,14 +648,14 @@ The UI shows how Restate queues the requests per session to ensure consistency: Send several messages concurrently to different chat sessions: ```bash -curl localhost:8080/Chat/session123/message/send --json '{"message": "make a poem about durable execution"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what are the benefits of durable execution?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "how does workflow orchestration work?"}' & -curl localhost:8080/Chat/session123/message/send --json '{"message": "can you make it rhyme better?"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what about fault tolerance in distributed systems?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "give me a practical example"}' & -curl localhost:8080/Chat/session101/message/send --json '{"message": "explain event sourcing in simple terms"}' & -curl localhost:8080/Chat/session202/message/send --json '{"message": "what is the difference between async and sync processing?"}' +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "make a poem about durable execution"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what are the benefits of durable execution?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "how does workflow orchestration work?"}' & +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "can you make it rhyme better?"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what about fault tolerance in distributed systems?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "give me a practical example"}' & +curl localhost:8080/restate/send/Chat/session101/message --json '{"message": "explain event sourcing in simple terms"}' & +curl localhost:8080/restate/send/Chat/session202/message --json '{"message": "what is the difference between async and sync processing?"}' ``` The UI shows how Restate queues the requests per session to ensure consistency: @@ -668,14 +668,14 @@ The UI shows how Restate queues the requests per session to ensure consistency: Send several messages concurrently to different chat sessions: ```bash -curl localhost:8080/Chat/session123/message/send --json '{"message": "make a poem about durable execution"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what are the benefits of durable execution?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "how does workflow orchestration work?"}' & -curl localhost:8080/Chat/session123/message/send --json '{"message": "can you make it rhyme better?"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what about fault tolerance in distributed systems?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "give me a practical example"}' & -curl localhost:8080/Chat/session101/message/send --json '{"message": "explain event sourcing in simple terms"}' & -curl localhost:8080/Chat/session202/message/send --json '{"message": "what is the difference between async and sync processing?"}' +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "make a poem about durable execution"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what are the benefits of durable execution?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "how does workflow orchestration work?"}' & +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "can you make it rhyme better?"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what about fault tolerance in distributed systems?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "give me a practical example"}' & +curl localhost:8080/restate/send/Chat/session101/message --json '{"message": "explain event sourcing in simple terms"}' & +curl localhost:8080/restate/send/Chat/session202/message --json '{"message": "what is the difference between async and sync processing?"}' ``` The UI shows how Restate queues the requests per session to ensure consistency: @@ -688,14 +688,14 @@ The UI shows how Restate queues the requests per session to ensure consistency: Send several messages concurrently to different chat sessions: ```bash -curl localhost:8080/Chat/session123/message/send --json '{"message": "make a poem about durable execution"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what are the benefits of durable execution?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "how does workflow orchestration work?"}' & -curl localhost:8080/Chat/session123/message/send --json '{"message": "can you make it rhyme better?"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what about fault tolerance in distributed systems?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "give me a practical example"}' & -curl localhost:8080/Chat/session101/message/send --json '{"message": "explain event sourcing in simple terms"}' & -curl localhost:8080/Chat/session202/message/send --json '{"message": "what is the difference between async and sync processing?"}' +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "make a poem about durable execution"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what are the benefits of durable execution?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "how does workflow orchestration work?"}' & +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "can you make it rhyme better?"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what about fault tolerance in distributed systems?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "give me a practical example"}' & +curl localhost:8080/restate/send/Chat/session101/message --json '{"message": "explain event sourcing in simple terms"}' & +curl localhost:8080/restate/send/Chat/session202/message --json '{"message": "what is the difference between async and sync processing?"}' ``` The UI shows how Restate queues the requests per session to ensure consistency: @@ -708,14 +708,14 @@ The UI shows how Restate queues the requests per session to ensure consistency: Send several messages concurrently to different chat sessions: ```bash -curl localhost:8080/Chat/session123/message/send --json '{"message": "make a poem about durable execution"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what are the benefits of durable execution?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "how does workflow orchestration work?"}' & -curl localhost:8080/Chat/session123/message/send --json '{"message": "can you make it rhyme better?"}' & -curl localhost:8080/Chat/session456/message/send --json '{"message": "what about fault tolerance in distributed systems?"}' & -curl localhost:8080/Chat/session789/message/send --json '{"message": "give me a practical example"}' & -curl localhost:8080/Chat/session101/message/send --json '{"message": "explain event sourcing in simple terms"}' & -curl localhost:8080/Chat/session202/message/send --json '{"message": "what is the difference between async and sync processing?"}' +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "make a poem about durable execution"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what are the benefits of durable execution?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "how does workflow orchestration work?"}' & +curl localhost:8080/restate/send/Chat/session123/message --json '{"message": "can you make it rhyme better?"}' & +curl localhost:8080/restate/send/Chat/session456/message --json '{"message": "what about fault tolerance in distributed systems?"}' & +curl localhost:8080/restate/send/Chat/session789/message --json '{"message": "give me a practical example"}' & +curl localhost:8080/restate/send/Chat/session101/message --json '{"message": "explain event sourcing in simple terms"}' & +curl localhost:8080/restate/send/Chat/session202/message --json '{"message": "what is the difference between async and sync processing?"}' ``` The UI shows how Restate queues the requests per session to ensure consistency: @@ -738,7 +738,7 @@ To retrieve state, view the UI's state tab or add a handler that reads it. Have Call the handler to get the conversation history: ```bash -curl localhost:8080/Chat/session123/getHistory +curl localhost:8080/restate/call/Chat/session123/getHistory ``` @@ -749,7 +749,7 @@ To retrieve state, view the UI's state tab or add a handler that reads it. Have Call the handler to get the conversation history: ```bash -curl localhost:8080/Chat/session123/get_history +curl localhost:8080/restate/call/Chat/session123/get_history ``` @@ -759,7 +759,7 @@ To retrieve state, view the UI's state tab or add a handler that reads it. Have Call the handler to get the conversation history: ```bash -curl localhost:8080/Chat/user123/get_history --json '"session-123"' +curl localhost:8080/restate/call/Chat/user123/get_history --json '"session-123"' ``` @@ -770,7 +770,7 @@ To retrieve state, view the UI's state tab or add a handler that reads it. Have Call the handler to get the conversation history: ```bash -curl localhost:8080/Chat/session123/get_history +curl localhost:8080/restate/call/Chat/session123/get_history ``` @@ -781,7 +781,7 @@ To retrieve state, view the UI's state tab or add a handler that reads it. Have Call the handler to get the conversation history: ```bash -curl localhost:8080/Chat/session123/get_history +curl localhost:8080/restate/call/Chat/session123/get_history ``` @@ -792,7 +792,7 @@ To retrieve state, view the UI's state tab or add a handler that reads it. Have Call the handler to get the conversation history: ```bash -curl localhost:8080/Chat/session123/getHistory +curl localhost:8080/restate/call/Chat/session123/getHistory ``` @@ -803,7 +803,7 @@ To retrieve state, view the UI's state tab or add as handler that reads it. Have Call the handler to get the conversation history: ```bash -curl localhost:8080/Chat/session123/get_history +curl localhost:8080/restate/call/Chat/session123/get_history ``` diff --git a/docs/ai/patterns/tools.mdx b/docs/ai/patterns/tools.mdx index e799f35f..c70de068 100644 --- a/docs/ai/patterns/tools.mdx +++ b/docs/ai/patterns/tools.mdx @@ -191,7 +191,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request that triggers the human approval sub-workflow: ```bash -curl localhost:8080/SubWorkflowClaimAgent/run/send \ +curl localhost:8080/restate/send/SubWorkflowClaimAgent/run \ --json '{"prompt": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -231,7 +231,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request that triggers the human approval sub-workflow: ```bash -curl localhost:8080/SubWorkflowClaimAgent/run/send \ +curl localhost:8080/restate/send/SubWorkflowClaimAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -266,7 +266,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request that triggers the human approval sub-workflow: ```bash -curl localhost:8080/SubWorkflowClaimAgent/user-123/run/send \ +curl localhost:8080/restate/send/SubWorkflowClaimAgent/user-123/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg.", "session_id": "session-123"}' ``` @@ -302,7 +302,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request that triggers the human approval sub-workflow: ```bash -curl localhost:8080/SubWorkflowClaimAgent/run/send \ +curl localhost:8080/restate/send/SubWorkflowClaimAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` @@ -338,7 +338,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request that triggers the human approval sub-workflow: ```bash -curl localhost:8080/SubWorkflowClaimAgent/run/send \ +curl localhost:8080/restate/send/SubWorkflowClaimAgent/run \ --json '{"message": "Process my hospital bill of 3000USD for a broken leg."}' ``` diff --git a/docs/ai/patterns/workflow-evaluator.mdx b/docs/ai/patterns/workflow-evaluator.mdx index ac2afe41..c358daee 100644 --- a/docs/ai/patterns/workflow-evaluator.mdx +++ b/docs/ai/patterns/workflow-evaluator.mdx @@ -107,7 +107,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Sends a request to the agent: ```shell -curl localhost:8080/CodeGenerator/generate \ +curl localhost:8080/restate/call/CodeGenerator/generate \ --json '{ "task": "Write a TypeScript function that implements a retry mechanism with exponential backoff" }' @@ -176,7 +176,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/CodeGenerator/generate \ +curl localhost:8080/restate/call/CodeGenerator/generate \ --json '{"task": "Write a function that checks if a string is a palindrome"}' ``` @@ -258,7 +258,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/CodeGenerator/user123/generate \ +curl localhost:8080/restate/call/CodeGenerator/user123/generate \ --json '{"task": "Write a function that checks if a string is a palindrome"}' ``` @@ -325,7 +325,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/CodeGenerator/generate \ +curl localhost:8080/restate/call/CodeGenerator/generate \ --json '{"task": "Write a function that checks if a string is a palindrome"}' ``` @@ -396,7 +396,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/CodeGenerator/generate \ +curl localhost:8080/restate/call/CodeGenerator/generate \ --json '{"task": "Write a function that checks if a string is a palindrome"}' ``` @@ -470,7 +470,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/CodeGenerator/generate \ +curl localhost:8080/restate/call/CodeGenerator/generate \ --json '{"task": "Write a function that checks if a string is a palindrome"}' ``` @@ -534,7 +534,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/CodeGenerator/generate \ +curl localhost:8080/restate/call/CodeGenerator/generate \ --json '{"task": "Write a function that checks if a string is a palindrome"}' ``` diff --git a/docs/ai/patterns/workflow-orchestrator.mdx b/docs/ai/patterns/workflow-orchestrator.mdx index 058a2b3c..22399569 100644 --- a/docs/ai/patterns/workflow-orchestrator.mdx +++ b/docs/ai/patterns/workflow-orchestrator.mdx @@ -122,7 +122,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the agent: ```shell -curl localhost:8080/ResearchReport/generate \ +curl localhost:8080/restate/call/ResearchReport/generate \ --json '{ "topic": "Benefits of durable execution in distributed systems" }' @@ -199,7 +199,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ResearchReport/generate \ +curl localhost:8080/restate/call/ResearchReport/generate \ --json '{"topic": "The impact of renewable energy on global economies"}' ``` @@ -271,7 +271,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ResearchReport/user123/generate \ +curl localhost:8080/restate/call/ResearchReport/user123/generate \ --json '{ "sessionId": "session-123", "topic": "The impact of renewable energy on global economies" @@ -351,7 +351,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ResearchReport/generate \ +curl localhost:8080/restate/call/ResearchReport/generate \ --json '{"topic": "The impact of renewable energy on global economies"}' ``` @@ -423,7 +423,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ResearchReport/generate \ +curl localhost:8080/restate/call/ResearchReport/generate \ --json '{"topic": "The impact of renewable energy on global economies"}' ``` @@ -508,7 +508,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ResearchReport/generate \ +curl localhost:8080/restate/call/ResearchReport/generate \ --json '{"topic": "The impact of renewable energy on global economies"}' ``` @@ -583,7 +583,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ResearchReport/generate \ +curl localhost:8080/restate/call/ResearchReport/generate \ --json '{"topic": "The impact of renewable energy on global economies"}' ``` diff --git a/docs/ai/patterns/workflow-parallel.mdx b/docs/ai/patterns/workflow-parallel.mdx index d52dfdc1..522aa525 100644 --- a/docs/ai/patterns/workflow-parallel.mdx +++ b/docs/ai/patterns/workflow-parallel.mdx @@ -85,7 +85,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents in parallel: ```bash -curl localhost:8080/ParallelAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/ParallelAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -142,7 +142,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents in parallel: ```bash -curl localhost:8080/ParallelAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/ParallelAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -205,7 +205,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents in parallel: ```bash -curl localhost:8080/ParallelAgentClaimApproval/user123/run --json '{ +curl localhost:8080/restate/call/ParallelAgentClaimApproval/user123/run --json '{ "amount": 3000, "category": "orthopedic", "date": "2024-10-01", @@ -260,7 +260,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents in parallel: ```bash -curl localhost:8080/ParallelAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/ParallelAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -322,7 +322,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Start a request for a claim that needs to be analyzed by multiple agents in parallel: ```bash -curl localhost:8080/ParallelAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/ParallelAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -401,7 +401,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ParallelAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/ParallelAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", @@ -480,7 +480,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ParallelAgentClaimApproval/run --json '{ +curl localhost:8080/restate/call/ParallelAgentClaimApproval/run --json '{ "date":"2024-10-01", "category":"orthopedic", "reason":"hospital bill for a broken leg", diff --git a/docs/ai/patterns/workflow-sequential.mdx b/docs/ai/patterns/workflow-sequential.mdx index 521411b6..414495d0 100644 --- a/docs/ai/patterns/workflow-sequential.mdx +++ b/docs/ai/patterns/workflow-sequential.mdx @@ -108,7 +108,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request to the agent: ```shell -curl localhost:8080/ClaimReimbursement/process --json '{ +curl localhost:8080/restate/call/ClaimReimbursement/process --json '{ "prompt": "Process my hospital bill of 2024-10-01 for 3000USD for a broken leg at General Hospital." }' ``` @@ -179,7 +179,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ClaimReimbursement/process --json '{ +curl localhost:8080/restate/call/ClaimReimbursement/process --json '{ "message": "Process my hospital bill of 2024-10-01 for 3000USD for a broken leg at General Hospital." }' ``` @@ -266,7 +266,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ClaimReimbursement/user123/process \ +curl localhost:8080/restate/call/ClaimReimbursement/user123/process \ --json '{ "sessionId": "session-123", "message": "Hospital bill for a broken leg. Amount: 3000 EUR. Date: 2024-10-01. Hospital: General Hospital." @@ -344,7 +344,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ClaimReimbursement/process --json '{ +curl localhost:8080/restate/call/ClaimReimbursement/process --json '{ "message": "Process my hospital bill of 2024-10-01 for 3000USD for a broken leg at General Hospital." }' ``` @@ -419,7 +419,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ClaimReimbursement/process --json '{ +curl localhost:8080/restate/call/ClaimReimbursement/process --json '{ "message": "Process my hospital bill of 2024-10-01 for 3000USD for a broken leg at General Hospital." }' ``` @@ -493,7 +493,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ClaimReimbursement/process --json '{ +curl localhost:8080/restate/call/ClaimReimbursement/process --json '{ "message": "Process my hospital bill of 2024-10-01 for 3000USD for a broken leg at General Hospital." }' ``` @@ -577,7 +577,7 @@ restate deployments register http://localhost:9080 --force --yes # dev only: ove Send a request: ```bash -curl localhost:8080/ClaimReimbursement/process --json '{ +curl localhost:8080/restate/call/ClaimReimbursement/process --json '{ "message": "Process my hospital bill of 2024-10-01 for 3000USD for a broken leg at General Hospital." }' ``` diff --git a/docs/cloud/getting-started.mdx b/docs/cloud/getting-started.mdx index e2a94bc9..37b08e35 100644 --- a/docs/cloud/getting-started.mdx +++ b/docs/cloud/getting-started.mdx @@ -83,7 +83,7 @@ restate cloud env tunnel --remote-port 8080 Now you can call your service handlers over HTTP on `localhost:8080` (Restate Cloud's ingress port): ```bash -curl localhost:8080/MyService/myHandler +curl localhost:8080/restate/call/MyService/myHandler ``` @@ -107,7 +107,7 @@ To create an API key, go to the Developers tab in the Cloud UI. Now you can call your service handlers by including the API Key as a Bearer token like this: ```bash -curl -H "Authorization: Bearer $RESTATE_AUTH_TOKEN" https://201hy10cd3h6426jy80tb32n6en.env.us.restate.cloud:8080/MyService/MyHandler +curl -H "Authorization: Bearer $RESTATE_AUTH_TOKEN" https://201hy10cd3h6426jy80tb32n6en.env.us.restate.cloud:8080/restate/call/MyService/MyHandler curl -H "Authorization: Bearer $RESTATE_AUTH_TOKEN" https://201hy10cd3h6426jy80tb32n6en.env.us.restate.cloud:9070/deployments ``` diff --git a/docs/foundations/invocations.mdx b/docs/foundations/invocations.mdx index d5236b3b..0f833967 100644 --- a/docs/foundations/invocations.mdx +++ b/docs/foundations/invocations.mdx @@ -14,7 +14,7 @@ To call a function over HTTP, send a request to the Restate Server, specifying t For example, to call the `processPayment` function of the `PaymentService`: ```bash -curl -X POST localhost:8080/PaymentService/processPayment \ +curl -X POST localhost:8080/restate/call/PaymentService/processPayment \ --json '{"amount": 100, "currency": "USD"}' ``` @@ -25,7 +25,7 @@ To call Virtual Objects or Workflows, you need to specify the object key or work For example, to call `updateBalance` of the `UserAccount` object with key `user123`: ```bash -curl -X POST localhost:8080/UserAccount/user123/updateBalance \ +curl -X POST localhost:8080/restate/call/UserAccount/user123/updateBalance \ --json '{"amount": 50}' ``` @@ -82,7 +82,7 @@ Consult the [Kafka Quickstart](/guides/kafka-quickstart) to get started. Add an idempotency key to your request header to let Restate deduplicate retries: ```bash -curl -X POST localhost:8080/PaymentService/processPayment \ +curl -X POST localhost:8080/restate/call/PaymentService/processPayment \ -H 'idempotency-key: payment-123' \ --json '{"amount": 100, "currency": "USD"}' ``` @@ -141,7 +141,7 @@ response, err := restate.AttachInvocation[string](ctx, invocationId).Response() Or over HTTP: ```bash -curl localhost:8080/restate/invocation/inv_1234567890abcdef/attach +curl localhost:8080/restate/attach/inv_1234567890abcdef ``` This is useful when another process needs the result of an ongoing operation or wants to check whether it has completed. diff --git a/docs/guides/cluster.mdx b/docs/guides/cluster.mdx index 6f70efaa..0cb8fdda 100644 --- a/docs/guides/cluster.mdx +++ b/docs/guides/cluster.mdx @@ -46,9 +46,9 @@ This guide shows how to deploy a distributed Restate cluster consisting of three You can invoke the registered service at any of the started Restate nodes since they all run the ingress. ```shell - curl localhost:8080/Greeter/greet --json '"Sarah"' && - curl localhost:28080/Greeter/greet --json '"Bob"' && - curl localhost:38080/Greeter/greet --json '"Eve"' + curl localhost:8080/restate/call/Greeter/greet --json '"Sarah"' && + curl localhost:28080/restate/call/Greeter/greet --json '"Bob"' && + curl localhost:38080/restate/call/Greeter/greet --json '"Eve"' ``` diff --git a/docs/guides/cron.mdx b/docs/guides/cron.mdx index fcc945c9..e4527a13 100644 --- a/docs/guides/cron.mdx +++ b/docs/guides/cron.mdx @@ -509,7 +509,7 @@ Usage: ```bash TypeScript - curl localhost:8080/CronJobInitiator/create --json '{ + curl localhost:8080/restate/call/CronJobInitiator/create --json '{ "cronExpression": "* * * * *", "service": "TaskService", "method": "executeTask", @@ -518,7 +518,7 @@ Usage: ``` ```bash Java - curl localhost:8080/CronJobInitiator/create --json '{ + curl localhost:8080/restate/call/CronJobInitiator/create --json '{ "cronExpression": "* * * * *", "service": "TaskService", "method": "executeTask", @@ -527,7 +527,7 @@ Usage: ``` ```bash Go - curl localhost:8080/CronJobInitiator/Create --json '{ + curl localhost:8080/restate/call/CronJobInitiator/Create --json '{ "cronExpression": "* * * * *", "service": "TaskService", "method": "ExecuteTask", @@ -541,7 +541,7 @@ Usage: ```bash TypeScript - curl localhost:8080/CronJobInitiator/create --json '{ + curl localhost:8080/restate/call/CronJobInitiator/create --json '{ "cronExpression": "0 0 * * *", "service": "TaskService", "method": "executeTask", @@ -550,7 +550,7 @@ Usage: ``` ```bash Java - curl localhost:8080/CronJobInitiator/create --json '{ + curl localhost:8080/restate/call/CronJobInitiator/create --json '{ "cronExpression": "0 0 * * *", "service": "TaskService", "method": "executeTask", @@ -559,7 +559,7 @@ Usage: ``` ```bash Go - curl localhost:8080/CronJobInitiator/Create --json '{ + curl localhost:8080/restate/call/CronJobInitiator/Create --json '{ "cronExpression": "0 0 * * *", "service": "TaskService", "method": "ExecuteTask", @@ -577,15 +577,15 @@ Usage: ```bash TypeScript - curl localhost:8080/CronJob/myJobId/getInfo + curl localhost:8080/restate/call/CronJob/myJobId/getInfo ``` ```bash Java - curl localhost:8080/CronJob/myJobId/getInfo + curl localhost:8080/restate/call/CronJob/myJobId/getInfo ``` ```bash Go - curl localhost:8080/CronJob/myJobId/GetInfo + curl localhost:8080/restate/call/CronJob/myJobId/GetInfo ``` @@ -594,15 +594,15 @@ Usage: ```bash TypeScript - curl localhost:8080/CronJob/myJobId/cancel + curl localhost:8080/restate/call/CronJob/myJobId/cancel ``` ```bash Java - curl localhost:8080/CronJob/myJobId/cancel + curl localhost:8080/restate/call/CronJob/myJobId/cancel ``` ```bash Go - curl localhost:8080/CronJob/myJobId/Cancel + curl localhost:8080/restate/call/CronJob/myJobId/Cancel ``` diff --git a/docs/guides/encore.mdx b/docs/guides/encore.mdx index f9a81afc..3ee26322 100644 --- a/docs/guides/encore.mdx +++ b/docs/guides/encore.mdx @@ -170,7 +170,7 @@ export const restateEndpoint = api.raw( Send a request to Restate Server's ingress (port 8080), which routes it to your Encore-hosted handler: ```shell - curl localhost:8080/OrderProcessor/process \ + curl localhost:8080/restate/call/OrderProcessor/process \ --json '{"id": "order-123", "item": "widget"}' ``` diff --git a/docs/guides/parallelizing-work.mdx b/docs/guides/parallelizing-work.mdx index f5bd16d0..8987ea74 100644 --- a/docs/guides/parallelizing-work.mdx +++ b/docs/guides/parallelizing-work.mdx @@ -278,23 +278,23 @@ restate deployments register localhost:9080 ```shell TypeScript - curl localhost:8080/worker/run \ + curl localhost:8080/restate/call/worker/run \ --json '{"description": "get out of bed,shower,make coffee,have breakfast"}' ``` ```shell Java - curl localhost:8080/FanOutWorker/run \ + curl localhost:8080/restate/call/FanOutWorker/run \ --json '{"description": "get out of bed,shower,make coffee,have breakfast"}' ``` ```shell Kotlin - curl localhost:8080/FanOutWorker/run \ + curl localhost:8080/restate/call/FanOutWorker/run \ --json '{"description": "get out of bed,shower,make coffee,have breakfast"}' ``` ```shell Python - curl localhost:8080/FanOutWorker/run \ + curl localhost:8080/restate/call/FanOutWorker/run \ --json '{"description": "get out of bed,shower,make coffee,have breakfast"}' ``` ```shell Go - curl localhost:8080/FanOutWorker/Run \ + curl localhost:8080/restate/call/FanOutWorker/Run \ --json '{"description": "get out of bed,shower,make coffee,have breakfast"}' ``` diff --git a/docs/guides/rate-limiting.mdx b/docs/guides/rate-limiting.mdx index d16e73bd..8467f784 100644 --- a/docs/guides/rate-limiting.mdx +++ b/docs/guides/rate-limiting.mdx @@ -943,12 +943,12 @@ func main() { ```bash TypeScript - curl localhost:8080/limiter/myService-expensiveMethod/setRate \ + curl localhost:8080/restate/call/limiter/myService-expensiveMethod/setRate \ --json '{"newLimit": 1, "newBurst": 1}' ``` ```bash Go - curl localhost:8080/Limiter/LimitedTask-RunTask/SetRate \ + curl localhost:8080/restate/call/Limiter/LimitedTask-RunTask/SetRate \ --json '{"limit": 1, "burst": 1}' ``` @@ -964,18 +964,18 @@ func main() { ```bash TypeScript # send one request - curl localhost:8080/myService/expensiveMethod + curl localhost:8080/restate/call/myService/expensiveMethod # send lots - for i in $(seq 1 30); do curl localhost:8080/myService/expensiveMethod && echo "request completed"; done + for i in $(seq 1 30); do curl localhost:8080/restate/call/myService/expensiveMethod && echo "request completed"; done ``` ```bash Go # send one request - curl localhost:8080/LimitedTask/RunTask + curl localhost:8080/restate/call/LimitedTask/RunTask # send lots - for i in $(seq 1 30); do curl localhost:8080/LimitedTask/RunTask && echo "request completed"; done + for i in $(seq 1 30); do curl localhost:8080/restate/call/LimitedTask/RunTask && echo "request completed"; done ``` diff --git a/docs/guides/sagas.mdx b/docs/guides/sagas.mdx index 685a9cc1..2ff53d4d 100644 --- a/docs/guides/sagas.mdx +++ b/docs/guides/sagas.mdx @@ -341,7 +341,7 @@ Restate automatically retries transient failures (network hiccups, temporary out ```bash TypeScript - curl localhost:8080/BookingWorkflow/run --json '{ + curl localhost:8080/restate/call/BookingWorkflow/run --json '{ "flight": { "flightId": "12345", "passengerName": "John Doe" @@ -358,7 +358,7 @@ Restate automatically retries transient failures (network hiccups, temporary out ``` ```bash Java - curl localhost:8080/BookingWorkflow/run --json '{ + curl localhost:8080/restate/call/BookingWorkflow/run --json '{ "flight": { "flightId": "12345", "passengerName": "John Doe" @@ -375,7 +375,7 @@ Restate automatically retries transient failures (network hiccups, temporary out ``` ```bash Kotlin - curl localhost:8080/BookingWorkflow/run --json '{ + curl localhost:8080/restate/call/BookingWorkflow/run --json '{ "flight": { "flightId": "12345", "passengerName": "John Doe" @@ -392,7 +392,7 @@ Restate automatically retries transient failures (network hiccups, temporary out ``` ```bash Python - curl localhost:8080/BookingWorkflow/run --json '{ + curl localhost:8080/restate/call/BookingWorkflow/run --json '{ "flight": { "flightId": "12345", "passengerName": "John Doe" @@ -409,7 +409,7 @@ Restate automatically retries transient failures (network hiccups, temporary out ``` ```bash Go - curl localhost:8080/BookingWorkflow/Run --json '{ + curl localhost:8080/restate/call/BookingWorkflow/Run --json '{ "flight": { "flightId": "12345", "passengerName": "John Doe" diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 6001fe7b..365078eb 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -960,7 +960,7 @@ fun main() { Or invoke via `curl`: ```shell - curl localhost:8080/Greeter/Greet --json '"Sarah"' + curl localhost:8080/restate/call/Greeter/Greet --json '"Sarah"' ``` Expected output: @@ -1010,7 +1010,7 @@ func (Greeter) Greet(ctx restate.Context, name string) (string, error) { Send a request for `Alice` to see how the service behaves when it occasionally fails to send the reminder and notification: ```shell - curl localhost:8080/Greeter/Greet --json '"Alice"' + curl localhost:8080/restate/call/Greeter/Greet --json '"Alice"' ``` Expected output: ``` @@ -1127,7 +1127,7 @@ async def greet(ctx: restate.Context, req: GreetingRequest) -> Greeting: Or invoke via `curl`: ```shell - curl localhost:8080/Greeter/greet --json '"Sarah"' + curl localhost:8080/restate/call/Greeter/greet --json '"Sarah"' ``` Expected output: @@ -1179,7 +1179,7 @@ async fn main() { Send a request for `Alice` to see how the service behaves when it occasionally fails to send the reminder and notification: ```shell - curl localhost:8080/Greeter/greet --json '"Alice"' + curl localhost:8080/restate/call/Greeter/greet --json '"Alice"' ``` Example output: ```shell @@ -1264,7 +1264,7 @@ async fn main() -> Result { Send a request for `Alice` to see how the service behaves when it occasionally fails to send the reminder and notification: ```shell - curl localhost:8080/Greeter/greet --json '"Alice"' + curl localhost:8080/restate/call/Greeter/greet --json '"Alice"' ``` Example output: ```shell diff --git a/docs/services/invocation/http.mdx b/docs/services/invocation/http.mdx index 3540bc04..5896f4d4 100644 --- a/docs/services/invocation/http.mdx +++ b/docs/services/invocation/http.mdx @@ -16,28 +16,47 @@ Open the UI at port 9070, register your service, click on the service, open the Have a look at [managing invocations](/services/invocation/managing-invocations) to learn how to manage the lifecycle of an invocation. +All ingress endpoints live under the reserved `/restate/` path prefix. +To invoke a handler, use `/restate/call/...` to wait for the response or `/restate/send/...` to send a message without waiting: + +``` +# Request-response +POST /restate/call/{service}/{handler} +POST /restate/call/{service}/{key}/{handler} + +# Send a message (no response) +POST /restate/send/{service}/{handler} +POST /restate/send/{service}/{key}/{handler} +``` + +Add the `{key}` segment for Virtual Objects and Workflows; omit it for basic Services. + + + The unversioned paths (`/{service}/{handler}`, `/{service}/{key}/{handler}`, and the `/send` suffix) still work for backwards compatibility, but new code should use the `/restate/` paths documented here. + + ## Request-response calls You can invoke services over HTTP 1.1 or higher. Request/response bodies should be encoded as JSON. -Invoking `myHandler` of `myService` as follows: +Invoke `myHandler` of `MyService` as follows: ```shell -curl localhost:8080/MyService/myHandler \ +curl localhost:8080/restate/call/MyService/myHandler \ --json '{"name": "Mary", "age": 25}' ``` -Invoke `myHandler` of `myVirtualObject` for `myObjectKey` as follows: +Invoke `myHandler` of `MyVirtualObject` for `myObjectKey` as follows: ```shell -curl localhost:8080/MyVirtualObject/myObjectKey/myHandler \ +curl localhost:8080/restate/call/MyVirtualObject/myObjectKey/myHandler \ --json '{"name": "Mary", "age": 25}' ``` Call the `run` handler of the `MyWorkflow` as follows: ```shell -curl localhost:8080/MyWorkflow/myWorkflowId/run \ +curl localhost:8080/restate/call/MyWorkflow/myWorkflowId/run \ --json '{"name": "Mary", "age": 25}' ``` @@ -51,10 +70,10 @@ Follow the same pattern for calling the other handlers of the workflow. ## Sending messages -If you do not want to wait for the response, you can also send a message by adding `/send` to the URL path: +If you do not want to wait for the response, you can send a message by using `/restate/send/...` instead of `/restate/call/...`: ```shell -curl localhost:8080/MyService/myHandler/send \ +curl localhost:8080/restate/send/MyService/myHandler \ --json '{"name": "Mary", "age": 25}' ``` @@ -64,8 +83,8 @@ Example output: {"invocationId":"inv_1aiqX0vFEFNH1Umgre58JiCLgHfTtztYK5","status":"Accepted"} ``` -The response contains the [Invocation ID](#invocation-identifier). -You can use this identifier [to cancel](#cancelling-invocations) or [kill the invocation](#killing-invocations). +The response contains the [Invocation ID](/services/invocation/managing-invocations#invocation-id). +You can use this identifier [to cancel](/services/invocation/managing-invocations#cancel) or [kill the invocation](/services/invocation/managing-invocations#kill). ## Delayed messages @@ -74,12 +93,12 @@ You can **delay the message** by adding a delay request parameter in ISO8601 not ```shell humantime - curl "localhost:8080/MyService/myHandler/send?delay=10s" \ + curl "localhost:8080/restate/send/MyService/myHandler?delay=10s" \ --json '{"name": "Mary", "age": 25}' ``` ```shell ISO8601 - curl "localhost:8080/MyService/myHandler/send?delay=PT10S" \ + curl "localhost:8080/restate/send/MyService/myHandler?delay=PT10S" \ --json '{"name": "Mary", "age": 25}' ``` @@ -96,7 +115,7 @@ You can **delay the message** by adding a delay request parameter in ISO8601 not You can send requests to Restate providing an idempotency key, through the [`Idempotency-Key` header](https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/): ```shell -curl localhost:8080/MyService/myHandler \ +curl localhost:8080/restate/call/MyService/myHandler \ -H 'idempotency-key: ad5472esg4dsg525dssdfa5loi' \ --json '{"name": "Mary", "age": 25}' ``` @@ -113,6 +132,29 @@ Check out the [service configuration docs](/services/configuration) to tune the +## Scopes + + + Scopes are part of the flow control feature. + Scoped invocations are rejected unless the server is started with the experimental `vqueues` feature enabled (`experimental-enable-vqueues = true`). + + +A scope is an opaque key that assigns an invocation to scope, which Restate uses to apply flow control across invocations that share the same scope. +Add a `scope/{scopeKey}` segment in front of the `call` or `send` verb: + +``` +POST /restate/scope/{scopeKey}/call/{service}/{handler} +POST /restate/scope/{scopeKey}/call/{service}/{key}/{handler} +POST /restate/scope/{scopeKey}/send/{service}/{handler} +POST /restate/scope/{scopeKey}/send/{service}/{key}/{handler} +``` + +For example, to call `MyService/myHandler` within the scope `tenant-a`: + +```shell +curl localhost:8080/restate/scope/tenant-a/call/MyService/myHandler \ + --json '{"name": "Mary", "age": 25}' +``` ## Cancel @@ -129,32 +171,62 @@ curl -X PATCH http://localhost:9070/invocations/inv_1gdJBtdVEcM942bjcDmb1c1khoaJ ## Attach to an invocation -Restate allows you to retrieve the result of workflows and invocations with an idempotency key. +Restate allows you to retrieve the result of workflows and invocations that used an idempotency key. There are two options: -- To **attach** to an invocation or workflow and wait for it to finish, use `/attach`. -- To **peek at the output** of an invocation or workflow, use `/output`. This will return: - - `{"message":"not ready"}` for ongoing workflows - - The result for finished workflows - - `{"message":"not found"}` for non-existing workflows +- To **attach** to an invocation or workflow and wait for it to finish, use `attach`. +- To **peek at the output** of an invocation or workflow, use `output`. This will return: + - `{"message":"not ready"}` for ongoing invocations + - The result for finished invocations + - `{"message":"not found"}` for non-existing invocations + +### By invocation ID -You can attach to a service/object invocation only if the invocation used an idempotency key: +If you already have the invocation ID, attach to it or read its output with a `GET` request: ```shell -# Via invocation ID -curl localhost:8080/restate/invocation/myInvocationId/attach -curl localhost:8080/restate/invocation/myInvocationId/output +curl localhost:8080/restate/attach/myInvocationId +curl localhost:8080/restate/output/myInvocationId +``` + +### By target + +If you don't have the invocation ID, send a `POST` request to `/restate/attach` or `/restate/output` with a JSON body describing the workflow or idempotency target: + + -# For Services, via idempotency key -curl localhost:8080/restate/invocation/MyService/myHandler/myIdempotencyKey/attach -curl localhost:8080/restate/invocation/MyService/myHandler/myIdempotencyKey/output + ```shell Workflow + curl localhost:8080/restate/attach \ + --json '{"type": "workflow", "name": "MyWorkflow", "key": "myWorkflowId"}' + ``` -# For Virtual Objects, via idempotency key -curl localhost:8080/restate/invocation/myObject/myKey/myHandler/myIdempotencyKey/attach -curl localhost:8080/restate/invocation/myObject/myKey/myHandler/myIdempotencyKey/output + ```shell Service + curl localhost:8080/restate/attach \ + --json '{"type": "idempotency", "service": "MyService", "handler": "myHandler", "idempotencyKey": "myIdempotencyKey"}' + ``` -# For Workflows, with the Workflow ID -curl localhost:8080/restate/workflow/MyWorkflow/myWorkflowId/attach -curl localhost:8080/restate/workflow/MyWorkflow/myWorkflowId/output + ```shell Virtual Object + curl localhost:8080/restate/attach \ + --json '{"type": "idempotency", "service": "MyVirtualObject", "serviceKey": "myKey", "handler": "myHandler", "idempotencyKey": "myIdempotencyKey"}' + ``` + + + +Use the same body shape against `/restate/output` to peek at the result. +If the target was invoked within a [scope](#scopes), add the optional `"scope"` field to the body. + +### Looking up the invocation ID + +To resolve a workflow or idempotency target into its invocation ID, send a `POST` request to `/restate/lookup` with the same body shape as above: + +```shell +curl localhost:8080/restate/lookup \ + --json '{"type": "workflow", "name": "MyWorkflow", "key": "myWorkflowId"}' +``` + +The response contains the invocation ID, which you can then pass to the `GET` attach and output endpoints: + +```json +{"invocationId": "inv_1aiqX0vFEFNH1Umgre58JiCLgHfTtztYK5"} ``` ## OpenAPI support diff --git a/docs/snippets/quickstart/durable-execution-explanation-request.mdx b/docs/snippets/quickstart/durable-execution-explanation-request.mdx index 64388035..68f5e76e 100644 --- a/docs/snippets/quickstart/durable-execution-explanation-request.mdx +++ b/docs/snippets/quickstart/durable-execution-explanation-request.mdx @@ -1,7 +1,7 @@ Send a request for `Alice` to see how the service behaves when it occasionally fails to send the reminder and notification: ```shell -curl localhost:8080/Greeter/greet --json '{"name": "Alice"}' +curl localhost:8080/restate/call/Greeter/greet --json '{"name": "Alice"}' ``` Expected output: ```shell diff --git a/docs/snippets/quickstart/send-request.mdx b/docs/snippets/quickstart/send-request.mdx index 58decaac..f95a99b7 100644 --- a/docs/snippets/quickstart/send-request.mdx +++ b/docs/snippets/quickstart/send-request.mdx @@ -4,7 +4,7 @@ Invoke the service via the Restate UI playground: go to `http://localhost:9070`, Or invoke via `curl`: ```shell -curl localhost:8080/Greeter/greet --json '{"name": "Sarah"}' +curl localhost:8080/restate/call/Greeter/greet --json '{"name": "Sarah"}' ``` Expected output: `You said hi to Sarah!` \ No newline at end of file diff --git a/docs/tour/microservice-orchestration.mdx b/docs/tour/microservice-orchestration.mdx index a8d1a7b6..ff5740f1 100644 --- a/docs/tour/microservice-orchestration.mdx +++ b/docs/tour/microservice-orchestration.mdx @@ -189,7 +189,7 @@ This registers a set of services that we will be covering in this tutorial. To invoke a handler, send a request to `restate-ingress/MyServiceName/handlerName`: ```bash -curl localhost:8080/SubscriptionService/add \ +curl localhost:8080/restate/call/SubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime"]}' ``` @@ -214,7 +214,7 @@ This registers a set of services that we will be covering in this tutorial. To invoke a handler, send a request to `restate-ingress/MyServiceName/handlerName`: ```bash -curl localhost:8080/SubscriptionService/add \ +curl localhost:8080/restate/call/SubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime"]}' ``` @@ -238,7 +238,7 @@ This registers a set of services that we will be covering in this tutorial. To invoke a handler, send a request to `restate-ingress/MyServiceName/handlerName`: ```bash -curl localhost:8080/SubscriptionService/Add \ +curl localhost:8080/restate/call/SubscriptionService/Add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime"]}' ``` @@ -262,7 +262,7 @@ This registers a set of services that we will be covering in this tutorial. To invoke a handler, send a request to `restate-ingress/MyServiceName/handlerName`: ```bash -curl localhost:8080/SubscriptionService/add \ +curl localhost:8080/restate/call/SubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime"]}' ``` @@ -297,7 +297,7 @@ This process continues until the handler runs till completion. Try to add a subscription for Netflix: ```bash -curl localhost:8080/SubscriptionService/add \ +curl localhost:8080/restate/call/SubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "Netflix"]}' ``` @@ -326,7 +326,7 @@ export function createSubscription( Try to add a subscription for Netflix: ```bash -curl localhost:8080/SubscriptionService/add \ +curl localhost:8080/restate/call/SubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "Netflix"]}' ``` @@ -352,7 +352,7 @@ public static String createSubscription(String userId, String subscription, Stri Try to add a subscription for Netflix: ```bash -curl localhost:8080/SubscriptionService/Add \ +curl localhost:8080/restate/call/SubscriptionService/Add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "Netflix"]}' ``` @@ -380,7 +380,7 @@ func CreateSubscription(userId, subscription, paymentRef string) (string, error) Try to add a subscription for Netflix: ```bash -curl localhost:8080/SubscriptionService/add \ +curl localhost:8080/restate/call/SubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "Netflix"]}' ``` @@ -747,25 +747,25 @@ Add a subscription for Disney: ```bash -curl localhost:8080/SubscriptionSaga/add \ +curl localhost:8080/restate/call/SubscriptionSaga/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "Disney"]}' ``` ```bash -curl localhost:8080/SubscriptionSaga/add \ +curl localhost:8080/restate/call/SubscriptionSaga/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "Disney"]}' ``` ```bash -curl localhost:8080/SubscriptionSaga/Add \ +curl localhost:8080/restate/call/SubscriptionSaga/Add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "Disney"]}' ``` ```bash -curl localhost:8080/SubscriptionSaga/add \ +curl localhost:8080/restate/call/SubscriptionSaga/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "Disney"]}' ``` @@ -977,54 +977,54 @@ To call a Virtual Object, you specify the object key in the URL (here `user-123` ```bash -curl localhost:8080/UserSubscriptions/user-123/add --json '"Hulu"' -curl localhost:8080/UserSubscriptions/user-123/add --json '"Prime"' -curl localhost:8080/UserSubscriptions/user-123/add --json '"Disney"' -curl localhost:8080/UserSubscriptions/user-456/add --json '"Netflix"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Hulu"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Prime"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Disney"' +curl localhost:8080/restate/call/UserSubscriptions/user-456/add --json '"Netflix"' ``` Get the subscriptions for `user-123`: ```bash -curl localhost:8080/UserSubscriptions/user-123/getSubscriptions +curl localhost:8080/restate/call/UserSubscriptions/user-123/getSubscriptions ``` ```bash -curl localhost:8080/UserSubscriptions/user-123/add --json '"Hulu"' -curl localhost:8080/UserSubscriptions/user-123/add --json '"Prime"' -curl localhost:8080/UserSubscriptions/user-123/add --json '"Disney"' -curl localhost:8080/UserSubscriptions/user-456/add --json '"Netflix"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Hulu"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Prime"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Disney"' +curl localhost:8080/restate/call/UserSubscriptions/user-456/add --json '"Netflix"' ``` Get the subscriptions for `user-123`: ```bash -curl localhost:8080/UserSubscriptions/user-123/getSubscriptions +curl localhost:8080/restate/call/UserSubscriptions/user-123/getSubscriptions ``` ```bash -curl localhost:8080/UserSubscriptions/user-123/Add --json '"Hulu"' -curl localhost:8080/UserSubscriptions/user-123/Add --json '"Prime"' -curl localhost:8080/UserSubscriptions/user-123/Add --json '"Disney"' -curl localhost:8080/UserSubscriptions/user-456/Add --json '"Netflix"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/Add --json '"Hulu"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/Add --json '"Prime"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/Add --json '"Disney"' +curl localhost:8080/restate/call/UserSubscriptions/user-456/Add --json '"Netflix"' ``` Get the subscriptions for `user-123`: ```bash -curl localhost:8080/UserSubscriptions/user-123/GetSubscriptions +curl localhost:8080/restate/call/UserSubscriptions/user-123/GetSubscriptions ``` ```bash -curl localhost:8080/UserSubscriptions/user-123/add --json '"Hulu"' -curl localhost:8080/UserSubscriptions/user-123/add --json '"Prime"' -curl localhost:8080/UserSubscriptions/user-123/add --json '"Disney"' -curl localhost:8080/UserSubscriptions/user-456/add --json '"Netflix"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Hulu"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Prime"' +curl localhost:8080/restate/call/UserSubscriptions/user-123/add --json '"Disney"' +curl localhost:8080/restate/call/UserSubscriptions/user-456/add --json '"Netflix"' ``` Get the subscriptions for `user-123`: ```bash -curl localhost:8080/UserSubscriptions/user-123/getSubscriptions +curl localhost:8080/restate/call/UserSubscriptions/user-123/getSubscriptions ``` @@ -1152,7 +1152,7 @@ Buy a concert ticket: ```bash -curl localhost:8080/ConcertTicketingService/buy --json '{ +curl localhost:8080/restate/call/ConcertTicketingService/buy --json '{ "ticketId": "ticket-789", "price": 100, "customerEmail": "me@mail.com", @@ -1162,7 +1162,7 @@ curl localhost:8080/ConcertTicketingService/buy --json '{ ```bash -curl localhost:8080/ConcertTicketingService/buy --json '{ +curl localhost:8080/restate/call/ConcertTicketingService/buy --json '{ "ticketId": "ticket-789", "price": 100, "customerEmail": "me@mail.com", @@ -1172,7 +1172,7 @@ curl localhost:8080/ConcertTicketingService/buy --json '{ ```bash -curl localhost:8080/ConcertTicketingService/Buy --json '{ +curl localhost:8080/restate/call/ConcertTicketingService/Buy --json '{ "ticketId": "ticket-789", "price": 100, "customerEmail": "me@mail.com", @@ -1182,7 +1182,7 @@ curl localhost:8080/ConcertTicketingService/Buy --json '{ ```bash -curl localhost:8080/ConcertTicketingService/buy --json '{ +curl localhost:8080/restate/call/ConcertTicketingService/buy --json '{ "ticketId": "ticket-789", "price": 100, "customerEmail": "me@mail.com", @@ -1211,7 +1211,7 @@ Add an idempotency header to your request: ```shell -curl -X POST localhost:8080/ConcertTicketingService/buy \ +curl -X POST localhost:8080/restate/call/ConcertTicketingService/buy \ -H 'Idempotency-Key: unique-key-123' \ --json '{"ticketId": "ticket-789", "price": 100, "customerEmail": "me@mail.com", "concertDate": "2023-10-01T20:00:00Z"}' ``` @@ -1219,7 +1219,7 @@ curl -X POST localhost:8080/ConcertTicketingService/buy \ ```shell -curl -X POST localhost:8080/ConcertTicketingService/buy \ +curl -X POST localhost:8080/restate/call/ConcertTicketingService/buy \ -H 'Idempotency-Key: unique-key-123' \ --json '{"ticketId": "ticket-789", "price": 100, "customerEmail": "me@mail.com", "concertDate": "2023-10-01T20:00:00Z"}' ``` @@ -1227,7 +1227,7 @@ curl -X POST localhost:8080/ConcertTicketingService/buy \ ```shell -curl -X POST localhost:8080/ConcertTicketingService/Buy \ +curl -X POST localhost:8080/restate/call/ConcertTicketingService/Buy \ -H 'Idempotency-Key: unique-key-123' \ --json '{"ticketId": "ticket-789", "price": 100, "customerEmail": "me@mail.com", "concertDate": "2023-10-01T20:00:00Z"}' ``` @@ -1235,7 +1235,7 @@ curl -X POST localhost:8080/ConcertTicketingService/Buy \ ```shell -curl -X POST localhost:8080/ConcertTicketingService/buy \ +curl -X POST localhost:8080/restate/call/ConcertTicketingService/buy \ -H 'Idempotency-Key: unique-key-123' \ --json '{"ticketId": "ticket-789", "price": 100, "customerEmail": "me@mail.com", "concertDate": "2023-10-01T20:00:00Z"}' ``` @@ -1391,29 +1391,29 @@ You can also use awakeables to implement human-in-the-loop interactions, such as -Initiate a payment by calling the `process` handler. Add `/send` to call the handler without waiting for the response: +Initiate a payment by calling the `process` handler. Use the `send` verb to call the handler without waiting for the response: ```bash -curl localhost:8080/Payments/process/send \ +curl localhost:8080/restate/send/Payments/process \ --json '{"amount": 100, "currency": "USD", "customerId": "cust-123", "orderId": "order-456"}' ``` ```bash -curl localhost:8080/Payments/process/send \ +curl localhost:8080/restate/send/Payments/process \ --json '{"amount": 100, "currency": "USD", "customerId": "cust-123", "orderId": "order-456"}' ``` ```bash -curl localhost:8080/Payments/Process/send \ +curl localhost:8080/restate/send/Payments/Process \ --json '{"amount": 100, "currency": "USD", "customerId": "cust-123", "orderId": "order-456"}' ``` ```bash -curl localhost:8080/Payments/process/send \ +curl localhost:8080/restate/send/Payments/process \ --json '{"amount": 100, "currency": "USD", "customerId": "cust-123", "orderId": "order-456"}' ``` @@ -1427,25 +1427,25 @@ Simulate approving the payment by executing the **curl request that was printed ```bash -curl localhost:8080/Payments/confirm \ +curl localhost:8080/restate/call/Payments/confirm \ --json '{"id": "sign_1PrDkbECjgdsBmMfEUQyCnioCP-csLbd2AAAAEQ", "result": {"success": true, "transactionId": "txn-123"}}' ``` ```bash -curl localhost:8080/Payments/confirm \ +curl localhost:8080/restate/call/Payments/confirm \ --json '{"id": "sign_1PrDkbECjgdsBmMfEUQyCnioCP-csLbd2AAAAEQ", "result": {"success": true, "transactionId": "txn-123"}}' ``` ```bash -curl localhost:8080/Payments/Confirm \ +curl localhost:8080/restate/call/Payments/Confirm \ --json '{"id": "sign_1PrDkbECjgdsBmMfEUQyCnioCP-csLbd2AAAAEQ", "result": {"success": true, "transactionId": "txn-123"}}' ``` ```bash -curl localhost:8080/Payments/confirm \ +curl localhost:8080/restate/call/Payments/confirm \ --json '{"id": "sign_1PrDkbECjgdsBmMfEUQyCnioCP-csLbd2AAAAEQ", "result": {"success": true, "transactionId": "txn-123"}}' ``` @@ -1636,29 +1636,29 @@ You can also set timeouts for RPC calls or other asynchronous operations with th -Initiate a payment by calling the `process` handler. Add `/send` to call the handler without waiting for the response: +Initiate a payment by calling the `process` handler. Use the `send` verb to call the handler without waiting for the response: ```bash -curl localhost:8080/PaymentsWithTimeout/process/send \ +curl localhost:8080/restate/send/PaymentsWithTimeout/process \ --json '{"amount": 100, "currency": "USD", "customerId": "cust-123", "orderId": "order-456"}' ``` ```bash -curl localhost:8080/PaymentsWithTimeout/process/send \ +curl localhost:8080/restate/send/PaymentsWithTimeout/process \ --json '{"amount": 100, "currency": "USD", "customerId": "cust-123", "orderId": "order-456"}' ``` ```bash -curl localhost:8080/PaymentsWithTimeout/Process/send \ +curl localhost:8080/restate/send/PaymentsWithTimeout/Process \ --json '{"amount": 100, "currency": "USD", "customerId": "cust-123", "orderId": "order-456"}' ``` ```bash -curl localhost:8080/PaymentsWithTimeout/process/send \ +curl localhost:8080/restate/send/PaymentsWithTimeout/process \ --json '{"amount": 100, "currency": "USD", "customerId": "cust-123", "orderId": "order-456"}' ``` @@ -1833,25 +1833,25 @@ Add a few subscriptions for some users. ```bash -curl localhost:8080/ParallelSubscriptionService/add \ +curl localhost:8080/restate/call/ParallelSubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "YouTube"]}' ``` ```bash -curl localhost:8080/ParallelSubscriptionService/add \ +curl localhost:8080/restate/call/ParallelSubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "YouTube"]}' ``` ```bash -curl localhost:8080/ParallelSubscriptionService/Add \ +curl localhost:8080/restate/call/ParallelSubscriptionService/Add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "YouTube"]}' ``` ```bash -curl localhost:8080/ParallelSubscriptionService/add \ +curl localhost:8080/restate/call/ParallelSubscriptionService/add \ --json '{"userId": "user-123", "creditCard": "4111111111111111", "subscriptions": ["Hulu", "Prime", "YouTube"]}' ``` diff --git a/docs/tour/workflows.mdx b/docs/tour/workflows.mdx index 49186107..af330412 100644 --- a/docs/tour/workflows.mdx +++ b/docs/tour/workflows.mdx @@ -261,25 +261,25 @@ To submit the workflow via HTTP send the request to `restate-ingress/workflow-na ```bash - curl localhost:8080/SignupWorkflow/johndoe/run \ + curl localhost:8080/restate/call/SignupWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWorkflow/johndoe/run \ + curl localhost:8080/restate/call/SignupWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWorkflow/johndoe/Run \ + curl localhost:8080/restate/call/SignupWorkflow/johndoe/Run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWorkflow/johndoe/run \ + curl localhost:8080/restate/call/SignupWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` @@ -377,25 +377,25 @@ You can schedule a workflow to run at a later time by specifying a delay: ```bash - curl "localhost:8080/SignupWorkflow/petewhite/run/send?delay=5m" \ + curl "localhost:8080/restate/send/SignupWorkflow/petewhite/run?delay=5m" \ --json '{"name": "Pete White", "email": "pete@mail.com"}' ``` ```bash - curl "localhost:8080/SignupWorkflow/petewhite/run/send?delay=5m" \ + curl "localhost:8080/restate/send/SignupWorkflow/petewhite/run?delay=5m" \ --json '{"name": "Pete White", "email": "pete@mail.com"}' ``` ```bash - curl "localhost:8080/SignupWorkflow/petewhite/Run/send?delay=5m" \ + curl "localhost:8080/restate/send/SignupWorkflow/petewhite/Run?delay=5m" \ --json '{"name": "Pete White", "email": "pete@mail.com"}' ``` ```bash - curl "localhost:8080/SignupWorkflow/petewhite/run/send?delay=5m" \ + curl "localhost:8080/restate/send/SignupWorkflow/petewhite/run?delay=5m" \ --json '{"name": "Pete White", "email": "pete@mail.com"}' ``` @@ -408,7 +408,8 @@ Have a look at the SDK docs to learn how to schedule workflows programmatically If a workflow is already ongoing, you can also attach to it to get the result once it finishes: ```bash -curl localhost:8080/restate/workflow/SignupWorkflow/johndoe/attach +curl localhost:8080/restate/attach \ + --json '{"type": "workflow", "name": "SignupWorkflow", "key": "johndoe"}' ``` Have a look at the SDK docs to learn how to attach to workflows programmatically ([TS](/services/invocation/clients/typescript-sdk) / [Java](/services/invocation/clients/java-sdk) / [Go](/services/invocation/clients/go-sdk)). @@ -434,25 +435,25 @@ Send a request for Alice: ```bash - curl localhost:8080/SignupWorkflow/alicedoe/run \ + curl localhost:8080/restate/call/SignupWorkflow/alicedoe/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWorkflow/alicedoe/run \ + curl localhost:8080/restate/call/SignupWorkflow/alicedoe/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWorkflow/alicedoe/Run \ + curl localhost:8080/restate/call/SignupWorkflow/alicedoe/Run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWorkflow/alicedoe/run \ + curl localhost:8080/restate/call/SignupWorkflow/alicedoe/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` @@ -632,25 +633,25 @@ Submit the workflow: ```bash - curl localhost:8080/SignupWithActivitiesWorkflow/carl/run \ + curl localhost:8080/restate/call/SignupWithActivitiesWorkflow/carl/run \ --json '{"name": "Carl", "email": "carl@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithActivitiesWorkflow/carl/run \ + curl localhost:8080/restate/call/SignupWithActivitiesWorkflow/carl/run \ --json '{"name": "Carl", "email": "carl@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithActivitiesWorkflow/carl/Run \ + curl localhost:8080/restate/call/SignupWithActivitiesWorkflow/carl/Run \ --json '{"name": "Carl", "email": "carl@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithActivitiesWorkflow/carl/run \ + curl localhost:8080/restate/call/SignupWithActivitiesWorkflow/carl/run \ --json '{"name": "Carl", "email": "carl@mail.com"}' ``` @@ -843,25 +844,25 @@ Submit the workflow: ```bash - curl localhost:8080/SignupWithQueriesWorkflow/janedoe/run \ + curl localhost:8080/restate/call/SignupWithQueriesWorkflow/janedoe/run \ --json '{"name": "Jane Doe", "email": "jane@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithQueriesWorkflow/janedoe/run \ + curl localhost:8080/restate/call/SignupWithQueriesWorkflow/janedoe/run \ --json '{"name": "Jane Doe", "email": "jane@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithQueriesWorkflow/janedoe/Run \ + curl localhost:8080/restate/call/SignupWithQueriesWorkflow/janedoe/Run \ --json '{"name": "Jane Doe", "email": "jane@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithQueriesWorkflow/janedoe/run \ + curl localhost:8080/restate/call/SignupWithQueriesWorkflow/janedoe/run \ --json '{"name": "Jane Doe", "email": "jane@mail.com"}' ``` @@ -1019,29 +1020,29 @@ You can use Restate's Durable Promises to handle asynchronous events without com Promises can be resolved before the workflow waits for them, avoiding complex synchronization issues. -Submit the workflow asynchronously with `/send`: +Submit the workflow asynchronously with the `send` verb: ```bash - curl localhost:8080/SignupWithSignalsWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithSignalsWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithSignalsWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/johndoe/Run/send \ + curl localhost:8080/restate/send/SignupWithSignalsWorkflow/johndoe/Run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithSignalsWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` @@ -1058,25 +1059,25 @@ To resolve the promise, **copy over the curl request from the service logs**, wh ```bash - curl localhost:8080/SignupWithSignalsWorkflow/johndoe/verifyEmail \ + curl localhost:8080/restate/call/SignupWithSignalsWorkflow/johndoe/verifyEmail \ --json '{"secret": "the-secret-from-email"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/johndoe/verifyEmail \ + curl localhost:8080/restate/call/SignupWithSignalsWorkflow/johndoe/verifyEmail \ --json '{"secret": "the-secret-from-email"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/johndoe/VerifyEmail \ + curl localhost:8080/restate/call/SignupWithSignalsWorkflow/johndoe/VerifyEmail \ --json '{"secret": "the-secret-from-email"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/johndoe/verifyEmail \ + curl localhost:8080/restate/call/SignupWithSignalsWorkflow/johndoe/verifyEmail \ --json '{"secret": "the-secret-from-email"}' ``` @@ -1242,50 +1243,50 @@ Here, external clients can wait for the user to be created in the database. These handlers can be called up to the workflow's retention period ([default one day](/services/configuration#workflow-retention). -Submit the workflow asynchronously with `/send`: +Submit the workflow asynchronously with the `send` verb: ```bash - curl localhost:8080/SignupWithEventsWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithEventsWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` Then wait for the user creation event: ```bash - curl localhost:8080/SignupWithEventsWorkflow/johndoe/waitForUserCreation + curl localhost:8080/restate/call/SignupWithEventsWorkflow/johndoe/waitForUserCreation ``` ```bash - curl localhost:8080/SignupWithEventsWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithEventsWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` Then wait for the user creation event: ```bash - curl localhost:8080/SignupWithEventsWorkflow/johndoe/waitForUserCreation + curl localhost:8080/restate/call/SignupWithEventsWorkflow/johndoe/waitForUserCreation ``` ```bash - curl localhost:8080/SignupWithEventsWorkflow/johndoe/Run/send \ + curl localhost:8080/restate/send/SignupWithEventsWorkflow/johndoe/Run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` Then wait for the user creation event: ```bash - curl localhost:8080/SignupWithEventsWorkflow/johndoe/WaitForUserCreation + curl localhost:8080/restate/call/SignupWithEventsWorkflow/johndoe/WaitForUserCreation ``` ```bash - curl localhost:8080/SignupWithEventsWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithEventsWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` Then wait for the user creation event: ```bash - curl localhost:8080/SignupWithEventsWorkflow/johndoe/waitForUserCreation + curl localhost:8080/restate/call/SignupWithEventsWorkflow/johndoe/waitForUserCreation ``` @@ -1528,29 +1529,29 @@ Because Restate lets you write workflows as regular functions, you can use your This makes it easy to implement complex logic with timers, loops, and conditional execution. -Submit the workflow asynchronously with `/send`: +Submit the workflow asynchronously with the `send` verb: ```bash - curl localhost:8080/SignupWithTimersWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithTimersWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithTimersWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithTimersWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithTimersWorkflow/johndoe/Run/send \ + curl localhost:8080/restate/send/SignupWithTimersWorkflow/johndoe/Run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithTimersWorkflow/johndoe/run/send \ + curl localhost:8080/restate/send/SignupWithTimersWorkflow/johndoe/run \ --json '{"name": "John Doe", "email": "john@mail.com"}' ``` @@ -1568,25 +1569,25 @@ To resolve the promise, **copy over the curl request from the service logs**, wh ```bash - curl localhost:8080/SignupWithTimersWorkflow/johndoe/verifyEmail \ + curl localhost:8080/restate/call/SignupWithTimersWorkflow/johndoe/verifyEmail \ --json '{"secret": "the-secret-from-email"}' ``` ```bash - curl localhost:8080/SignupWithTimersWorkflow/johndoe/verifyEmail \ + curl localhost:8080/restate/call/SignupWithTimersWorkflow/johndoe/verifyEmail \ --json '{"secret": "the-secret-from-email"}' ``` ```bash - curl localhost:8080/SignupWithTimersWorkflow/johndoe/verifyEmail \ + curl localhost:8080/restate/call/SignupWithTimersWorkflow/johndoe/verifyEmail \ --json '{"secret": "the-secret-from-email"}' ``` ```bash - curl localhost:8080/SignupWithTimersWorkflow/johndoe/verifyEmail \ + curl localhost:8080/restate/call/SignupWithTimersWorkflow/johndoe/verifyEmail \ --json '{"secret": "the-secret-from-email"}' ``` @@ -1765,25 +1766,25 @@ Submit the workflow for Alice: ```bash - curl localhost:8080/SignupWithRetriesWorkflow/alice/run \ + curl localhost:8080/restate/call/SignupWithRetriesWorkflow/alice/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithRetriesWorkflow/alice/run \ + curl localhost:8080/restate/call/SignupWithRetriesWorkflow/alice/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithRetriesWorkflow/alice/Run \ + curl localhost:8080/restate/call/SignupWithRetriesWorkflow/alice/Run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithRetriesWorkflow/alice/run \ + curl localhost:8080/restate/call/SignupWithRetriesWorkflow/alice/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` @@ -2016,25 +2017,25 @@ Submit the workflow for Alice: ```bash - curl localhost:8080/SignupWithSagasWorkflow/alice/run \ + curl localhost:8080/restate/call/SignupWithSagasWorkflow/alice/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSagasWorkflow/alice/run \ + curl localhost:8080/restate/call/SignupWithSagasWorkflow/alice/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSagasWorkflow/alice/Run \ + curl localhost:8080/restate/call/SignupWithSagasWorkflow/alice/Run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSagasWorkflow/alice/run \ + curl localhost:8080/restate/call/SignupWithSagasWorkflow/alice/run \ --json '{"name": "Alice", "email": "alice@mail.com"}' ``` @@ -2060,29 +2061,29 @@ Then, the cancellation propagates back up the tree, allowing each handler to run -Start the workflow asynchronously with `/send`: +Start the workflow asynchronously with the `send` verb: ```bash - curl localhost:8080/SignupWithSignalsWorkflow/eve/run/send \ + curl localhost:8080/restate/send/SignupWithSignalsWorkflow/eve/run \ --json '{"name": "Eve", "email": "eve@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/eve/run/send \ + curl localhost:8080/restate/send/SignupWithSignalsWorkflow/eve/run \ --json '{"name": "Eve", "email": "eve@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/eve/Run/send \ + curl localhost:8080/restate/send/SignupWithSignalsWorkflow/eve/Run \ --json '{"name": "Eve", "email": "eve@mail.com"}' ``` ```bash - curl localhost:8080/SignupWithSignalsWorkflow/eve/run/send \ + curl localhost:8080/restate/send/SignupWithSignalsWorkflow/eve/run \ --json '{"name": "Eve", "email": "eve@mail.com"}' ``` diff --git a/snippets/ts/src/ai/guides/chat-ui/http_requests.js b/snippets/ts/src/ai/guides/chat-ui/http_requests.js index 3bc1f16a..67d19288 100644 --- a/snippets/ts/src/ai/guides/chat-ui/http_requests.js +++ b/snippets/ts/src/ai/guides/chat-ui/http_requests.js @@ -1,15 +1,15 @@ async function main() { // // Request-response - const response = await fetch("http://localhost:8080/my-agent/run", { + const response = await fetch("http://localhost:8080/restate/call/my-agent/run", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: "How are you?" }), }); const result = await response.json(); - // Fire-and-forget: add /send to the URL - await fetch("http://localhost:8080/my-agent/run/send", { + // Fire-and-forget: use the /restate/send/... path + await fetch("http://localhost:8080/restate/send/my-agent/run", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ message: "How are you?" }), @@ -17,7 +17,7 @@ async function main() { // // - await fetch("http://localhost:8080/my-agent/run/send", { + await fetch("http://localhost:8080/restate/send/my-agent/run", { method: "POST", headers: { "Content-Type": "application/json", @@ -31,7 +31,7 @@ async function main() { async function main2() { // // start the invocation - const handle = await fetch("http://localhost:8080/agent/run/send", { + const handle = await fetch("http://localhost:8080/restate/send/agent/run", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify("How are you?"), @@ -40,9 +40,9 @@ async function main2() { // retrieve the invocationId const { invocationId, status } = await handle.json(); - // retrieve the result + // retrieve the result by attaching to the invocation id const result = await fetch( - `http://localhost:8080/restate/invocation/${invocationId}/attach`, + `http://localhost:8080/restate/attach/${invocationId}`, { method: "GET" } ); await result.json(); @@ -51,12 +51,18 @@ async function main2() { async function main3() { // - // start the invocation with idempotency key + // attach via the idempotency key of an earlier invocation const idempotencyKey = "abc-123"; - const result = await fetch( - `http://localhost:8080/restate/invocation/agent/run/${idempotencyKey}/attach`, - { method: "GET" } - ); + const result = await fetch(`http://localhost:8080/restate/attach`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + type: "idempotency", + service: "agent", + handler: "run", + idempotencyKey, + }), + }); await result.json(); // }