Fundamentals

  • generateText: Basic async text generation with model and prompt
  • Unified interface: Switch models (GPT-4o, Perplexity, Gemini) by changing one line
  • Tool calling: Define tools with name, description, parameters, and execute function; model decides when to call them
  • maxSteps: Enables multi-step agent loops — model calls tools, gets results, continues until text output or max steps

Structured Output

  • generateObject: Returns typed objects using Zod schemas
  • Zod's describe function adds detailed instructions per field

Deep Research Clone (218 lines)

  1. Generate sub-queries from the main topic
  2. Web search each query using Exa API
  3. Evaluate results (relevant/irrelevant) with tool-calling agent
  4. Extract learnings and follow-up questions
  5. Recurse with depth/breadth parameters, accumulating research state
  6. Generate final report in markdown using all accumulated data

Key architecture: recursive deepResearch function with accumulated state, duplicate source prevention, and system prompt engineering for the final report.

Related writing

HarvestEngineering Leadership · AIEnglish

Why Agent-Era Skill Standardization Changes Everything

A walkthrough of Skills as org-wide AI infrastructure: four ecosystem shifts, how specialist stacks and orchestrators work, practical authoring rules (description, one-line gotcha, reasoning), agent-first design, three-tier ops, community repos—and why perfection, depth, and stamina still compound.

Mar 31, 2026Read more
HarvestEngineering Leadership · AIEnglish

AX Roadmap That Leads to Results: Connecting Individual Efficiency to Organizational Productivity

This webinar by Flex team's CCPO examines why 'using more AI doesn't automatically improve organizational outcomes' through structural analysis. Drawing from real experiments and failures in measurement, sequencing, and organizational adoption, it presents an AX design strategy focused on solving bottlenecks from the last mile - SSOT, evaluation environments, validation, and access control - concluding that changing bottlenecks, verification, decision-making, and collaboration structures matters more than increasing output volume.

Mar 28, 2026Read more
HarvestAI · Data & Decision-MakingEnglish

The Era When Agents 'Code' and Research Runs in 'Loops': Andrej Karpathy Conversation Summary

Andrej Karpathy says that with the recent leap in coding agents, the core task has shifted from writing code directly to 'conveying intent to agents.' He sees this extending to AutoResearch—autonomous research loops running experiment-learn-optimize cycles with minimal human involvement.

Mar 22, 2026Read more