GenAgent
raw JSON → 0.4.1 verified Fri May 01 auth: no python
A Python library providing utilities for generative agent tasks, including LLM interactions and agent memory. Current version 0.4.1, requires Python >=3.8. Development is active with recent updates.
pip install genagent Common errors
error ModuleNotFoundError: No module named 'genagent.agent' ↓
cause Importing from submodule 'genagent.agent' which was removed in 0.4.0.
fix
Change import to 'from genagent import Agent'
error AttributeError: 'Memory' object has no attribute 'save' ↓
cause Trying to save memory manually, but Memory does not have a save method; use persistence_file at initialization.
fix
Initialize Memory with persistence_file='/path/to/memory.json' and it will auto-save.
error TypeError: __init__() got an unexpected keyword argument 'api_key' ↓
cause Incorrect initialization of LLMClient; the parameter name might have changed in newer versions.
fix
Check the latest docs: use 'api_token' or 'auth_token' depending on version. In 0.4.1, use 'api_key' as shown.
Warnings
breaking In version 0.4.0, the 'Agent' class was moved from genagent.agent to the top-level package. Code using 'from genagent.agent import Agent' will break. ↓
fix Use 'from genagent import Agent' instead.
gotcha The Memory class is not automatically persisted. If you need long-term memory, you must implement your own persistence layer or use the optional persistence feature with a file path. ↓
fix Pass a persistence file: Memory(persistence_file='/path/to/memory.json')
deprecated The 'genagent.tools' module is deprecated since 0.4.0 and will be removed in a future release. Use the top-level 'genagent.tools' as a package instead. ↓
fix Migrate to using 'from genagent import tools'.
Imports
- Agent wrong
from genagent.agent import Agentcorrectfrom genagent import Agent - LLMClient
from genagent import LLMClient - Memory wrong
from genagent.memory import Memorycorrectfrom genagent import Memory
Quickstart
from genagent import Agent, LLMClient, Memory
memory = Memory()
client = LLMClient(api_key=os.environ.get('OPENAI_API_KEY', ''))
agent = Agent(client=client, memory=memory)
response = agent.run("What is the capital of France?")
print(response)