Data Storage
Data Storage in Agent Orbit
Agent Orbit provides a robust key-value store for agents to persist and share data. Each store is independent and can be attached to multiple agents, enabling seamless collaboration or isolated data handling.
Key Features
Persistence: Stores remain intact even if agents are deleted.
Shared Access: A single store can be shared between multiple agents.
Atomic Transactions: Ensure consistent state with transaction support.
Locking: Prevent conflicts in concurrent executions.
Creating a Store
You can create a store via:
Dashboard: Easily create and manage stores visually.
API/SDK: Programmatically handle stores for advanced workflows.
Accessing a Store
Once a store is attached to an agent, it becomes accessible via the store argument in the agent's main function:
Using a Store
The store object behaves like a Python dictionary. Here are common operations:
Supported Types
Keys: Must be strings (
store["key"] = value).Values: Must be JSON-serializable (strings, numbers, lists, dicts, etc.).
Example of valid operations:
Transactions
Transactions allow you to group operations and ensure they either complete fully or roll back entirely in case of errors:
If an exception occurs during the transaction, all changes will be reverted.
Locking
For concurrent executions, locking ensures that only one execution can modify the store at a time:
Why Locking Matters
Without locking, concurrent executions can result in race conditions:
Agent A reads the value of
runs(e.g.,0).Agent B reads the value of
runs(also0).Agent A increments and writes
1.Agent B increments and writes
1.
With locking, these operations happen sequentially, ensuring runs is incremented correctly.
Agent Orbit’s data storage offers powerful tools to simplify agent workflows while maintaining consistency and reliability. Start leveraging stores for your agents today!
Last updated