Enterprise AI Knowledge & Action Hub
Architecture & engineering decisions
A conversational interface joins enterprise knowledge retrieval, structured employee queries and a human-reviewed action workflow. Python owns authorization and execution; model calls help select tools and synthesize answers.
From question to evidence-backed answer
- Resolve identity. Streamlit sends the request to FastAPI. Hosted calls use the frontend service's Google identity for Cloud Run invocation plus application authentication. Local and hosted demo login use database-backed user sessions. Cloud IAM service identity and application user identity are separate authorization layers.
- Choose a bounded plan. The orchestrator loads conversation context and requests tool selection when needed. Round limits and duplicate-call suppression bound the tool loop.
- Authorize before execution. ToolExecutor checks the resolved identity's permissions and validates arguments before dispatching a protected operation.
- Retrieve permitted evidence. RAG coordinates embedding and hybrid search. KnowledgeRepository applies role filters in SQL; employee repositories provide structured database results.
- Ground the response. Grounding and answer-strategy logic determine whether evidence supports an answer, a deterministic result, or abstention. The UI renders sources and optional proposals.
Engineering choices and their evidence
Authorization is application logic
A model-selected tool never grants privileges. Identity checks, tool authorization and knowledge role filters enforce access at their respective boundaries.
Reader denied; HR reader authorizedEvidence before a fluent answer
Retrieval supplies authorized evidence. Insufficient evidence can produce abstention, while supported knowledge claims include citations.
Policy answer and unsupported questionProposal and decision are separate
The agent's salary tool persists a pending proposal. Separate approval/rejection endpoints handle the human decision. The portfolio demonstrates rejection without executing a salary change.
Pending proposal → rejectionKnowledge administration is explicit
Employee write access does not imply upload access. Ingestion requires knowledge-management permission and handles parsing, chunking, embeddings, persistence and duplicate detection.
Upload permission and retrieval evidenceServices and repositories have different jobs
Services coordinate application behavior; repositories implement database access. Composition injects providers and collaborators into extracted services.
Execution is observable
The optional sanitized inspector exposes measured stages, model/tool call counts, outcomes and latency. One trace explains one captured run; it is not a general performance benchmark.
Two-tool comparison and inspectorLocal and hosted boundaries
| Area | Local demonstration | Hosted deployment |
|---|---|---|
| UI and API | Streamlit and FastAPI containers | Public Streamlit Cloud Run service; IAM-protected FastAPI Cloud Run service |
| Database | PostgreSQL/pgvector container | Neon PostgreSQL with SSL required |
| Identity | Three signed-in demo accounts for role tests | Database-backed demo sessions; frontend Google service identity invokes backend; reader API-key configuration retained |
| Providers | External model and embedding APIs; the database remains the source for structured records and stored knowledge | |
| Configuration | Local environment configuration | Cloud Run environment and Secret Manager references |
Repeatable release, explicitly initiated
A manual submission starts an automated Cloud Build pipeline. The release packages tracked source from a commit; it does not copy the local PostgreSQL volume or untracked working files.
- Build backend and frontend images with commit/build identifiers.
- Run focused tests, disposable-PostgreSQL checks, a real FastAPI startup check and release-orchestration tests.
- Publish the tested images to Artifact Registry.
- When deployment is explicitly enabled, inspect existing configuration and backend IAM policy, then run the migration job.
- Deploy backend and frontend sequentially. Confirm Cloud Run readiness, a ready revision and 100% latest-revision traffic.
- Perform separate browser checks for grounded answers, authorization denial and abstention.
Cloud releases completed successfully on October 18 and 19, 2026. Hosted reader sign-in/logout, policy retrieval, employee-data denial, HR-reader queries and writer proposal/rejection were verified. Image releases now preserve the configured login setting.
Control-plane readiness is distinct from functional or security verification. The pipeline does not automate the browser checks, provide automatic rollback, or make the two service deployments atomic.
Scope of the demonstration
The portfolio shows working behaviors, not a claim of enterprise SSO, production-scale reliability or complete security coverage. Privileged role screenshots were captured locally. The salary evidence covers the proposal/rejection path. Demo sessions cannot use the legacy direct salary-update endpoint; legacy API-key integrations retain that route. Writer self-approval is intentional for this demo; separate approver duties are not enforced. Evaluation results and trace timings should be read within their specific test scope.