mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
style: auto-fix ruff lint and format for Python 3.12
Run ruff check --fix and ruff format across the repo to fix ~495 auto-fixable lint errors (mostly I001 import sorting) and reformat 225 files to match the py312 target. Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -1,26 +1,26 @@
|
||||
|
||||
from agents import Agent, ReflexionEngine, Runner
|
||||
from hanzo_memory.client import SQLiteMemoryClient
|
||||
from agents import Agent, Runner, ReflexionEngine
|
||||
from agents.reflexion import Rule
|
||||
from hanzo_memory.client import SQLiteMemoryClient
|
||||
|
||||
|
||||
async def main():
|
||||
# 1. Initialize Memory Client (SQLite)
|
||||
# Ensure the DB exists or is created
|
||||
db_client = SQLiteMemoryClient(user_id="test_user")
|
||||
|
||||
db_client = SQLiteMemoryClient(user_id="test_user")
|
||||
|
||||
# 2. Initialize Reflexion Engine
|
||||
reflexion = ReflexionEngine(memory_client=db_client)
|
||||
|
||||
|
||||
# 3. Add some initial rules (simulating past learning)
|
||||
await reflexion.add_rule("Always double check file paths before writing.", context="coding")
|
||||
|
||||
|
||||
# 4. Create an Agent with Reflexion
|
||||
agent = Agent(
|
||||
name="SelfLearningBot",
|
||||
instructions="You are a helpful assistant that learns from mistakes.",
|
||||
reflexion=reflexion
|
||||
reflexion=reflexion,
|
||||
)
|
||||
|
||||
|
||||
# 5. Simulate a run (in a real scenario, the runner would use these)
|
||||
print(f"Agent {agent.name} initialized.")
|
||||
rules = await agent.reflexion.load_rules(context="coding")
|
||||
@@ -33,5 +33,6 @@ async def main():
|
||||
new_rule = await agent.reflexion.add_rule("Use pathlib for path manipulations.", context="coding")
|
||||
print(f"Added new rule: {new_rule.content}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
||||
Reference in New Issue
Block a user