PTES
Talk to Sigil Labs

Client work

Raya

Raya is an agentic financial planning platform under construction for the consultants of an investment consulting firm: the calculation modules and the data are ready, and the AI agents are in development.

By Sigil Labs · Published · Updated

Client: an investment consulting firm

← All projects

Fact sheetNo. 10
Technologies used
  • FastAPI
  • PostgreSQL
  • Redis
  • React
  • TypeScript
  • Docker
  • AWS S3
Status
In deployment

The problem

An investment consultant’s work splits into distinct strands: diagnosing the client, designing pension plans, allocating assets and delivering reports. Part of it lives in separate prototypes and spreadsheets, and the market data used for allocation comes from a spreadsheet updated by hand.

Raya brings those strands into a single internal web application and includes its own data pipeline, built to replace that spreadsheet.

What was built

The platform covers the consultant’s strands of work, with an interface in Portuguese, English and Spanish:

  • individual diagnostics, with questionnaires on emotional profile and financial beliefs and an immediate feedback report;
  • collective diagnostics, with anonymous campaigns for companies and pension funds, a public response link and a corporate report in PDF;
  • an 8-step studio for designing supplementary pension plans and calculating the target return needed to reach an income-replacement goal, with a simplified public calculator beside it;
  • an asset-allocation workspace for each client, with 9 tabs, among them portfolios, economic scenario, backtest, future projection, risk and report.

The platform also includes an investor-profile questionnaire and a macro-scenario engine that projects 28 asset classes across five scenarios.

An agentic platform

Raya was designed as an agentic platform. The calculation modules and the market data are ready, and the AI agents are in development. Today, the team’s AI assistants only query the market data, through a read-only MCP server.

How it works

The backend is an asynchronous FastAPI service on PostgreSQL 15 and Redis. The frontend is a React application in TypeScript. All calculation, from scoring to the actuarial engine and the risk metrics, runs in the platform’s own backend and does not depend on external services at the time of use.

Access is limited to the consultants. Passwords use Argon2id, a session lasts 8 hours, and deactivating a consultant takes effect immediately. The login limits failed attempts.

Two rules are enforced by the system itself: anonymity in collective surveys and an immutable record of the investor profile. The collective report requires at least 30 responses, and cuts with fewer than 10 respondents are suppressed. In the investor-profile questionnaire, the PDF is written to immutable storage before the record exists: if the write fails, no profile is created.

The data platform and deployment

Market data goes through a three-layer lakehouse. The bronze layer keeps the supplier’s raw data, immutable, in S3. The silver layer converts it into cleaned, checked Parquet. The gold layer holds the curated tables, in a Postgres schema of its own, separate from the product schema and with different credentials.

The pipeline is orchestrated with Airflow, with monthly and daily scheduled flows and a portfolio flow. Because the supplier’s query quota is finite, retries are limited, and the portfolio flow checks a query ceiling before it starts querying. The pipeline’s credentials sit in a secrets vault and are read at run time. A read-only MCP server with 7 tools gives the team’s AI assistants access to the silver and gold data. It requires a token, limits rows and time per query, and uses a database role with no access to the application schema.

The infrastructure follows documented practices:

  • Deploy gated on a CI attestation. The script runs on the instance and deploys only a commit that CI has approved, except in an emergency, and that exception is logged. It rebuilds the images with Docker Compose, applies the Alembic migrations and records the deploy only after a public health check passes. Rollback is a revert on main followed by another deploy.
  • Segregated network. Production, staging and development live on separate networks. The application sits in a private subnet with no public IP, and traffic arrives through a load balancer with managed TLS. Administrative access does not use SSH.
  • On-demand environments. Staging and development are switched on by command and shut down automatically at the end of the day. Production never receives that automation.
  • Backup and alerts. The database is copied every day to a private, versioned S3 bucket. Alarms report downtime, changes to security configuration and spending above plan.

Who it is for and what stage it is at

Raya is being deployed and is for internal use.

Sigil Labs built the application, the data pipeline and the cloud infrastructure on AWS. The project combines custom software and infrastructure: one repository holds the product, the data pipeline and the deploy scripts.

Frequently asked questions

What is Raya?

Raya is an agentic financial planning platform under construction for the consultants of an investment consulting firm: the calculation modules and the data are ready, and the AI agents are in development. Built by Sigil Labs, it brings together diagnostics, a studio for designing pension plans, an asset-allocation workspace and PDF reports. All calculation runs on the platform's own server.

Who is Raya for?

Only the consultants of the investment consulting firm it was built for, in two roles: consultant and administrator. There is no end-client login. People who answer a questionnaire or use the public calculator reach open pages that need no password.

How is Raya deployed and hosted?

The deploy runs on the instance itself and requires CI's attestation for the commit; the only exception is an emergency mode, which is logged. After rebuilding the images and applying the migrations, the script confirms the service is healthy before it records the deploy as finished. The environments sit on separate networks, the application runs in a private subnet and administrative access does not use SSH.

How does Raya organize its market data?

A three-layer pipeline archives the raw data first, then the cleaned data as Parquet, and finally the curated tables in a Postgres schema of their own. The pipeline runs on a separate instance from the platform, so a failure in extraction does not take down the consultants' platform.

How does Raya protect the anonymity of people who answer collective surveys?

The aggregate report of a campaign is generated only once the campaign is closed and has at least 30 scored responses. Inside the report, any demographic cut with fewer than 10 respondents is suppressed, and cuts are never crossed with one another.

Can AI assistants access Raya's data?

Yes, within limits. A read-only MCP server exposes the market data in the silver and gold layers to the team's AI assistants, with token authentication, a row limit and a maximum time per query. The database role that server uses has no access to the application schema.

← All projects