Skip to main content

An agentic AI tax advisor CLI chat app

Project description

Tax Advisor

Agentic CLI for tax Q&A, built around a tool-capable chat loop.

What this project is today

  • Python CLI app (not a web service) in src/tax_advisor/.
  • Entrypoints:
    • Console script: tax-advisor -> tax_advisor.cli:main (pyproject.toml)
    • Module run: python -m tax_advisor (src/tax_advisor/__main__.py)
  • Current tooling includes get_current_date in src/tax_advisor/tools.py.

Quick start

uv sync
uv run tax-advisor

Alternative:

uv run python -m tax_advisor

Current architecture (implemented)

  1. src/tax_advisor/cli.py (main) runs a REPL with slash commands (/quit, /clear, /model <name>).
  2. User input is sent to Agent.run(...) in src/tax_advisor/agent.py.
  3. Agent calls chat_completion(...) in src/tax_advisor/models.py (LiteLLM wrapper).
  4. Streaming deltas are assembled in Agent._handle_stream(...) and printed as tokens arrive.
  5. Tool calls are executed via execute_tool(...) in src/tax_advisor/tools.py.
  6. Tool outputs are appended as {"role": "tool", ...} messages and the model loop continues.
  7. Safety guard: MAX_TOOL_ROUNDS = 10 prevents runaway tool recursion.

Configuration

Environment-driven settings live in src/tax_advisor/config.py:

  • TAX_ADVISOR_MODEL (default: gpt-4o)
  • TAX_ADVISOR_TEMPERATURE (default: 0.3)
  • TAX_ADVISOR_SYSTEM_PROMPT

Planned: document ingestion + RAG for tax documents

Goal: answer questions using uploaded tax documents while minimizing exposure of confidential data.

Target pipeline

  1. Ingest: load files (PDF/CSV/TXT/JSON initially) into a normalized document format.
  2. Extract: text extraction + metadata (source, doc_type, tax_year, page/section).
  3. Redact (mandatory): detect and mask sensitive fields before chunking/indexing.
  4. Chunk + Embed: create retrieval chunks and vector embeddings.
  5. Index: store vectors + sanitized metadata in a vector store.
  6. Retrieve: query-time retrieval by semantic similarity + metadata filters.
  7. Answer: ground responses on retrieved chunks with source references.
  8. Audit: log retrieval context and redaction events for traceability.

Confidential data redaction policy (must-have)

Redaction should run in at least two places:

  • Pre-index redaction (required): no raw sensitive values are written to vector index.
  • Pre-response redaction (required): final model output is scanned and masked before display.

Sensitive categories to redact:

  • SSN (including partial patterns)
  • Date of birth (DOB)
  • Physical addresses
  • Person names

Recommended behavior:

  • Replace with stable placeholders like [REDACTED_SSN], [REDACTED_DOB], [REDACTED_NAME].
  • Keep minimal non-sensitive context so retrieval quality remains usable.
  • Fail closed: if redaction/classification fails, do not index or return raw text.

Proposed module layout for RAG extension

  • src/tax_advisor/ingestion/loader.py - file readers and normalization.
  • src/tax_advisor/ingestion/extract.py - text extraction and metadata.
  • src/tax_advisor/privacy/redactor.py - PII detection/masking policies.
  • src/tax_advisor/rag/chunking.py - chunk creation strategy.
  • src/tax_advisor/rag/index.py - embedding + vector index adapter.
  • src/tax_advisor/rag/retrieve.py - retrieval orchestration.
  • src/tax_advisor/rag/pipeline.py - end-to-end ingest/query workflows.

Development commands

uv run ruff check .

Notes

  • Keep OpenAI-style message schema compatibility (role, content, tool_calls, tool_call_id).
  • Tool additions should update all three places in src/tax_advisor/tools.py: definition, implementation, and registry.

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

tax_advisor-0.1.6.tar.gz (733.2 kB view details)

Uploaded Source

Built Distribution

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

tax_advisor-0.1.6-py3-none-any.whl (367.7 kB view details)

Uploaded Python 3

File details

Details for the file tax_advisor-0.1.6.tar.gz.

File metadata

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

File hashes

Hashes for tax_advisor-0.1.6.tar.gz
Algorithm Hash digest
SHA256 cae64958a2bd39900bd3c6cd247715da5cfc04817f059fa8506dc2e75df0b409
MD5 1d716d2dffafda0c4f381c3b8164c08e
BLAKE2b-256 afee83c6c7ba31ae52d6a8336f6a51d420d775a138da0722e76769eee6c5dba5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tax_advisor-0.1.6.tar.gz:

Publisher: publish.yml on drajbanshi/tax-advisor

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

File details

Details for the file tax_advisor-0.1.6-py3-none-any.whl.

File metadata

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

File hashes

Hashes for tax_advisor-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cc7f7a2e3a02cd4c82fff067b267316b6d8a79c00e7b5e2fc20c8f064426fe65
MD5 34c1428554adb817721ee9314404e25f
BLAKE2b-256 39a5e8f5bdc8c5f39a37f9ea349de9abf4ded8d1ca1d4758b90f7c5fc0a1f2c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for tax_advisor-0.1.6-py3-none-any.whl:

Publisher: publish.yml on drajbanshi/tax-advisor

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