Conversation
|
Pls, does this mean that, ephemeral agents can't do promises?, for instance, if want an agent that is created, does its work and maybe during the course of its work creates a promise which requires the user's action, let's assume the user delays for hours in which the agent suspends without consuming resources, the user later fulfills the promise, it resumes, completes the work and then dies. An example of this would be a multi step form or survey agent which does not need to be completely durable or everlasting, just durable for the lifetime of the form or survey, where the form the form state has to be saved on the backend (the agent) during the duration of the form and when the form is submitted, the ephemeral agent dies off. |
Ephemeral agents are for short lived, non-durable scenarios, such as a request handler etc. They don't have any durability guarantees, so in case of any crash / rebalancing / etc they just fail (to finish). Because of this, they should not be used for anything long like waiting for an external promise. What you are looking for is the durable agent, I think there is a misunderstanding of what durable vs ephemeral agents differ in. Both durable and ephemeral agents write to the oplog and leave a "trace" that can be observed later with tools like Even though ephemeral agents write an oplog for observability reasons, they never can be recover state like durable agents. That's the difference. If an ephemeral agent goes out of memory, it's gone forever. Also an ephemeral agent can be invoked only once (technically they can be invoked more than once, but they start from empty state every time, and it does not make much sense to do so). Note that the following features are available for durable agents, that may cover what you are looking for:
|
| if record_ephemeral_promise_wait { | ||
| inc_promise_waiting(); | ||
| } | ||
| let either_result = futures::future::select(poll, interrupt_signal).await; |
There was a problem hiding this comment.
We might need to introduce some timeout here, to avoid polluting the executor with ephemeral agents that are blocked on promises that are never getting completed
| let poll = Host::poll(&mut io_data, in_); | ||
| pin_mut!(poll); | ||
|
|
||
| if record_ephemeral_promise_wait { |
There was a problem hiding this comment.
is this guarenteed to be balanced?
There was a problem hiding this comment.
Probably not in case of a crashing executor
i now understand you better, i guess what i was looking for was an auto delete durable agent 😂, so its durable but once it finishes it deletes itself. this means for my use cases, i need to use durable agents but somehow deletes them after because they only serve one particular purpose so it wont be wise to just keep them around, consuming storage when i know it will never be invoked again. |
Resolves #3327
Golem suspends agents in various situations and before this PR, it did so for both durable and ephemeral agents equally. Ephemeral agents cannot recover from being suspended though. This PR changes how each of these suspend cases behave for ephemeral agents:
suspend.ephemeral_max_sleepsuspend.ephemeral_max_sleep, the invocation fails withEphemeralSleepTooLongEphemeralFuelExhausted.EphemeralCannotSuspendinstead of suspending until budget replenishment.EphemeralCannotSuspendinstead of suspending, and no resume action is scheduled for them.The idea for failing on quota exhaustion is that it's the caller's responsibility to retry. If we would allow these ephemeral agents to run, and block them in-memory until they can resume, that could exhaust other resources (as they have to stay in memory for a potentially long time and so on)