hdresearch / nolita

Work with web-enabled agents quickly — whether running a quick task or bootstrapping a full-stack product.
https://nolita.ai
MIT License
79 stars 3 forks source link

agent, browser: nolitarc integration #89

Closed matildepark closed 3 weeks ago

matildepark commented 4 weeks ago

.nolitarc stores user config across npx nolita sessions and includes npx nolita auth details as well, meaning if you use either, you invariably have:

{
  "hdrApiKey": "...",
  "agentModel": "...",
  "agentProvider": "..."
  "agentApiKey": "..."
}

Already set. This is only available in the task runner, though.

This PR integrates that across Nolita, and makes all parameters therefore optional. If no parameters are provided and the nolitarc check fails, we throw during any constructor call.

The ideal case I'm trying to facilitate here is that if you've run npx nolita and npx nolita auth, then in any Nolita project on a machine, you can just run:

const agent = makeAgent();
const browser = Browser.launch(false, agent);
const page = browser.newPage();
...

Without ever having to think about keys or declaring process.env variables.