How sentient-engineering/sentient works
Project type and purpose
• This is a Python library (“sentient”) that provides browser-controlling AI agents with a single function call.
• It orchestrates prompts to an LLM, parses its structured JSON, and executes browser operations via Playwright’s remote-debugging interface.
File structure
• Top-level scripts and config:
• cookookbook.py, README.md, pyproject.toml, requirements.txt
• Entrypoint:
• sentient/__main__.py – handles CLI or importable sentient.invoke.
• Configuration:
• sentient/config/config.py – loads defaults, environment variables, API keys.
• Core engine:
• sentient/core/orchestrator/orchestrator.py – main loop and decision logic.
• sentient/core/agent/agent.py & base.py – represents a single agent instance.
• sentient/core/memory/ltm.py – long-term memory store.
• sentient/core/models/models.py – data structures for model I/O.
• sentient/core/prompts/prompts.py – prompt templates and JSON schemas.
• Skills:
• sentient/core/skills/* – each .py is a browser action (open_url, click, enter_text, screenshot, PDF extraction, etc.).
• WebDriver adapter:
• sentient/core/web_driver/playwright.py – wraps Playwright remote-debugging API.
• Utilities:
• sentient/utils/* – logging, CLI helper, DOM helpers, JSON extraction, provider registry, message typing.
README for additional insights
• Usage pattern: asyncio.run(sentient.invoke(goal=…, provider=…, model=…)).
• External dependencies:
• Remote-debugging Chrome/Brave at port 9222.
• OpenAI API (or Anthropic, Ollama, etc.) accessed via provider abstractions in utils/providers.py.
• Customization via task_instructions and .env for API keys.