Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โšก ANAS CLI Dev โ€” MCP AI Terminal

Version: 0.1.0 | Python: 3.14+ | License: MIT

A cutting-edge terminal-based AI assistant powered by the OpenAI Agents SDK, featuring a cyberpunk neon boot sequence, a rich Textual TUI, and an AI agent routed through OpenRouter for free-tier LLM access. Designed as an MCP (Model Context Protocol) compute node to handle up to 50% of server-side AI inference.


โœจ Features

๐Ÿค– AI Agent (OpenAI Agents SDK)

  • OpenRouter Integration โ€” Routes requests through OpenRouter for multi-model flexibility
  • Free-Tier Model โ€” Uses arcee-ai/trinity-large-thinking:free for cost-free experimentation
  • Conversation Memory โ€” Maintains a history of all exchanges with the AI
  • History Tutor Persona โ€” Pre-configured agent optimized for concise, clear historical answers
  • Async Architecture โ€” Non-blocking AI calls keep the UI responsive

๐Ÿ–ฅ๏ธ Terminal UI (Textual Framework)

  • Rich TUI Chat Interface โ€” Full-featured terminal app with scrollable chat log
  • Real-Time Clock Header โ€” Live clock display in the top bar
  • Stylized Borders โ€” Cyan-bordered chat panel, green-bordered input field
  • Keyboard-Friendly โ€” Footer with keybindings, rapid input submission
  • Loading States โ€” Visual feedback while the AI processes responses
  • Error Handling โ€” Graceful error messages displayed inline

๐Ÿš€ Neon Boot Animation

  • ASCII Logo โ€” Custom "ANAS CLI Dev" ASCII art with large-format rendering
  • Typewriter Text Effect โ€” Animated title typing itself character by character
  • Neon Color Cycling โ€” Multi-color cycling animation (cyan โ†’ blue โ†’ magenta)
  • Visual Boot Sound โ€” Simulated audio-visual boot sequence
  • Loading Progress โ€” 4-stage animated progress bar:
    • โšก Powering AI Core
    • ๐Ÿง  Syncing Neural Network
    • ๐Ÿ“ฆ Loading Modules
    • ๐Ÿ–ฅ๏ธ Starting Interface
  • SYSTEM READY Screen โ€” Confirmation panel before entering the chat

๐Ÿ”ง Developer Experience

  • Bleeding-Edge Stack โ€” Python 3.14 + openai-agents v0.0.7 + Textual v8.2.6
  • uv-Powered โ€” Blazing-fast Rust-based package management
  • Clean Separation of Concerns โ€” Modular architecture with distinct layers (launcher, UI, AI logic, animation)
  • Cross-Platform โ€” Windows and Unix support with automatic terminal detection
  • .env Configuration โ€” Secure API key management via environment variables
  • Conversation REPL Mode โ€” Standalone CLI loop for debugging and testing

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        run.py                                โ”‚
โ”‚                    (Entry Point)                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                    โ”‚
โ”‚  โ”‚  final_animation.py  โ”‚  โ—„โ”€โ”€ Neon splash screen            โ”‚
โ”‚  โ”‚  (Presentation)      โ”‚      (rich/Panel animations)       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                    โ”‚
โ”‚             โ”‚                                                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                    โ”‚
โ”‚  โ”‚      cli.py          โ”‚  โ—„โ”€โ”€ Textual TUI                   โ”‚
โ”‚  โ”‚  (UI / Interaction)  โ”‚      (Header, Input, RichLog)       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                    โ”‚
โ”‚             โ”‚  async calls                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                    โ”‚
โ”‚  โ”‚    chatbot.py        โ”‚  โ—„โ”€โ”€ OpenAI Agents SDK              โ”‚
โ”‚  โ”‚  (AI / Business Logic)โ”‚     (Agent, Runner, OpenRouter)    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                    โ”‚
โ”‚                                                              โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                    โ”‚
โ”‚  โ”‚      main.py         โ”‚  โ—„โ”€โ”€ Scratchpad / test file         โ”‚
โ”‚  โ”‚  (Development)       โ”‚      (gitignored)                   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                    โ”‚
โ”‚                                                              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Data Flow:   User Input โ†’ TUI โ†’ AI Agent โ†’ OpenRouter API  โ”‚
โ”‚               โ†’ Response โ†’ TUI Display                       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Component Breakdown

Module Role Key Technologies
run.py Application launcher & orchestrator os.system
final_animation.py Boot sequence & visual effects rich (Panel, Progress, Live)
cli.py Terminal UI & user interaction textual (App, Header, Input, RichLog)
chatbot.py AI agent logic & API integration agents (Agent, Runner, OpenAIChatCompletionsModel)
main.py Development scratchpad (gitignored) agents, asyncio

๐Ÿ› ๏ธ Tech Stack

Category Technology Version
Language Python >=3.14
AI Framework OpenAI Agents SDK 0.0.7
OpenAI Client openai 2.37.0
Terminal UI Textual 8.2.6
Terminal Formatting Rich 15.0.0
ASCII Banners pyfiglet 1.0.4
Env Management python-dotenv 1.2.2
Cross-platform Colors colorama 0.4.6
Data Validation pydantic 2.13.4
Async HTTP httpx 0.28.1
Package Manager uv 0.11.7
MCP SDK mcp 1.27.0
HTTP Client requests 2.34.2

๐Ÿ“ฆ Installation

Prerequisites

Setup

# 1. Clone the repository
git clone https://github.com/yourusername/mcp.git
cd mcp

# 2. Create virtual environment & install dependencies
uv venv
uv sync

# 3. Configure your API keys
echo "OPENROUTER_API_KEY=sk-or-v1-your-key-here" > .env

Note: The .env file is automatically excluded from version control via .gitignore.

API Key Configuration

The application supports two methods of API key management:

  1. Environment variable (recommended): Set OPENAI_API_KEY in your .env file
  2. Direct assignment: The chatbot module has a placeholder that can be replaced with your key

Keys are loaded via python-dotenv and passed to the OpenRouter client for routing to the free-tier model.


๐Ÿš€ Usage

Launch the Full Application

uv run python run.py

This will:

  1. Clear the terminal screen
  2. Play the neon boot animation sequence
  3. Launch the Textual TUI chat interface

Standalone Chatbot (REPL Mode)

# Edit chatbot.py to uncomment the bottom line:
# import asyncio
# asyncio.run(main())

uv run python chatbot.py

Quick Agent Test

uv run python main.py

๐ŸŽฎ How It Works

Starting the Application

When you run python run.py, the application enters a carefully orchestrated startup sequence:

  1. Screen Initialization โ€” Terminal clears automatically (supports both Windows cls and Unix clear)
  2. Boot Sequence โ€” The neon animation plays:
    • ASCII logo renders in bright cyan
    • Visual "boot sound" pulses 5 times
    • Title cycles through neon colors (6 cycles)
    • Typewriter effect types the title
  3. System Loading โ€” 4-stage progress bar simulates module initialization
  4. Chat Interface โ€” Textual TUI appears, ready for input

Chatting with the AI

  • Type your message in the input field (green border)
  • Press Enter to send
  • Your message appears in the chat panel (cyan border)
  • The AI responds with a concise history-focused answer
  • Error messages are displayed inline if the API call fails

AI Agent Configuration

The "History Tutor" agent in chatbot.py is configured with:

  • Model: arcee-ai/trinity-large-thinking:free (OpenRouter free tier)
  • Instructions: Clear, concise historical answers
  • Conversation Context: Full history stored and available for context
  • Async Runner: Non-blocking execution via Runner.run()

๐Ÿ“ Project Structure

MCP/
โ”œโ”€โ”€ run.py                   # Application entry point
โ”œโ”€โ”€ chatbot.py               # AI agent logic (OpenAI Agents SDK)
โ”œโ”€โ”€ cli.py                   # Textual TUI chat interface
โ”œโ”€โ”€ final_animation.py       # Neon boot animation sequence
โ”œโ”€โ”€ main.py                  # Development scratchpad (gitignored)
โ”œโ”€โ”€ pyproject.toml           # Project definition & dependencies
โ”œโ”€โ”€ uv.lock                  # Lock file for reproducible builds
โ”œโ”€โ”€ .env                     # API keys (gitignored)
โ”œโ”€โ”€ .gitignore               # Git exclusion rules
โ”œโ”€โ”€ .python-version          # Python version: 3.14
โ”œโ”€โ”€ README.md                # This file
โ”œโ”€โ”€ .venv/                   # Virtual environment (gitignored)
โ”œโ”€โ”€ __pycache__/             # Python bytecode cache (gitignored)
โ””โ”€โ”€ .git/                    # Git repository

โš™๏ธ Configuration

Environment Variables (.env)

Variable Required Description
OPENAI_API_KEY Yes API key for OpenAI/OpenRouter
OPENROUTER_API_KEY Yes OpenRouter-specific API key

Agent Configuration (chatbot.py)

Setting Current Value Description
Model arcee-ai/trinity-large-thinking:free OpenRouter model ID
Base URL https://openrouter.ai/api/v1 OpenRouter API endpoint
Agent Name "History Tutor" Agent identity
Instructions Short history answers System prompt
Tracing Disabled Telemetry setting

TUI Configuration (cli.py)

Setting Current Value Description
Screen Background Black Terminal background color
Chat Border Cyan (round) Chat panel border style
Input Border Green (round) Input field border style
Header Clock Enabled Live clock display

๐Ÿงช Development

Code Conventions

  • Async-first: All I/O operations use asyncio/await
  • Minimal dependencies: Only 6 core runtime deps in pyproject.toml
  • Clean separation: UI logic never mixes with AI/business logic
  • Error resilience: Try/except guards around all external calls

Testing

Tests are not yet implemented. The main.py file serves as a manual test harness for agent calls. Future test coverage will use pytest with asyncio support.

Building

# Install in development mode
uv pip install -e .

Common Tasks

# Run the application
uv run python run.py

# Update dependencies
uv sync

# Add a new dependency
uv add package-name

๐Ÿ—บ๏ธ Roadmap

  • Conversation Context Passing โ€” Feed full history into agent calls for true memory
  • MCP Server Integration โ€” Implement MCP server for distributed compute (50% offload)
  • Multiple AI Personas โ€” Switchable agent configurations (coding, science, general)
  • Session Persistence โ€” Save and load conversation history
  • Markdown Rendering โ€” Rich formatting of AI responses in the TUI
  • Command Palette โ€” Slash commands for extended functionality
  • Streaming Responses โ€” Real-time token-by-token AI output
  • Test Suite โ€” Unit tests for chatbot logic, integration tests for TUI
  • Docker Support โ€” Containerized deployment
  • Configurable Models โ€” Runtime model switching via UI
  • [project.scripts] entry point in pyproject.toml

๐ŸŒŸ Why This Project Stands Out

  1. Bleeding-Edge Technology โ€” Built on Python 3.14 (the latest CPython release) and the brand-new openai-agents SDK v0.0.7, placing it at the forefront of Python AI development.

  2. MCP-Ready Architecture โ€” Named and designed around the Model Context Protocol, with the mcp Python SDK already installed and a clear vision for distributed AI compute.

  3. Cost-Free AI โ€” Leverages OpenRouter's free-tier models for zero-cost experimentation, making AI accessible without a paid subscription.

  4. Terminal-Native Experience โ€” Chooses a rich TUI over a web interface, demonstrating that terminal applications can deliver modern, visually appealing experiences.

  5. Cyberpunk Aesthetic โ€” The neon boot animation, color-cycling logos, and ASCII art create a distinctive, memorable brand identity.

  6. Clean Modular Design โ€” Four focused modules with clear responsibilities make the codebase approachable and easy to extend.

  7. Async Excellence โ€” Non-blocking architecture ensures the UI never freezes during API calls โ€” a common pain point in terminal applications.

  8. Developer-Friendly โ€” Minimal dependencies, uv for lightning-fast package management, and a straightforward setup process.


๐Ÿค Contributing

Contributions are welcome! This is an early-stage project with lots of room for growth. Feel free to:

  • Open issues for bugs or feature suggestions
  • Submit PRs for improvements
  • Experiment with different AI models and configurations

๐Ÿ“„ License

This project is open source. See the LICENSE file for details.


Built with โค๏ธ using Python 3.14 ยท OpenAI Agents SDK ยท Textual ยท Rich
ANAS CLI Dev โ€” MCP AI Terminal

About

Terminal Base Ui General Agent that have Tools , Memory and Guardrails to inspect and improve with context.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages