Skip to main content

Build AI agents with persistent memory, rollback, and audit trails — powered by Novyx

Project description

novyx-agent

Build AI agents with persistent memory, rollback, and audit trails.

from novyx_agent import Agent, tool

agent = Agent(
    name="Aria",
    api_key="nram_...",
    provider="anthropic",       # or "openai" or "litellm"
    model="claude-sonnet-4-6",
)

@agent.tool
def search_web(query: str) -> str:
    """Search the web for information."""
    return requests.get(f"https://api.search.com?q={query}").text

result = agent.run("What did we discuss yesterday?")
print(result)

That's it. The agent automatically recalls relevant memories before every LLM call, executes tools, and remembers the exchange for next time.

v2.0 note: provider and model are now required. Novyx is provider-agnostic — pick openai, anthropic, or litellm (for any other model). No hidden defaults.

Why novyx-agent?

Every agent framework gives you tool calling. None of them give you this:

# Roll back the agent's memory to before it went off the rails
agent.rollback("2 hours ago")

# Cryptographic audit trail — every memory operation, hash-chained
trail = agent.audit(limit=50)

# Memory health check — recall accuracy, drift, conflicts, staleness
health = agent.eval()
assert health["score"] >= 0.8, "Memory quality too low"

# Pass/fail gate for CI/CD
agent.eval_gate(min_score=0.7)

# Knowledge graph
agent.add_triple("Python", "is_a", "programming language")
triples = agent.query_triples(subject="Python")

No other agent SDK has rollback, audit trails, eval, or replay. Not OpenAI Agents SDK, not CrewAI, not LangGraph, not Pydantic AI.

Install

pip install novyx-agent

# Pick your LLM provider:
pip install novyx-agent[openai]      # OpenAI / OpenAI-compatible
pip install novyx-agent[anthropic]   # Claude
pip install novyx-agent[litellm]     # Any model via LiteLLM
pip install novyx-agent[all]         # All providers

Quick Start

1. Basic agent

from novyx_agent import Agent

agent = Agent(
    name="Assistant",
    api_key="nram_your_key",
    provider="openai",
    model="gpt-4o",
)

result = agent.run("Summarize what we've been working on")
print(result)

2. Agent with tools

from novyx_agent import Agent, tool

agent = Agent(
    name="ResearchBot",
    api_key="nram_...",
    provider="anthropic",
    model="claude-sonnet-4-6",
)

@agent.tool
def search_docs(query: str, limit: int = 5) -> str:
    """Search internal documentation."""
    return f"Found {limit} results for: {query}"

@agent.tool
def create_ticket(title: str, body: str) -> str:
    """Create a support ticket."""
    return f"Created ticket: {title}"

result = agent.run("Find docs about auth and create a ticket for the bug")
print(result)
print(f"Tools used: {[tc.tool for tc in result.tool_calls]}")

3. Agent with Claude

agent = Agent(
    name="Claude Agent",
    api_key="nram_...",
    provider="anthropic",
    model="claude-sonnet-4-6",
)

4. Agent with any model (LiteLLM)

agent = Agent(
    name="Universal",
    api_key="nram_...",
    provider="litellm",
    model="ollama/llama3",      # or "gemini/gemini-1.5-pro", "groq/llama3-70b", etc.
)

5. Memory control

from novyx_agent import Agent, MemoryConfig

agent = Agent(
    name="Selective",
    api_key="nram_...",
    provider="anthropic",
    model="claude-sonnet-4-6",
    memory=MemoryConfig(
        auto_recall=True,           # Recall before each run
        auto_remember=True,         # Remember after each run
        recall_limit=10,            # Max memories to recall
        recall_threshold=0.5,       # Minimum relevance score
        recall_tags=["project-x"],  # Only recall tagged memories
        remember_tags=["project-x"],# Tag stored memories
        remember_importance=8,      # 1-10 importance
    ),
)

6. Rollback & audit

# Oops, the agent stored bad data
agent.rollback("30 minutes ago")

# Preview before committing
preview = agent.rollback_preview("1 hour ago")
print(f"Would restore {preview['restore_count']} memories")

# Full audit trail
for entry in agent.audit(limit=20):
    print(f"{entry['action']} at {entry['timestamp']}")

7. Eval gates for CI/CD

health = agent.eval()
print(f"Memory score: {health['score']}")
# score = 0.7*recall + 0.2*freshness + 0.1*consistency

# Hard gate — raises if below threshold
agent.eval_gate(min_score=0.7)

8. Direct Novyx access

# Full SDK access for advanced operations
nx = agent.novyx
nx.dashboard()
nx.cortex_run()
nx.replay_timeline(hours=24)

Architecture

novyx-agent
├── agent.py      — Agent class (run loop, memory integration)
├── tools.py      — @tool decorator (auto-schema from type hints)
├── types.py      — Pydantic models (ToolDef, RunResult, configs)
├── providers.py  — LLM adapters (OpenAI, Anthropic, LiteLLM)
└── __init__.py   — Public API

The run loop:

  1. Recall — semantic search over Novyx memories relevant to the prompt
  2. Build context — system prompt + recalled memories + conversation history + user message
  3. LLM loop — call the model → if tool calls, execute them → repeat until text response
  4. Remember — store a summary of the exchange as a new memory
  5. ReturnRunResult with output, tool calls, memory stats, token usage

API Reference

Agent

Method Description
run(prompt) Run the agent on a prompt
remember(observation) Store a memory
recall(query) Search memories
forget(memory_id) Delete a memory
rollback(target) Roll back memory state
rollback_preview(target) Preview rollback
audit(**kwargs) Get audit trail
eval() Run memory health eval
eval_gate(min_score) Pass/fail gate
add_triple(s, p, o) Add knowledge graph triple
query_triples(**kwargs) Query knowledge graph
clear_history() Clear conversation history
novyx Direct Novyx SDK access

@tool

@tool
def my_function(param: str, count: int = 5) -> str:
    """Description becomes the tool description."""
    return "result"

Automatically extracts: name, description (from docstring), parameters (from type hints), required/optional (from defaults).

RunResult

Field Type Description
output str The agent's text response
tool_calls List[ToolCall] Tools invoked during the run
memories_recalled int Memories retrieved
memories_stored int Memories created
model str Model used
usage Dict[str, int] Token usage

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

novyx_agent-2.0.0.tar.gz (26.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

novyx_agent-2.0.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file novyx_agent-2.0.0.tar.gz.

File metadata

  • Download URL: novyx_agent-2.0.0.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for novyx_agent-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c594fcc561ffb9e3855ca684f7b134659333ea544eff46f8c255bcfd245b1a7a
MD5 ab617bdb70470d6ef7dffbdbb15ed992
BLAKE2b-256 4a1cda8502f881c7a06934a5ef5167b125f654ab2d22ba6fa62b0993cd56c347

See more details on using hashes here.

File details

Details for the file novyx_agent-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: novyx_agent-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for novyx_agent-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4279b1a8ebbc71b5a5c1dd4f4f72fabfb6049999791e59ffd5133a99c9db5c9
MD5 858333db0af968e2c98e95782ea2395d
BLAKE2b-256 698fb081fcb5b263c0fd83f685664d3ae6f3e34f23632ccb99b3f7201c4bf369

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page