How top-q/agent-q works
Agent Q turns a user task into generated Python actions through a specialized Web, filesystem, or REST agent. Each agent supplies domain-specific instructions and tools to the shared AgentQ runtime, which either executes cached code or asks its model-backed CodeAgent to generate and run code; successful generated code is saved for reuse. The domain tools act on browser pages, local files, or REST endpoints, with web HTML sanitized before use. The README also documents model flexibility and extensibility. Some subsystem links are supported by the SOURCE INDEX rather than full excerpts; the Ollama adapter is included, but its runtime wiring is not established by the sampled evidence.
Main entry points: agentq.py AgentQ runtime · web_agent.py WebAgent · fs_agent.py FsAgent · rest_agent.py RestAgent
Components 21
Agent Runtime
- AgentQ runtime
src/agent/agentq.py - Shared instructions
src/agent/prompt.py - Root path config
definitions.py
Web Automation
- WebAgent
src/agent/web_agent/web_agent.py - Web instructions
src/agent/web_agent/prompt.py - Browser tools
src/agent/web_agent/web_tools.py - HTML sanitizer
src/agent/web_agent/sanitizer.py
Filesystem Tasks
- FsAgent
src/agent/fs_agent/fs_agent.py - Filesystem instructions
src/agent/fs_agent/prompt.py - Filesystem tools
src/agent/fs_agent/fs_tools.py
REST API Testing
- RestAgent
src/agent/rest_agent/rest_agent.py - REST instructions
src/agent/rest_agent/prompt.py - HTTP and JSON tools
src/agent/rest_agent/rest_tools.py - Petstore Swagger spec
swagger/swagger_petstore.json
Models and State
- Code cache
src/agent/code_store.py - Language model
- Ollama adapter
src/model/ollama_model.py
Other components
- Task user
- Playwright page
- Local filesystem
- REST API
Connections 22
- Task user → WebAgent: requests task
README.md - Task user → FsAgent: requests task
README.md - Task user → RestAgent: requests task
README.md - WebAgent → AgentQ runtime: delegates
src/agent/web_agent/web_agent.py - FsAgent → AgentQ runtime: delegates
src/agent/fs_agent/fs_agent.py - RestAgent → AgentQ runtime: delegates
src/agent/rest_agent/rest_agent.py - AgentQ runtime → Shared instructions: combines instructions
src/agent/agentq.py - AgentQ runtime → Code cache: checks and saves code
src/agent/agentq.py - AgentQ runtime → Root path config: reads root path
src/agent/agentq.py - AgentQ runtime → Language model: runs code agent
src/agent/agentq.py - WebAgent → Web instructions: configures
src/agent/web_agent/web_agent.py - WebAgent → Browser tools: registers tools
src/agent/web_agent/web_agent.py - WebAgent → Playwright page: sets page context
src/agent/web_agent/web_agent.py - Browser tools → Playwright page: reads and acts on
src/agent/web_agent/web_tools.py - Browser tools → HTML sanitizer: sanitizes page HTML
src/agent/web_agent/web_tools.py - FsAgent → Filesystem instructions: configures
src/agent/fs_agent/fs_agent.py - FsAgent → Filesystem tools: registers tools
src/agent/fs_agent/fs_agent.py - Filesystem tools → Local filesystem: reads and lists
src/agent/fs_agent/fs_tools.py - RestAgent → REST instructions: configures
src/agent/rest_agent/rest_agent.py - RestAgent → HTTP and JSON tools: registers tools
src/agent/rest_agent/rest_agent.py - HTTP and JSON tools → REST API: sends HTTP requests
src/agent/rest_agent/rest_tools.py - Task user → Petstore Swagger spec: provides API spec
README.md