AgentWorkshop.Store (AgentWorkshop v0.3.0)

Copy Markdown View Source

Shared key-value store for agent coordination.

A scratchpad that agents and humans can read and write. Useful for sharing specs, coordination data, accumulated results, and runtime configuration across agents.

The store is backed by ETS and survives agent resets (it's Workshop-level state, not per-agent). It does not survive Workshop restarts.

From IEx

import AgentWorkshop.Workshop

put(:spec, "LRU cache with 1000 entries and 5 min TTL")
get(:spec)
keys()

From agents (via MCP tools)

Agents with MCP access can use workshop_put, workshop_get, workshop_keys.

Namespacing

Keys can be any term. Use tuples for namespacing:

put({:impl, :notes}, "Chose GenServer over Agent for state")
put({:spec, :cache}, "LRU with TTL support")
keys()  # => [{:impl, :notes}, {:spec, :cache}]

Summary

Functions

Clear all entries from the store.

Delete a key from the store.

List all key-value pairs.

Get a value from the store. Returns nil if not found.

Get a value with a default if not found.

List all keys in the store.

Put a value in the store.

Functions

clear()

@spec clear() :: :ok

Clear all entries from the store.

delete(key)

@spec delete(term()) :: :ok

Delete a key from the store.

entries()

@spec entries() :: [{term(), term()}]

List all key-value pairs.

get(key)

@spec get(term()) :: term() | nil

Get a value from the store. Returns nil if not found.

get(key, default)

@spec get(term(), term()) :: term()

Get a value with a default if not found.

keys()

@spec keys() :: [term()]

List all keys in the store.

put(key, value)

@spec put(term(), term()) :: :ok

Put a value in the store.

Examples

Store.put(:spec, "Implement LRU cache")
Store.put({:impl, :notes}, "Using GenServer")