This repository contains implementations of two independent AI Engineering problems completed as part of the Asama.ai interview assignment.
AgentSphere is an event-driven B2B network that enables autonomous AI agents representing different enterprises to discover business opportunities through semantic relevance routing.
Core capabilities
- Enterprise agent registration and interest profiles.
- Semantic relevance matching using vector embeddings.
- Hybrid retrieval combining dense vector search and lexical search.
- LLM-based reranking to identify relevant recipients.
- Asynchronous event processing using Redis Streams.
- Signed webhook notifications.
- Autonomous AI-generated comments and engagement feedback.
- Engagement analytics and simulation controls.
- Frontend dashboard with Network Feed, Agent Directory, Routing Inspector and Analytics.
Technology stack
- Frontend: React, Vite
- Backend: Python, FastAPI
- Database: PostgreSQL, pgvector
- Event processing: Redis Streams
- AI: Gemini embeddings and LLM-based reranking
- Infrastructure: Docker Compose
Project location: Problem-1-AgentSphere/
Status: Completed and pushed to GitHub.
1. Start infrastructure
cd Problem-1-AgentSphere
docker compose up -d2. Configure the backend
cd backend
python -m venv venvActivate the virtual environment on Windows:
.\venv\Scripts\Activate.ps1Install dependencies:
pip install -r requirements.txtCreate your environment file:
Copy-Item .env.example .envConfigure the required API keys and environment variables in backend/.env.
3. Start the backend API
uvicorn app.main:app --reloadAPI documentation: http://127.0.0.1:8000/docs
4. Start the background workers
Run each worker in a separate backend terminal:
python -m app.workers.routing_workerpython -m app.workers.delivery_workerpython -m app.workers.simulation_worker5. Start the frontend
In another terminal:
cd Problem-1-AgentSphere/frontend
npm installCreate the frontend environment file:
Copy-Item .env.example .envStart the development server:
npm run devOpen the frontend URL displayed in the terminal.
A local AI-powered Linux hardware assistant that answers natural-language questions about system hardware by collecting actual information through predefined Linux inspection tools.
Instead of relying on the LLM's general knowledge to guess hardware specifications, the assistant uses tool calling to inspect the system, parses command output into structured information, and generates answers grounded in the retrieved data.
Core capabilities
- Natural-language hardware questions through a terminal chat interface.
- LLM tool calling to select the appropriate hardware inspection functions.
- CPU information including processor model, architecture, cores and threads.
- Memory usage and available memory information.
- Memory topology inspection where supported by the system.
- Storage device information including size, model, transport and mount points.
- GPU and display controller detection.
- Operating system, Linux distribution and environment detection.
- Conversation history for contextual follow-up questions.
- Session-based hardware tool-result caching.
- Graceful handling of unavailable utilities, permission errors and inaccessible hardware information.
Technology stack
- Language: Python 3.12
- Chat interface: Textual
- LLM runtime: Ollama
- Local model: Qwen2.5 3B
- LLM integration: Ollama Python client and tool calling
- Hardware inspection: Linux utilities (
lscpu,free,lsblk,lspci,dmidecode) - Parsing: Python and JSON
- Testing: Pytest
Project location: Problem-2-Hardware-QA-Assistant/
Status: Implemented and tested.
The application follows a tool-calling architecture:
- The user submits a natural-language hardware question.
- The LLM determines which predefined hardware tool is appropriate.
- The orchestrator validates the requested tool and invokes its registered Python function.
- The hardware function uses the secure command executor to run an allow-listed Linux command.
- Raw command output is parsed into structured data.
- The structured results are returned to the LLM.
- The LLM generates a natural-language answer grounded in the retrieved information.
Architecture components
frontend/– Textual terminal chat interface.backend/orchestrator.py– Coordinates LLM responses and tool execution.backend/llm_client.py– Connects to the local Ollama server.backend/tool_registry.py– Defines available tools and validates tool requests.backend/hardware_tools.py– Implements hardware inspection functions.backend/executor.py– Executes predefined Linux commands safely.backend/parsers.py– Converts raw command output into structured information.backend/system_discovery.py– Detects the Linux environment and available utilities.backend/conversation.py– Maintains conversation history and session-level caching.backend/prompts.py– Defines assistant behaviour and grounding instructions.config/– Application configuration.tests/– Automated tests.
- Only predefined, allow-listed hardware commands can be executed.
- The LLM selects registered Python tools; it cannot supply arbitrary shell commands.
- Commands are executed using
subprocess.run()withshell=False. - Executable paths and command arguments are predefined.
- Execution timeouts prevent commands from running indefinitely.
- Invalid tool names and unexpected arguments are rejected.
- The application does not run the entire process with root privileges.
- Hardware information is not invented when it cannot be retrieved.
- The local Ollama model processes questions without sending them to a hosted LLM API.
The project was developed and tested using Ubuntu 24.04 under WSL2 on Windows, with Ollama running locally on Windows.
1. Install prerequisites
- Python 3.11 or later.
- Ubuntu or another supported Linux environment.
- Ollama.
- The Qwen2.5 3B model.
Install the required Linux utilities where necessary:
sudo apt update
sudo apt install util-linux procps pciutils dmidecode2. Set up Ollama
Install Ollama and download the model:
ollama pull qwen2.5:3bStart the Ollama server and ensure it is reachable from the Linux environment.
For the Windows-hosted Ollama and WSL2 development setup, configure the server to accept connections from WSL and restrict access through the Windows firewall to the required local environment.
3. Configure the Python environment
Navigate to the project directory:
cd Problem-2-Hardware-QA-AssistantCreate a virtual environment:
python3 -m venv .venvActivate it:
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txt4. Configure environment variables
Create the local environment file:
cp .env.example .envConfigure:
OLLAMA_HOST=http://YOUR_OLLAMA_HOST:11434
OLLAMA_MODEL=qwen2.5:3bReplace YOUR_OLLAMA_HOST with the address of the machine running Ollama that is reachable from Linux. For the WSL2 setup, this is typically the Windows host gateway address.
5. Run the assistant
python main.pyAsk questions such as:
- What processor does my system have?
- How many CPU cores and threads are available?
- How much memory is currently available?
- What storage devices are detected?
- What GPU or display controller is detected?
- Is my Linux environment virtualized?
6. Run automated tests
python -m pytest -vThe implementation has been verified with 37 passing automated tests.
- Hardware visibility depends on the Linux environment and available system utilities.
- Some hardware details require elevated privileges or access to firmware information.
- WSL2 exposes virtualized hardware information rather than complete physical laptop hardware information.
- SMBIOS/DMI information may be unavailable in WSL2, preventing reliable detection of physical RAM slots and motherboard maximum memory capacity.
- The assistant reports unavailable information instead of guessing or inventing specifications.
Asama.ai/
│
├── Problem-1-AgentSphere/
│ ├── backend/
│ ├── frontend/
│ ├── database/
│ └── docker-compose.yml
│
├── Problem-2-Hardware-QA-Assistant/
│ ├── backend/
│ ├── frontend/
│ ├── config/
│ ├── tests/
│ ├── main.py
│ ├── requirements.txt
│ └── .env.example
│
├── README.md
└── .gitignore
- Never commit
.envfiles or API credentials. - Use
.env.examplefiles to document required configuration. - Keep API keys and database credentials private.
- Use separate credentials for production environments.
- Keep hardware inspection commands restricted to the predefined allow-list.
- Avoid arbitrary shell execution and unnecessary root privileges.
Both assignment problems are maintained in this single GitHub repository.
Repository: Asama.ai – GitHub
Branch: main