1. Create a project
2. Add your API key
Create a file named.env in this directory:
.gitignore so your key and installed packages stay out of source control:
--env-file option to load .env. Cognitio can also use provider variables already set in your shell. To use another provider, change the key and model together; see models and prompts.
3. Write the agent
Createagent.mjs:
agent.mjs
modelselects the provider and model asprovider/model.instructionsdescribes the behavior you want to reuse across tasks.disallowedTools: ["*"]makes this a text-only first run.maxTurnslimits model turns within one task.run()returns the final answer and run metadata.shutdown()releases the shared local runtime when this script is finished.
4. Run it
5. Give it a useful next task
The rest of the guides use TypeScript where types help explain an API. You can run those examples with the TypeScript setup.