Skip to main content
█▀▀ █▀█ █▄ █ █▀ █▀█ █   █▀▀
█▄▄ █▄█ █ ▀█ ▄█ █▄█ █▄▄ ██▄
       .agent

agent("debug this") — as easy as print()

Drop agent() anywhere in your Python code to execute agentic AI workflows. Powered by Google Gemini & Ollama via Agno.

PyPI Python License: MIT


⚡ 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!

🔌 Providers

Google Gemini (default)

Cloud-hosted, full tool support, API key required.

from console_agent import init

init(
    provider="google",                # default
    api_key="...",                    # or set GEMINI_API_KEY env var
    model="gemini-2.5-flash-lite",   # default model
)

Ollama (Local Models)

Run models locally with Ollama. Free, private, no API key needed.

# 1. Install Ollama: https://ollama.com
# 2. Pull a model
ollama pull llama3.2
from console_agent import init

init(
    provider="ollama",
    model="llama3.2",                         # any model from `ollama list`
    ollama_host="http://localhost:11434",      # default
)

Provider Comparison

Google Gemini Ollama
Setup GEMINI_API_KEY env var Install Ollama + pull model
Config provider="google" provider="ollama"
Models gemini-2.5-flash-lite, etc. llama3.2, any ollama list model
Tools ✅ google_search, code_execution, url_context ❌ Not supported
Thinking ✅ Supported ❌ Not supported
File attachments ✅ Full support ⚠️ Text-only
Cost Pay per token (very cheap) Free (local)
Privacy Cloud (with anonymization) 100% local

⚙️ Configuration

from console_agent import init

init(
    provider="google",                # "google" | "ollama"
    api_key="...",                    # or set GEMINI_API_KEY env var
    model="gemini-2.5-flash-lite",   # default model
    ollama_host="http://localhost:11434",  # Ollama host (when provider="ollama")
    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
│   └── ollama.py        # Agno + Ollama integration (local models)
├── 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

License

MIT © Console Agent

Metadata

Release files for console-agent 1.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for console-agent 1.2.3
File Size Uploaded Provenance
console_agent-1.2.3.tar.gz 56.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for console-agent 1.2.3
File Interpreter ABI Platform
console_agent-1.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 94.0 kB

Release files / console_agent-1.2.3.tar.gz

Download URL console_agent-1.2.3.tar.gz
Size 56.7 kB
Tags Source
SHA-256 checksum
How to use checksums
63e3dda602d82e60adb2f749ce9a1712446f242d855b7ebebc694147adeddedd
BLAKE2b-256 checksum
How to use checksums
1a3264f9d3bc04a3bce8bd359f4f238f7f83b9f4415baf1c37a6bd4d888d4fe2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / console_agent-1.2.3-py3-none-any.whl

Download URL console_agent-1.2.3-py3-none-any.whl
Size 37.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f64f314a07f800c6cdc4972c67026252a385a9b6ee8051e1b2e6fd158e50d8de
BLAKE2b-256 checksum
How to use checksums
35672c826ca2e905aaa2f460d46c97aa06fdb111ebb34e1f4466a820ed383d5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for console-agent 1.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page