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.2.2
Pure LLM Mode & Code Quality:
- ๐ซ Disable Tools: New
tools=Noneparameter for pure text generation without tool-calling overhead - ๐ Security Fixes: Replaced bare except clauses with specific exception handling
- ๐ PEP 8 Compliance: All core modules now pass linting with zero issues
- โ Comprehensive Testing: 20/20 tests passing including new --no-tools test suite
- ๐ Complete Documentation: README and CHANGELOG fully updated
Previous Features (v2.1.0):
- ๐ 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
Model Selection for Tool Calling
When using Groqqy for agentic workflows with tool calling, model selection matters:
Recommended Models (2025)
| Model | Tool Calling | Speed | Cost | Recommendation |
|---|---|---|---|---|
| llama-3.3-70b-versatile | โ Excellent | Fast | $0.001/query | Best for production |
| llama-4-scout | โ Excellent | Fast | $0.0004/query | Optimized for tool use |
| llama-3.1-8b-instant | โ ๏ธ Inconsistent | Fastest | $0.0003/query | Testing only |
Known Issue: tool_use_failed Errors
Symptom: RuntimeError: Groq API error (400): tool_use_failed
Cause: Some models (especially 8b) occasionally generate tool calls wrapped in XML tags (<function=name>{...}</function>) instead of pure JSON. Groq's API rejects this format.
Solution: Use llama-3.3-70b-versatile for production tool calling:
from groqqy import Groqqy
# Recommended for production
bot = Groqqy(model="llama-3.3-70b-versatile")
# Cheaper but less reliable
bot = Groqqy(model="llama-3.1-8b-instant") # May fail on tool calls
Cost trade-off: 70b model costs ~3x more ($0.001 vs $0.0003 per query) but provides consistent tool calling. Still 100x cheaper than Claude.
See also: Groq Tool Use Documentation | Supported Models
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")
Pure LLM Mode (No Tools)
Sometimes you want pure text generation without any tool-calling:
from groqqy import Groqqy
# Disable tools entirely for pure LLM mode
bot = Groqqy(tools=None)
# Fast, focused text generation (no tool overhead)
response, cost = bot.chat("Write a haiku about coding")
# Agent generates text directly, no tool calls attempted
When to use tools=None:
- Pure text generation (summaries, creative writing, etc.)
- Fact extraction from existing data
- Scenarios where tool-calling causes problems (loops, hallucinations)
- Faster generation with smaller models (no tool overhead)
Example use case - Fact extraction:
# Extract structured information without tools
bot = Groqqy(model="llama-3.1-8b-instant", tools=None)
data = """
Session: test-123
Files: app.py, test.py
Errors: 5 type errors, 2 lint warnings
"""
response, cost = bot.chat(f"Extract facts from this data:\n{data}")
# Clean output, no tool calls, 3x faster
Note: Omitting the tools parameter creates default tools (backwards compatible). Use tools=None explicitly to disable.
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 contentsrun_command(command)- Execute shell commands (secure with shlex)search_files(pattern, path)- Find files by glob patternsearch_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
- docs/USER_GUIDE.md - Comprehensive usage guide
- docs/ARCHITECTURE.md - Deep dive into design and components
- docs/TEACHING_GUIDE.md - Using Groqqy to learn/teach agentic AI
- docs/guides/ - Feature-specific guides and tutorials
- CONTRIBUTING.md - How to contribute
- DEVELOPMENT.md - Developer setup and workflow
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
- Groq API Docs - Groq's LPU inference
- ReAct Paper - Reasoning + Acting framework (Yao et al., 2022)
- LangChain - Production agentic framework
- LangGraph - Graph-based agents
Support & Community
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Examples: Check
examples/directory
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file groqqy-2.3.0.tar.gz.
File metadata
- Download URL: groqqy-2.3.0.tar.gz
- Upload date:
- Size: 34.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7ac80adfaf07d4f4d56e5c350a6cbefa48e48c053dd9697323ead11a2a0c148
|
|
| MD5 |
6d9fe5c8f93f6dc295c6bc635c98063b
|
|
| BLAKE2b-256 |
d2431e32e8daacc436b3b8984587562974853160976cc618a8c2bbe0a758a90e
|
Provenance
The following attestation bundles were made for groqqy-2.3.0.tar.gz:
Publisher:
publish.yml on scottsen/groqqy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
groqqy-2.3.0.tar.gz -
Subject digest:
d7ac80adfaf07d4f4d56e5c350a6cbefa48e48c053dd9697323ead11a2a0c148 - Sigstore transparency entry: 738710847
- Sigstore integration time:
-
Permalink:
scottsen/groqqy@8262f3f96c33214748530bd1884d4267f689bab7 -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/scottsen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8262f3f96c33214748530bd1884d4267f689bab7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file groqqy-2.3.0-py3-none-any.whl.
File metadata
- Download URL: groqqy-2.3.0-py3-none-any.whl
- Upload date:
- Size: 34.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5688539cbbabae7c348a5ac20d05fd4938174324c94205ea015a0986f47a0434
|
|
| MD5 |
6dc2cafc758ed47ed54cb5891cf0c494
|
|
| BLAKE2b-256 |
92c81bc5ef2406e189768e148dfa54ef6a9947591eb83bf87306a4683107c010
|
Provenance
The following attestation bundles were made for groqqy-2.3.0-py3-none-any.whl:
Publisher:
publish.yml on scottsen/groqqy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
groqqy-2.3.0-py3-none-any.whl -
Subject digest:
5688539cbbabae7c348a5ac20d05fd4938174324c94205ea015a0986f47a0434 - Sigstore transparency entry: 738710863
- Sigstore integration time:
-
Permalink:
scottsen/groqqy@8262f3f96c33214748530bd1884d4267f689bab7 -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/scottsen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8262f3f96c33214748530bd1884d4267f689bab7 -
Trigger Event:
release
-
Statement type: