Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/plugin-agno/.gitignore
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
node_modules/
dist/
package-lock.json
npm-debug.log*
yarn.lock
.pnpm-debug.log*

*.tsbuildinfo

.venv/
__pycache__/
*.py[cod]
*.pyo
*.pyd
*.egg-info/
.eggs/

.DS_Store
.vscode/
.idea/
*.swp
*.swo

19 changes: 17 additions & 2 deletions packages/plugin-agno/README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,14 +41,29 @@ agent.print_response("What theme do I prefer?", stream=True)

## Available tools

The `NeocortexTools` toolkit exposes three tools to the agent:
The `NeocortexTools` toolkit exposes tools aligned with the TinyHumans/Neocortex SDK endpoints:


| Tool | Description |
| --------------- | --------------------------------------------------------------------- |
| `save_memory` | Save or update a memory (key, content, namespace, optional metadata). |
| `recall_memory` | Recall relevant memories for a natural-language query in a namespace. |
| `delete_memory` | Delete one or more memories by key/keys or delete all in a namespace. |
| `sync_memory` | Sync OpenClaw memory files (workspace/agent + file objects). |
| `insert_document` | Insert a single memory document (title/content/namespace). |
| `insert_documents_batch` | Insert multiple documents in one call. |
| `list_documents` | List documents in a namespace. |
| `get_document` | Get a specific document by `document_id`. |
| `delete_document` | Delete a specific document by `document_id`. |
| `query_memory_context` | Query mirrored memory context (`/v1/memory/queries`). |
| `chat_memory_context` | Chat with memory context (`/v1/memory/conversations`). |
| `record_interactions` | Record interaction signals (`/v1/memory/interactions`). |
| `recall_thoughts` | Generate reflective thoughts (`/v1/memory/memories/thoughts`). |
| `chat_memory` | Chat with memory cache (`/v1/memory/chat`). |
| `interact_memory` | Record entity interactions (`/v1/memory/interact`). |
| `recall_memory_master` | Recall context from the master node (`/v1/memory/recall`). |
| `recall_memories` | Recall memories from the Ebbinghaus bank (`/v1/memory/memories/recall`). |
| `get_ingestion_job` | Check ingestion job status (`/v1/memory/ingestion/jobs/:jobId`). |


Credentials (`token`, `model_id`, `base_url`) are set when constructing `NeocortexTools` and are **never** passed as tool arguments, so the LLM cannot see or override them.
Expand All@@ -60,7 +75,7 @@ Credentials (`token`, `model_id`, `base_url`) are set when constructing `Neocort

## Error handling

On API failures, the underlying client raises `TinyHumanError`. You can catch it for logging or user-facing messages:
On API failures, the underlying client raises `AlphahumanError`. You can catch it for logging or user-facing messages:

```python
from neocortex_agno import NeocortexTools, AlphahumanError
Expand Down
34 changes: 31 additions & 3 deletions packages/plugin-agno/example.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,11 @@
export ALPHAHUMAN_BASE_URL=""
export OPENAI_API_KEY=""
python example.py

This example demonstrates both:
- Saving/recalling simple memories (preferences)
- Document + context workflows (insert/list/get documents, query/chat context,
record interactions, and recall thoughts)
"""

import os
Expand All@@ -29,9 +34,16 @@ def main() -> None:
)
],
instructions=(
"Use the memory tools to remember and recall user preferences and context. "
"When the user tells you something to remember, use save_memory. "
"When answering questions that might use stored context, use recall_memory first."
"Use the memory tools to remember and recall user preferences and context.\n"
"When the user tells you something to remember, use save_memory.\n"
"When answering questions that might use stored context, use recall_memory first.\n"
"If the user asks about documents or document-backed context, use:\n"
"- insert_document / insert_documents_batch\n"
"- list_documents / get_document\n"
"- query_memory_context (POST /v1/memory/queries)\n"
"- chat_memory_context (POST /v1/memory/conversations)\n"
"If the user asks to track signal-level memory, use record_interactions.\n"
"If the user asks for reflective/summary insights from memory, use recall_thoughts."
),
markdown=True,
)
Expand All@@ -47,6 +59,22 @@ def main() -> None:
)
agent.print_response("What theme do I prefer?", stream=True)

print()
print("Document + context workflow:")
agent.print_response(
"Create a document in namespace 'agno-docs' titled 'Alex Preferences'. "
"Store the content: 'Alex prefers dark mode and wants succinct answers.'. "
"Next, query_memory_context in 'agno-docs' for: 'What does Alex prefer?' "
"and use that output to answer. "
"Then call chat_memory_context with messages=[{'role':'user','content':'What does Alex prefer?'}] "
"using the same namespace 'agno-docs' context. "
"After that, call record_interactions in 'agno-docs' with "
"entity_names=['ENTITY-AGNO-A','ENTITY-AGNO-B'] and interaction_level='engage'. "
"Finally, call recall_thoughts for 'agno-docs' with max_chunks=5. "
"Return a short summary of each step's outcome.",
stream=True,
)


if __name__ == "__main__":
main()
Loading