Memory SDK Examples
Examples for storing, retrieving, and searching memories using the official SDKs. SDKs are sourced from this repository (not yet published to registries).
Python (async)
python
import asyncio
from aether_sdk import AgentClient, AgentConfig
from aether_sdk.models import MemoryScope
async def main():
config = AgentConfig(
agent_id="docs-python",
agent_name="Docs Python Agent",
hub_url="localhost:9090",
secret="sk-local",
)
async with AgentClient(config) as client:
# Store
await client.memory_store(
key="auth-decision-q1",
content="JWT with 15m access + refresh cookies",
scope=MemoryScope.PROJECT,
project_id=42,
ttl_seconds=3600,
)
# Retrieve
mem = await client.memory_retrieve(key="auth-decision-q1")
print(mem.content)
# Semantic search
results = await client.memory_search(query="jwt expiry decision", project_id=42, limit=5)
for r in results:
print(r.key, r.similarity)
if __name__ == "__main__":
asyncio.run(main())Go (sync)
go
package main
import (
"context"
"fmt"
sdk "github.com/amansrivastava/hacky-automation/sdks/go"
)
func main() {
ctx := context.Background()
client, err := sdk.NewHub(&sdk.HubConfig{
Address: "localhost:9090",
AgentID: "docs-go",
Secret: "sk-local",
})
if err != nil {
panic(err)
}
// Store
if err := client.Memory().Store(ctx, sdk.MemoryStoreRequest{
Key: "auth-decision-q1",
Content: "JWT with 15m access + refresh cookies",
Scope: sdk.MemoryScopeProject,
ProjectID: 42,
TTL: 3600,
}); err != nil {
panic(err)
}
// Retrieve
mem, _ := client.Memory().Retrieve(ctx, "auth-decision-q1")
fmt.Println(mem.Content)
// Search (REST-backed today)
results, _ := client.Memory().Search(ctx, sdk.MemorySearchRequest{
Query: "jwt expiry decision",
ProjectID: 42,
Limit: 5,
})
for _, r := range results {
fmt.Println(r.Key, r.Similarity)
}
}TypeScript (Node/Bun)
typescript
import { AetherAgent, MemoryScope } from '@aether/agent-sdk';
import { MemoryClient } from '@aether/agent-sdk/memory';
(async () => {
const memory = new MemoryClient({
hubAddress: 'localhost:9090',
agentId: 'docs-ts',
agentSecret: 'sk-local',
});
await memory.store({
key: 'auth-decision-q1',
content: 'JWT with 15m access + refresh cookies',
scope: MemoryScope.PROJECT,
projectId: 42,
ttlSeconds: 3600,
});
const mem = await memory.retrieve({ key: 'auth-decision-q1' });
console.log(mem.content);
const results = await memory.search({
query: 'jwt expiry decision',
projectId: 42,
limit: 5,
});
results.forEach((r) => console.log(r.key, r.similarity));
})();The TypeScript package name follows the published name (
@aether/agent-sdk). If using from source, import from your local build output path instead.
