How 0011ashwin/ai-build works
1. System shape: This repo is a multi-service, multi-agent auditing system. The main boundary is between the user-facing app and a set of six independent agent services. Each agent is containerized separately and appears to run as its own deployment unit.
2. Entry point for users: The app/ directory contains the main FastAPI application (app/main.py) plus a small static web UI (frontend/app.js, index.html, style.css). This is the front door for submitting a case, viewing results, and likely triggering the audit workflow.
3. Orchestration layer: The Chief Justice agent is the central coordinator. It likely receives the case context, fans out work to the specialist agents, collects their findings, and synthesizes the final verdict/report. In the architecture diagram, this should sit between the app and the specialist agents as the workflow controller.
4. Specialist agent services: The agents/ folder contains five domain-focused agents plus the Chief Justice:
- quantitative_auditor for statistical bias metrics
- legal_researcher for legal precedent retrieval
- mitigator_juror for fairness-context arguments
- strict_auditor_juror for proxy-bias / prosecution-style scrutiny
- ethicist_juror for human impact and SDG alignment
Each has its own agent.py, adk_app.py, Dockerfile, and pyproject.toml, which indicates they are deployed as isolated Python services.
5. Shared logic boundary: The shared/ package holds reusable cross-service utilities:
- bias_calculator.py for fairness metrics such as disparate impact/statistical parity
- vector_search_client.py for retrieval-backed legal/contextual search
- report_generator.py for assembling audit outputs
- authenticated_httpx.py and a2a_utils.py for authenticated service-to-service / agent-to-agent communication
This shared layer reduces duplication and is the main internal coupling mechanism across services.
6. Data flow through the workflow: A typical flow is: user submits a case in the app → Chief Justice coordinates the audit → specialist agents analyze from their own perspective → outputs are aggregated into a final report. The legal researcher likely adds retrieved precedent, the quantitative auditor adds numeric fairness measures, and the jurors provide argumentative assessments that influence the final decision.
7. External model/runtime dependency: The README states the system is powered by Gemini Pro and Google Cloud Vertex AI. That means the agents are not just rule-based services; they are LLM-backed AI workers. In an architecture diagram, Vertex AI/Gemini should be shown as an external inference dependency used by the agents, especially the orchestrator and research/reasoning agents.
8. RAG subsystem: The legal_researcher plus shared/vector_search_client.py imply a retrieval-augmented generation path for legal/contextual grounding. This is a distinct subsystem from the pure fairness metrics path and should be represented as: agent → vector search / knowledge source → grounded answer returned to the jury workflow.
9. Deployment and packaging model: Every service has a Dockerfile, and the repo includes docker-compose.yaml for local orchestration, plus cloudbuild.yaml and multiple deploy-*.ps1 scripts for GCP rollout. The architecture is therefore container-first, with local composition and cloud deployment as first-class concerns. app/ and each agent are independently deployable units.
10. Operational boundaries: DEPLOYMENT_GUIDE.md, config.yaml, and requirements.txt support environment setup, while the app’s frontend remains lightweight and separate from the AI logic. The backend responsibilities are split cleanly: presentation in app/, reasoning in agents, shared utilities in shared/, and cloud/model infrastructure outside the repo.
Main entry points: chief_justice/agent.py Chief Justice · docker-compose.yaml Compose · report_generator.py Report Gen · quantitative_auditor/agent.py Quant Auditor
Components 18
User App
FastAPI front door and lightweight web UI.
Agent Services
Independent LLM-backed auditing and reasoning services.
- Chief Justice · Coordinates specialist agents and synthesizes the final verdict.
agents/chief_justice/agent.py - Quant Auditor · Computes statistical fairness and bias measures.
agents/quantitative_auditor/agent.py - Legal Researcher · Retrieves legal precedent and contextual grounding.
agents/legal_researcher/agent.py - Mitigator Juror · Builds fairness-context and mitigation arguments.
agents/mitigator_juror/agent.py - Strict Juror · Applies proxy-bias and prosecution-style critique.
agents/strict_auditor_juror/agent.py - Ethicist Juror · Evaluates human impact and SDG alignment.
agents/ethicist_juror/agent.py
Shared Core
Reusable cross-service utilities and output assembly.
- Bias Calc · Reusable disparate impact and parity calculations.
shared/bias_calculator.py - Vector Search · Shared client for grounded legal/context lookup.
shared/vector_search_client.py - Report Gen · Formats and assembles audit findings into final reports.
shared/report_generator.py - Auth HTTPX · Authenticated HTTP client for service-to-service calls.
shared/authenticated_httpx.py - A2A Utils · Helpers for agent-to-agent communication patterns.
shared/a2a_utils.py
External Services
Model, search, and deployment dependencies outside the repo.
- Vertex AI · External Gemini/Vertex inference runtime used by agents.
- Knowledge Source · External corpus or index queried for legal grounding.
- Compose · Container composition for running the app and agents locally.
docker-compose.yaml - Cloud Deploy · GCP build and rollout scripts for containerized services.
cloudbuild.yaml
Connections 33
- Web UI → Main API: submit case · Browser UI sends cases into the API backend.
- UI logic → Main API: API calls · Client script drives requests and result rendering.
- Main API → Chief Justice: start audit · Main app hands case context to the orchestrator.
- Chief Justice → Quant Auditor: request metrics · Delegates statistical bias analysis.
- Chief Justice → Legal Researcher: request precedent · Delegates grounded legal/context retrieval.
- Chief Justice → Mitigator Juror: request mitigation · Delegates fairness and mitigation reasoning.
- Chief Justice → Strict Juror: request scrutiny · Delegates adversarial proxy-bias review.
- Chief Justice → Ethicist Juror: request ethics · Delegates human-impact and responsibility assessment.
- Quant Auditor → Bias Calc: uses · Computes fairness metrics through shared logic.
- Legal Researcher → Vector Search: retrieves · Grounds answers using retrieval client.
- Vector Search → Knowledge Source: queries · Searches external indexed knowledge.
- Chief Justice → Report Gen: assemble report · Combines specialist findings into the final output.
- Quant Auditor → Report Gen: metrics input · Feeds numeric analysis into the report.
- Legal Researcher → Report Gen: research input · Feeds retrieved precedent into the report.
- Mitigator Juror → Report Gen: argument input · Feeds mitigation reasoning into the report.
- Strict Juror → Report Gen: critique input · Feeds adversarial critique into the report.
- Ethicist Juror → Report Gen: ethics input · Feeds human-impact assessment into the report.
- Chief Justice → Vertex AI: LLM calls · Coordinator relies on external Gemini/Vertex inference.
- Quant Auditor → Vertex AI: LLM calls · Reasoning and summarization use external model runtime.
- Legal Researcher → Vertex AI: LLM calls · Retrieval-augmented generation uses external model runtime.
- Mitigator Juror → Vertex AI: LLM calls · Argument synthesis uses external model runtime.
- Strict Juror → Vertex AI: LLM calls · Adversarial analysis uses external model runtime.
- Ethicist Juror → Vertex AI: LLM calls · Ethical assessment uses external model runtime.
- Chief Justice → Auth HTTPX: service calls · Uses authenticated transport for internal requests.
- Chief Justice → A2A Utils: agent comms · Uses shared helpers for inter-agent coordination.
- Compose → Main API: runs · Local container orchestration includes the app service.
- Compose → Chief Justice: runs · Local container orchestration includes the orchestrator agent.
- Compose → Quant Auditor: runs · Local container orchestration includes specialist agents.
- Compose → Legal Researcher: runs · Local container orchestration includes specialist agents.
- Compose → Mitigator Juror: runs · Local container orchestration includes specialist agents.
- Compose → Strict Juror: runs · Local container orchestration includes specialist agents.
- Compose → Ethicist Juror: runs · Local container orchestration includes specialist agents.
- Cloud Deploy → Compose: deploys · Deployment tooling mirrors the containerized service layout.