Skip to main content

Clean, composable micro agentic bot powered by Groq

Project description

Groqqy ๐Ÿค–

Clean, composable micro agentic bot powered by Groq

Ultra-fast, ultra-cheap, and truly agentic. Groqqy is a multi-step reasoning agent that reads files, runs commands, searches content, and chains tool calls to complete complex tasksโ€”all with production-ready code that's perfect for learning.

Why Groqqy?

  • โšก Blazing Fast: 460+ tokens/sec (11x faster than standard inference)
  • ๐Ÿ’ฐ Ultra Cheap: $0.00002-$0.00006 per interaction (300x cheaper than GPT-4)
  • ๐Ÿง  Truly Agentic: Multi-step reasoning loop (THINK โ†’ ACT โ†’ OBSERVE)
  • ๐Ÿ› ๏ธ Tool-Capable: Execute local and platform tools with automatic chaining
  • ๐Ÿงฉ Composable: Mix and match components (Agent, Tools, Strategies, etc.)
  • ๐Ÿ“š Teaching-Friendly: Clean, readable code (<200 lines per file) perfect for learning agentic AI
  • ๐Ÿ“ Export Ready: Save conversations to markdown/HTML with full tool call visibility

What's New in v2.1.0

Documentation & Export Features:

  • ๐Ÿ“ Conversation Export: Export full conversations to markdown/HTML with tool call details
  • ๐ŸŽ“ Self-Discovery: Agents can autonomously learn new tools via minimal seed prompts
  • ๐Ÿงช Container Testing: Reproducible testing infrastructure with Podman
  • ๐Ÿ“š Documentation Reorganization: Clean structure with guides and examples
  • ๐Ÿงน Project Cleanup: Professional structure, organized tests, comprehensive examples

See CHANGELOG.md for full history.

Installation

# Clone the repository
git clone https://github.com/scottsen/groqqy.git
cd groqqy

# Install in development mode (recommended)
pip install -e .

# Or install directly
pip install .

Requirements: Python 3.8+ and a Groq API key (free at console.groq.com)

Setup:

export GROQ_API_KEY="your-api-key-here"

Quick Start

Interactive Chat

groqqy
Groqqy ๐Ÿค– (llama-3.1-8b-instant)
Type 'help' for commands, 'exit' to quit

You: Find all Python files in the current directory
Groqqy: I'll search for Python files...
        [Searches, finds files, reports results]

You: Read the first one and summarize it
Groqqy: [Reads file, provides summary]

You: export markdown my_session.md
โœ… Conversation exported to my_session.md

Programmatic Use

from groqqy import Groqqy

# Create bot
bot = Groqqy()

# Simple chat
response, cost = bot.chat("Hello! What can you do?")
print(response)
print(f"Cost: ${cost:.6f}")

# Agentic task (agent chains tools automatically)
response, cost = bot.chat("Find all .py files and count lines in each")
print(response)
# Agent will: search_files("*.py") โ†’ read_file(each) โ†’ count โ†’ report

# Export conversation
bot.save_conversation("session.html")  # Auto-styled HTML
bot.save_conversation("session.md")     # Clean markdown

Custom Tools

from groqqy import Groqqy

def get_weather(city: str) -> str:
    """Get current weather for a city."""
    # Your implementation
    return f"Weather in {city}: Sunny, 72ยฐF"

def calculate_tip(bill: float, percent: float = 15.0) -> str:
    """Calculate tip amount for a bill."""
    tip = bill * (percent / 100)
    return f"Tip: ${tip:.2f}, Total: ${bill + tip:.2f}"

# Just pass functions - auto-registration!
bot = Groqqy(tools=[get_weather, calculate_tip])

response, cost = bot.chat("What's the weather in San Francisco?")
# Agent automatically calls get_weather("San Francisco")

Core Features

๐Ÿง  Agentic Loop

Groqqy implements the ReAct pattern (Reasoning + Acting) for true multi-step problem solving:

User: "Find Python files and count their lines"
     โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ THINK (LLM)    โ”‚  "I need to search for .py files first"
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ACT (Tool)     โ”‚  execute: search_files("*.py")
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ OBSERVE        โ”‚  "Found: app.py, test.py, utils.py"
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ THINK (LLM)    โ”‚  "Now read each file and count lines"
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ACT (Tools)    โ”‚  execute: read_file("app.py"), read_file("test.py")...
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ†“
     [Response]

See docs/ARCHITECTURE.md for deep dive.

๐Ÿ› ๏ธ Built-in Tools

  • read_file(file_path) - Read file contents
  • run_command(command) - Execute shell commands (secure with shlex)
  • search_files(pattern, path) - Find files by glob pattern
  • search_content(query, path) - Search text in files (ripgrep)

๐ŸŒ Platform Tools (v2.0+)

Execute tools on Groq's servers (e.g., web search):

from groqqy import Groqqy, ToolRegistry

registry = ToolRegistry()
registry.register_platform_tool("browser_search")

bot = Groqqy(model="llama-3.3-70b-versatile", tools=registry)

response, cost = bot.chat(
    "What are the latest AI developments this week?"
)
# Agent uses browser_search to get current web information

๐Ÿ“ Conversation Export

Export full conversations with tool calls and results:

# During a session
bot.chat("Calculate the weather in NYC")
bot.chat("What's 15% tip on $87.50?")

# Export to markdown
bot.save_conversation("session.md")

# Export to styled HTML
bot.save_conversation("session.html")

CLI auto-export:

groqqy --export my_session.html

Interactive export:

You: export markdown conversation.md
โœ… Conversation exported to conversation.md

Exports include:

  • All user messages
  • All assistant responses
  • All tool calls with JSON arguments
  • All tool results
  • Timestamps and metadata

Perfect for documentation, debugging, or sharing agent behavior.

๐ŸŽฏ Strategy Pattern

Automatic tool execution strategy selection:

  • LocalToolStrategy: Execute tools in your environment
  • PlatformToolStrategy: Execute on Groq's servers (browser_search, etc.)
  • HybridToolStrategy: Mix local and platform tools intelligently

No configuration neededโ€”strategies auto-detect based on tool types.

Examples

Check out the examples/ directory:

  • basic_chat.py - Simple conversation
  • custom_tools.py - Adding custom tools with decorator pattern
  • tool_usage.py - Tool calling and chaining
  • export_conversation.py - Exporting to markdown/HTML
  • example_web_search.py - Using platform tools for web access
  • reveal_mvp_demo.py - Self-discovery pattern with reveal-cli
  • self_discovery_demo.py - Autonomous tool learning

Run any example:

python examples/basic_chat.py

Documentation

Architecture

Groqqy is built with clean, composable components:

groqqy/
โ”œโ”€โ”€ bot.py              # Simple facade (Groqqy class)
โ”œโ”€โ”€ agent.py            # Agentic loop (THINK/ACT/OBSERVE)
โ”œโ”€โ”€ strategy.py         # Tool execution strategies
โ”œโ”€โ”€ tool.py             # Tool registry system
โ”œโ”€โ”€ tools.py            # Built-in tools
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ conversation.py # Message history
โ”‚   โ”œโ”€โ”€ executor.py     # Tool execution
โ”‚   โ”œโ”€โ”€ exporter.py     # Conversation export
โ”‚   โ””โ”€โ”€ tracker.py      # Cost tracking
โ””โ”€โ”€ providers/
    โ””โ”€โ”€ groq.py         # Groq API integration

Design Principles:

  • All files <365 lines (most <200)
  • Single responsibility per component
  • Easy to read, understand, and modify
  • Production-ready patterns (logging, error handling, cost tracking)

Teaching & Learning

Groqqy is designed as a teaching kernel for agentic AI. Unlike production frameworks (LangChain, LangGraph) with 50,000+ lines of code, Groqqy is:

  • โœ… ~1,500 lines for complete agentic loop
  • โœ… 88-line core algorithm - read and understand in 5 minutes
  • โœ… Explicit patterns - THINK/ACT/OBSERVE labeled in code
  • โœ… Production-ready - not toy code, real patterns
  • โœ… Pedagogical - designed for learning then extending

Perfect for:

  • Computer science courses on AI agents
  • Self-learners exploring agentic patterns
  • Developers understanding agents before using frameworks
  • Workshops and tutorials on tool-calling LLMs

See docs/TEACHING_GUIDE.md for lesson plans and learning paths.

Cost Examples

Real costs from actual usage:

Task Cost
Simple conversation $0.000022
Search files $0.000028
Run command $0.000032
Multi-step task (3 tools) ~$0.000120
1,000 interactions ~$0.03-$0.12

Compare to GPT-4: ~$10-$100 for 1,000 interactions (300x more expensive)

Testing

# Run all tests
pytest

# Run specific test category
pytest tests/unit/
pytest tests/integration/
pytest tests/examples/

# Run with coverage
pytest --cov=groqqy

# Container testing (reproducible environment)
./container_test.sh

Configuration

Groqqy supports persistent configuration via ~/.groqqy/:

~/.groqqy/
โ”œโ”€โ”€ boot.md              # System instructions loaded on startup
โ””โ”€โ”€ knowledge/           # Additional context files
    โ””โ”€โ”€ domain_info.md

CLI options:

groqqy                              # Interactive with boot.md
groqqy --prompt "What's 2+2?"       # Single-shot
groqqy --model llama-3.3-70b-versatile  # Custom model
groqqy --export chat.html           # Auto-export on exit
groqqy --no-boot                    # Skip boot.md

Models

Groqqy supports all Groq models:

# Fast and cheap (default)
bot = Groqqy(model="llama-3.1-8b-instant")

# Fastest (460+ tok/sec)
bot = Groqqy(model="llama-4-scout")

# Best quality
bot = Groqqy(model="llama-3.3-70b-versatile")

# Mixture of experts
bot = Groqqy(model="mixtral-8x7b-32768")

# Platform tools (required for browser_search)
bot = Groqqy(model="llama-3.3-70b-versatile")  # or openai/gpt-oss-20b

Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

Quick start for contributors:

# Clone and install
git clone https://github.com/scottsen/groqqy.git
cd groqqy
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black groqqy/ tests/

# Type check
mypy groqqy/

License

MIT License - see LICENSE file for details.

Related Projects

Support & Community


Built with โค๏ธ using Groq's blazing-fast LPU inference

Perfect for: Learning agentic AI โ€ข Rapid prototyping โ€ข Cost-conscious automation โ€ข Teaching AI agents โ€ข Building proof-of-concepts

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

groqqy-2.2.0.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

groqqy-2.2.0-py3-none-any.whl (31.9 kB view details)

Uploaded Python 3

File details

Details for the file groqqy-2.2.0.tar.gz.

File metadata

  • Download URL: groqqy-2.2.0.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for groqqy-2.2.0.tar.gz
Algorithm Hash digest
SHA256 1a1ad1bfa9f031294b417ee5963b2d9b9653e66edacfdfdfa57385f2a8521f89
MD5 280b2cfbb1269ed79d2077e2cd0f4ed6
BLAKE2b-256 1674cfd39d9bde5bbbf8ff9ccaaf30e29fd2f2e3de639a57479852b7d2bcb6bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for groqqy-2.2.0.tar.gz:

Publisher: publish.yml on scottsen/groqqy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file groqqy-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: groqqy-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 31.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for groqqy-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02b5d20e057137ae2f1fb4b703ca947bbb56b3be2eb57fd496da3a2740524134
MD5 8eb2e1940cef390b0cc4fd39d2bc577c
BLAKE2b-256 6be97bda2b7e47233df6697c14e0e2ac6b02129206a0b59b2e671a5f471aaee2

See more details on using hashes here.

Provenance

The following attestation bundles were made for groqqy-2.2.0-py3-none-any.whl:

Publisher: publish.yml on scottsen/groqqy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page