Skip to content

Infera

Agent harness for a product-team workspace

Built with Ajay Kannan Sekar. I wrote the agent service, the assistant panel and the skills.

  • Team project (2 people)
  • Python
  • FastAPI
  • Postgres
  • React

Overview

Infera's agent harness is the loop behind the assistant in a product-team workspace: Python 3.12 and FastAPI, with its own agent loop and no agent framework.

It plans from skills, fans out to bounded sub-agents, and quarantines everything that comes from the web. The product manager stays in charge of changes: the run's own edit lands as a version they can undo, and edits to other documents or to project memory wait as diffs they accept or reject.

How it works

One turn of the agent

A request from the assistant panel is classified, planned from a skill, run step by step and checked before anything is written.

Fig. 01 · One turn, full path
One turn of the Infera agent, on the full pathA request is classified. The fast path, at most three tool calls, is not taken here. On the full path one main-model call understands the request and selects skills, a plan is built from the skill's steps, read steps run up to four at a time, then a draft is checked and written as an undoable version. The run is checkpointed after each step.≤4 READS AT ONCEESCALATEREQUESTfrom the panelCLASSIFYrules, then modelFAST PATHat most 3tool callsUNDERSTANDselects skillsPLANskill's stepsREADREADREADREADDRAFTmain modelCHECKSnumbers · citationsWRITEversion · undoknock-on edits, memory →PM accepts or rejectscheckpoint · state saved,run resumable
  1. 01 Classify

    A request arrives from the assistant panel. Rules pick the path first; a classifier model decides only when the rules are unsure, and an unsure answer goes to the full path.
  2. 02 Choose a path

    The fast path is one tool loop on the main model with at most 3 tool calls. If it turns out to need a skill, the turn moves to the full path. This pass takes the full path.
  3. 03 Understand and plan

    One main-model call reads the request and selects skills. The plan is built from the selected skill's default steps.
  4. 04 Run the plan

    Ready read steps run up to 4 at a time. The run is checkpointed after each step, so a restarted service resumes it.
  5. 05 Check and write

    The draft gets deterministic number and citation checks, then lands in the document as a version the PM can undo. Knock-on edits and memory changes wait for the PM.

Skills and sub-agents

The main agent selects a skill from an index in the cached prompt and hands bounded tasks to sub-agents, which return a compact result rather than their transcript.

Fig. 02 · Sub-agents and skills
Sub-agents and skillsThe skill index sits in the cached prompt. The main agent selects a skill, and the skill's body travels with each task to the sub-agents: researchers (one per topic, up to four at once), a librarian, an analyst, and section writers (up to four at once). Each returns a compact result of about two thousand tokens to the main agent.SUB-AGENTS · DEPTH 1PROMPTCACHEDREQUESTskill index · 53 skillsSELECTMAIN AGENTplans from skillsSKILL BODYselected, one per turnRESEARCHER ×4web · one per topicLIBRARIANproject documentsANALYSTmetrics · chartsSECTION WRITER ×4drafts one sectionRESULTcompact · ≈2k tokensResearchers: one per topic, ≤4at once. Second research roundonly under 70% of the budget.
  1. 01 Cached prompt

    Tools, the system prompt, project memory and the index of 53 skills sit in the cached part of the prompt, which takes up to 4 cache points; the request goes after it.
  2. 02 Select and dispatch

    The main model selects skills from the index (at most 2; one runs, the other is offered as a follow-up). The selected skill's body travels with each sub-agent's task.
  3. 03 Fan out

    Each sub-agent runs its own tool loop with its own tools and model role, at depth 1. Researchers take one topic each, up to 4 at once; section writers draft up to 4 sections at once.
  4. 04 Return

    A researcher, librarian or analyst returns a compact result of about 2k tokens, never its transcript. A section writer returns its drafted section.

When a model call fails

A retryable error is retried, then the call moves down a ladder of models across providers; the failure shown here is illustrative, the ladder is real.

Fig. 03 · Fallback ladder (failure illustrative)
Model fallback ladder and circuit breaker, with an illustrative failureThe main tier's ladder: Claude Sonnet 5.5, GPT-5.6 Terra, Claude Opus 5.5, GPT-5.6 Sol, Gemini 3.1 Pro, Gemini 3 Flash. In this illustrative pass the first model returns a retryable error, is retried twice, fails, and the call moves down one rung, where GPT-5.6 Terra answers. Separately, five consecutive failures open a provider's breaker for thirty seconds. There is no fallback once text has streamed.PROVIDER BREAKER · ACROSS CALLSCALLmain tierCLAUDE SONNET 5.5GPT-5.6 TERRACLAUDE OPUS 5.5GPT-5.6 SOLGEMINI 3.1 PROGEMINI 3 FLASHTRYRETRY 1RETRY 2OPEN30 s · tried lastabove band:tried last5 failures in a rowauth or no credit: out 300 sfailure:illustrativeNo fallback once text hasstreamed: the failure is reported.
  1. 01 The ladder

    Each tier has a fallback ladder across providers; this is the main tier's. Under the Balanced preset, models priced above 1.5× its output price are moved to the end.
  2. 02 Retryable error

    The first model returns a retryable error: a 5xx, an overload or a timeout. The failure in this pass is illustrative; the ladder is real.
  3. 03 Two retries

    The call is retried twice with backoff. Both fail, so it moves down a rung.
  4. 04 Next rung

    The next model answers. An auth or out-of-credit error would instead put that provider out for 300 s.
  5. 05 Breaker

    Across calls, 5 failures in a row open a provider's circuit breaker for 30 s and its models are tried last. Once text has streamed there is no fallback: the failure is reported.

Web text and reviewed writes

Web pages are reduced to quoted facts before anything reaches the main agent, and the agent's writes come back to the product manager to undo, accept or reject.

Fig. 04 · Quarantine and reviewed writes
Quarantine for web text, and how the agent's writes are reviewedThree web pages enter quarantine. A cheap model keeps short quoted facts from two of them and drops the third, which addresses an AI. Only the facts reach the researcher, and only its compact result reaches the main agent. The run's own edit lands as an undoable version; knock-on edits and memory changes become a proposed diff the PM accepts or rejects.QUARANTINECOMPACT RESULTPAGE AsearchresultPAGE BpagereadPAGE CaddressesAITRIAGEquotes onlyFACTSquoted, keptDROPPEDcounted onlyRESEARCHERcited findingsMAIN AGENTplans · writesOWN EDITlands · undoPROPOSALknock-on+ memoryPMaccepts orrejectsaccept: writtenreject: discarded
  1. 01 Web pages

    A researcher's searches and page reads come back as raw web text: at most 6 searches and 3 pages per topic. Raw text never reaches the main agent.
  2. 02 Quarantine

    A cheap model reduces each page to short facts with exact quotes, and a quote must appear in its page. An item that addresses an AI is dropped and counted, never summarised.
  3. 03 Compact result

    Only quoted facts reach the researcher, and only its compact, cited result reaches the main agent.
  4. 04 Writes

    The run's own edit lands as a version the PM can undo, after a check that asks first if it could show readers a source they can't open. Knock-on edits to other documents and memory changes are diffs the PM accepts or rejects.
Recorded run

One real run of the competitor-research skill, shown step by step as the assistant panel listed it.

3:37 · 6 topics · 136 sources · 80.3 credits

  1. 01Find what the project already knows
  2. 02Set the questions and competitors
  3. 03Research what the project doesn't know
  4. 04Compare and write the findings
  5. 05Check citations
  6. 06Send for review

What this doesn't cover

  • The repository is private, so there is no code to link to.
  • No cost saving is claimed for routing, caching or fallbacks, because none was measured.
  • One stored LLM-judged scorecard for the compare-competitors case scored 0.29, and other runs of the same case score differently, so quality there is weak and not yet stable.
  • The editor, the sync engine and the workers are Ajay Kannan Sekar’s work and are not described here.