Drop agent() anywhere in your code to execute agentic workflows โ as easy as print()
Project description
console-agent ๐
agent("debug this")โ as easy asprint()
Drop agent() anywhere in your Python code to execute agentic AI workflows. Powered by Google Gemini via Agno.
โก Quick Start
pip install console-agent
from console_agent import agent, init
# Optional: configure (works with sensible defaults + GEMINI_API_KEY env var)
init(api_key="your-key", model="gemini-2.5-flash-lite")
# Fire-and-forget โ just like print()
agent("analyze this error", context=error)
# Get structured results
result = agent("validate email format", context=email, mode="blocking")
print(result.summary)
print(result.confidence)
๐ญ Persona Shortcuts
Each persona has a specialized system prompt optimized for its domain:
# ๐ก๏ธ Security audit
agent.security("audit this SQL query", context=query)
# ๐ Debug analysis
agent.debug("investigate slow query", context={"duration": dur, "sql": sql})
# ๐๏ธ Architecture review
agent.architect("review API design", context=endpoint)
Personas are auto-detected from prompt keywords, or you can force one:
agent("analyze this code", persona="security")
๐ Async Support
# Native async
result = await agent.arun("analyze this", context=data)
# Works in Jupyter notebooks too!
โ๏ธ Configuration
from console_agent import init
init(
api_key="...", # or set GEMINI_API_KEY env var
model="gemini-2.5-flash-lite", # default model
persona="general", # default persona
mode="fire-and-forget", # or "blocking"
timeout=10000, # ms before timeout
anonymize=True, # auto-strip secrets/PII
dry_run=False, # log without calling API
log_level="info", # silent | errors | info | debug
budget={
"max_calls_per_day": 100,
"max_tokens_per_call": 8000,
"cost_cap_daily": 1.0,
},
)
๐ Structured Output
Get typed responses using Pydantic models:
from pydantic import BaseModel
class CodeReview(BaseModel):
issues: list[str]
severity: str
suggestion: str
result = agent(
"review this function",
context=code,
schema_model=CodeReview,
)
# result.data is a dict matching CodeReview fields
๐ Built-in Safety
- PII/Secret anonymization โ auto-strips API keys, emails, IPs, tokens before sending
- Rate limiting โ token bucket algorithm prevents abuse
- Budget tracking โ daily call limits, token caps, and cost caps
- Dry run mode โ log prompts without making API calls
๐งช Testing
# Install dev dependencies
pip install -e ".[dev]"
# Run unit tests
pytest tests/unit/ -v
# Run integration tests (dry run, no API key needed)
pytest tests/integration/ -v
# Run e2e tests (requires GEMINI_API_KEY)
GEMINI_API_KEY=your-key pytest tests/e2e/ -v
๐ฆ Architecture
console_agent/
โโโ __init__.py # Public API: agent(), init()
โโโ types.py # Pydantic models (AgentResult, AgentConfig, etc.)
โโโ core.py # Agent engine (orchestration, budget, rate-limit)
โโโ personas/ # Specialized AI personas
โ โโโ general.py # ๐ General-purpose
โ โโโ debugger.py # ๐ Error analysis
โ โโโ security.py # ๏ฟฝ๏ธ Security audit
โ โโโ architect.py # ๐๏ธ Architecture review
โโโ providers/
โ โโโ google.py # Agno + Gemini integration
โโโ utils/
โ โโโ anonymize.py # PII/secret stripping
โ โโโ rate_limit.py # Token bucket rate limiter
โ โโโ budget.py # Daily budget tracker
โ โโโ format.py # Rich console output
โโโ tools/
โโโ code_execution.py
โโโ search.py
โโโ file_analysis.py
๐ Also Available
- Node.js:
@console-agent/agent - Docs: console-agent.github.io
- GitHub: github.com/console-agent
License
MIT ยฉ Console Agent
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 console_agent-1.0.0.tar.gz.
File metadata
- Download URL: console_agent-1.0.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9536572871f3ce811bc3e944a0d01bd1dc90e046fb46396bc6ba69ef5e3b50b
|
|
| MD5 |
b519aa122ef0f984de6c7b5d49bbbe64
|
|
| BLAKE2b-256 |
8ca496d472d7ab2467fa4dc0acf535314a2959bb3ade7d24d486be93857fc0de
|
File details
Details for the file console_agent-1.0.0-py3-none-any.whl.
File metadata
- Download URL: console_agent-1.0.0-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc512a92b25d9e7b26e800eada2aa13280b84e3ea30faca97699a21b6032e560
|
|
| MD5 |
d34dfbc008ce3a84b8cb2a278c0c0e79
|
|
| BLAKE2b-256 |
b96749326e8025b9cd624017d9344947988f9a18a08cb68b97e44e27ce1efe41
|