Metadata-Version: 2.4
Name: agentbay
Version: 0.1.0
Summary: Persistent memory for AI agents. Store, recall, and share knowledge across sessions.
Project-URL: Homepage, https://www.aiagentsbay.com
Project-URL: Repository, https://github.com/thomasjumper/agentbay-python
Project-URL: Documentation, https://www.aiagentsbay.com/docs
Project-URL: Issues, https://github.com/thomasjumper/agentbay-python/issues
Author-email: AgentBay <hello@aiagentsbay.com>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,claude,llm,mcp,memory,openai
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: requests>=2.28
Requires-Dist: typing-extensions>=4.0
Provides-Extra: all
Requires-Dist: crewai>=0.1; extra == 'all'
Requires-Dist: langchain-core>=0.1; extra == 'all'
Provides-Extra: crewai
Requires-Dist: crewai>=0.1; extra == 'crewai'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.1; extra == 'langchain'
Description-Content-Type: text/markdown

# AgentBay Python SDK

Persistent memory for AI agents. 3 lines to give your agent a brain.

## Install

```bash
pip install agentbay
```

## Quick Start

```python
from agentbay import AgentBay

brain = AgentBay("ab_live_your_key", project_id="your-project-id")
brain.store("Next.js 16 + Prisma + PostgreSQL", title="Project stack")
results = brain.recall("What stack does this project use?")
```

Or create a new brain on the fly:

```python
from agentbay import AgentBay

brain = AgentBay("ab_live_your_key")
brain.setup_brain("My Agent's Memory")
brain.store("Always use UTC timestamps", title="Convention", type="PREFERENCE")
```

## Core API

| Method | What it does |
|--------|-------------|
| `brain.store(content, title, type, tier, tags)` | Save a memory |
| `brain.recall(query, limit, tier, tags)` | Search memories (semantic + keyword) |
| `brain.forget(knowledge_id)` | Archive a memory |
| `brain.verify(knowledge_id)` | Confirm a memory is still accurate |
| `brain.health()` | Get memory stats |
| `brain.setup_brain(name, description)` | Create a new Knowledge Brain |

## Memory Types

- `PATTERN` -- Learned behaviors and recurring themes
- `FACT` -- Verified information
- `PREFERENCE` -- User/agent preferences
- `PROCEDURE` -- Step-by-step processes
- `CONTEXT` -- Situational context

## With CrewAI

```bash
pip install agentbay[crewai]
```

```python
from crewai import Agent
from agentbay.integrations.crewai import AgentBayCrewAIMemory

memory = AgentBayCrewAIMemory(
    api_key="ab_live_your_key",
    project_id="your-project-id",
)

agent = Agent(
    role="Researcher",
    goal="Find and remember information",
    memory=memory,
)
```

## With LangChain

```bash
pip install agentbay[langchain]
```

```python
from langchain_openai import ChatOpenAI
from langchain.agents import initialize_agent, AgentType
from agentbay.integrations.langchain import AgentBayMemoryTool

tool = AgentBayMemoryTool(
    api_key="ab_live_your_key",
    project_id="your-project-id",
)

llm = ChatOpenAI()
agent = initialize_agent(
    tools=[tool],
    llm=llm,
    agent=AgentType.OPENAI_FUNCTIONS,
)
agent.run("Remember that deploys happen every Tuesday at 2pm UTC")
```

## Error Handling

```python
from agentbay.client import AgentBayError, AuthenticationError, RateLimitError

try:
    results = brain.recall("query")
except AuthenticationError:
    print("Bad API key")
except RateLimitError:
    print("Slow down")
except AgentBayError as e:
    print(f"Error {e.status_code}: {e}")
```

## Links

- [AgentBay](https://www.aiagentsbay.com) -- AI agent marketplace + memory platform
- [API Docs](https://www.aiagentsbay.com/docs)
- [MCP Server](https://www.npmjs.com/package/agentbay-mcp)
