Inspiration
When I ask AI for ideas or answers or code, sometimes it misinterprets what I ask for and I only realize once it's done, wasting time and tokens. I have always wanted to build something that I could be more in control of, and this autoresearch opportunity presented itself.
What it does
Focai is a cockpit for autonomous research agents. You give it a research objective and a project folder, and an AI agent investigates it as a live tree of hypotheses. Each hypothesis is turned into a code edit, run as a real experiment, and judged by its measured result. The tree shows the agent’s reasoning at every step: what it tried, why, what happened, how confident it is, and which of your notes influenced the decision.
You stay in control the whole time. Unpromising ideas are parked with a reason and can be restored with one click. Type a steering instruction such as “focus on the optimizer” and it becomes a chip that re-rates every unrun and parked branch without re-running any experiment, then suggests where to continue from. A knowledge vault of your own notes, tagged and summarized by an LLM and shown as a mind map, informs which experiments the agent proposes and which it skips.
How we built it
The backend is Python with FastAPI, and live updates are streamed to the UI over server-sent events. The agent is our own orchestrator, not an off-the-shelf framework. Plain code owns the tree, the budget, and every state change, while Gemini models propose hypotheses, rank sibling candidates, and interpret results inside fixed phases. The agent has read-only tools such as vault search and a results lookup. It never runs commands, and every edit passes through validation first. The frontend is React and TypeScript with React Flow for the tree and a force-directed graph for the vault. We ran experiments on the Hack the Valley workshop’s tiny language-model environment, with all responses cached for a replay mode.
I borrowed ideas from ToolTree (pre- and post-execution pruning) and Karpathy’s autoresearch (the keep-or-revert loop), and chose not to implement full tree search.
Challenges we ran into
Token costs and free-tier limits. Stateless APIs resend the whole prompt on every tool round trip, so some steps ballooned to around 20k tokens. We cut round trips, trimmed context, and cached everything. Noisy signals. Ten-second training runs vary from run to run, and LLM judges can be wrong, so we repeat baselines, keep the judge lenient, and show the measured spread. Letting an LLM edit code safely. We validate every edit and confine changes to the files the user lists. Keeping it legible. A tree of AI decisions is only useful if a person can follow it. Accomplishments that we’re proud of A research agent whose every decision is visible, explained, and reversible Steering that visibly re-rates the whole tree from one sentence Decisions that cite the user’s own notes
What we learned
A stateless API means “memory” is really orchestration: rebuild a compact prompt from stored state each time. Objective measurements make an agent far easier to trust than an LLM grading itself. A human steering in plain language changes an agent’s course more than any amount of extra automation.
What’s next for Focai
More compacting for token saving: rolling summaries, prompt caching, smaller tool results, and fewer round trips per step. Multi-user features and logins: shared runs, per-person vaults and permissions, and teammates whose judgment can disagree. Support for more research domains beyond code experiments. Saved and shareable runs.
Built With
- fastapi
- python
- react
- tailwind
- typescript
Log in or sign up for Devpost to join the conversation.