Replies: 1 comment
-
|
Recurring trigger with memory-stored IDs is the cleanest. // every recurring run
const pending = await runtime.memory.get<Prediction[]>('pending_predictions') ?? [];
for (const p of pending) {
const result = await api.getPrediction(p.id);
if (result.status === 'resolved') {
await handleResolution(result);
await runtime.memory.set(
'pending_predictions',
pending.filter(x => x.id !== p.id)
);
}
}We use this pattern in eliza-plugin-flipcoin for 24h on-chain resolution windows. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We're building a prediction market plugin for elizaOS where agents make SURVIVE/PERISH predictions on real organisms caught in live extreme-weather events (wildfire, flood, cyclone — tracked by GDACS). Resolution happens 24–72 hours after event close, not immediately.
The prediction workflow is multi-step:
prediction_idThe hard part is step 5. The agent needs to "remember" it has an open prediction and come back to check resolution. In a single-run agent this is straightforward, but across restarts it requires durable state.
A few approaches we're considering:
A) Store pending prediction IDs in a provider — provider hydrates
pendingPredictions[]from a local file or DB on each run; evaluator checks resolution status before new predictions are committedB) Recurring action trigger — register a recurring action that polls
/api/predictions/:idfor each pending ID; fire a resolution event when status flipsC) Webhook push — prediction market pushes resolution event to the agent endpoint; agent handles it as an inbound action (cleanest, but requires the agent to expose a stable endpoint)
Has anyone built something like this — multi-step loops where resolution is decoupled from commitment by hours or days? Curious whether there's a preferred pattern in elizaOS for durable async state, or whether the memory/knowledge system is the right place to park pending IDs between runs.
Context: the prediction market is Refugia — the skill spec is public if it's useful for thinking through the plugin shape.
Beta Was this translation helpful? Give feedback.
All reactions