Inspiration

Teams are quietly becoming org charts with AI agents on them. One person hands work to three or four agents, those agents burn tokens, and when one gets stuck it just waits. Nobody owns it, nobody sees what it costs, and nobody gets told. So we asked: what if agents sat on the org chart like everyone else, with a manager, a status, a budget, and a way to ask for help?

What it does

Spacetime Org is a live org chart for hybrid human + AI teams. Leads manage Workers, Workers manage Agents, all in one hierarchy.

  • Delegate: create a task, assign it to an agent, hit Run Agent. The agent turns Busy, runs on Claude, and checks the task off when done.
  • Agents that see the web: when a task needs real facts, the agent decides on its own to call a browse_web tool powered by Apify, then cites the pages it read.
  • Right model for each agent: every agent runs on its own Claude model (Opus for hard debugging, Haiku for cheap high volume triage), switchable from the node inspector.
  • Know what it costs: every run logs tokens, latency, and cost, rolled up per agent and per person who owns those agents.
  • Escalate automatically: a stuck agent pauses and opens a handoff to its manager. No answer in 15 seconds? It climbs the chain until a human responds.
  • Investigate problems: a scanner flags anomalies like an offline agent still holding tasks. A Claude investigator gathers evidence and returns facts, a hypothesis, and next steps. Humans can correct it, and that correction becomes a lesson it uses next time.
  • Role scoped views: the CEO sees the whole org, a lead sees only their own team.

How we built it

  • Frontend: Next.js 16 (App Router), React 19, TypeScript, Tailwind v4, with a pannable, zoomable topology map.
  • Realtime state: SpacetimeDB on Maincloud. Org nodes, tasks, handoffs, and activity live in tables that every browser subscribes to. Escalation runs inside the database as a scheduled reducer, so pausing the agent, opening the handoff, and starting the timer happen in one transaction.
  • Agents: Anthropic SDK called from Next.js API routes, so keys never touch the browser. A tool use loop handles web research, capped at 4 tool turns before the agent is forced to answer.
  • Web access: Apify RAG Web Browser for search and page reads, Apify Website Content Crawler for the company research panel.
  • Cost tracking: usage is summed across every turn of a run, then priced per model:

$$\text{cost} = \frac{T_{in}\,p_{in} + T_{out}\,p_{out} + T_{cache\ read}\,p_{cr} + 1.25\,T_{cache\ write}\,p_{in}}{10^6}$$

  • Auth: HMAC signed session cookies, with role scoping enforced in a single hook (useOrgData) so every page respects it.

Challenges we ran into

  • Thinking in SpacetimeDB. Reducers must be deterministic and can't return data, so "call a function, get a result" became "call a reducer, watch the table." A deprecated connection API also broke our client mid build.
  • Escalation timing. A timer that reschedules itself up the chain, and stops cleanly when a human answers or it hits the top of the org, took several iterations.
  • Keeping the hierarchy valid. Reassigning a node only offers valid superiors, so nobody can end up reporting to their own agent.
  • Honest cost numbers. One agent run can span several API calls, and cache reads and writes bill differently, so we summed usage across every turn instead of trusting the last response.
  • One repo, one weekend, many hands. Lots of merge conflicts and regenerated bindings.

What we learned

  • Moving logic into the database (scheduled reducers plus live subscriptions) removes a whole server layer and makes multi user state feel instant.
  • Agents are most useful when they decide when to use a tool, instead of us hard coding it.
  • Visibility is the missing piece for AI at work. Once you can see who owns an agent, what it costs, and when it's stuck, handing it real work stops feeling risky.

Built With

Share this project:

Updates

Submission history