How do I run a preset from my own code?
September 19, 2026 · 3 min read
Every preset you can run in the app can also run from your own code. The Agent Sessions API starts a NOLGIA Agent session under a preset, so the agent works with that preset's guardrails and output on every turn, exactly as it does in the chat.
This guide uses the Static ad formats preset, which makes static ads for paid social from your product photos and your own words. Swap the preset slug to run any other public preset.

What you need
Product photos
RequiredOne to three clear photos of the product. It appears exactly as shown.
What is the product?
RequiredName it, what it is made of and roughly how big it is.
Which ad format?
RequiredPick the layout. Each one is a proven direct to consumer ad format.
The words on the ad
RequiredHeadline first, then up to three short lines, exactly as they should read. Only things that are true: we never invent claims, prices, ratings or reviews.
Brand colors or mood
OptionalColor names or codes, or a feeling in a few words. You can skip this.
Your logo
OptionalShown exactly as it is. You can skip this.
Where will it run?
OptionalThe shape of the ad.
How many versions?
OptionalEach version is the same format with its own take on the layout.
Step by step
Create a Personal Access Token
Create a token in Settings, API tokens, and send it as
Authorization: Bearer <token>on every request. The base URL ishttps://api.nolgia.ai/v1.Upload the product photos
Send small images to
POST /assetsas base64, or usePOST /assets/uploadsand its signed upload URL for larger files. Keep the asset ids.Start a session under the preset with the brief
Call
POST /agent/messageswithnew_session: { "preset_slug": "dtc-ad-formats" }, the brief incontent(the product, the ad format and the exact words on the ad) and the photos inattachments. The accepted response carriessession_idandagent_message_id.Wait for the reply
Poll
GET /agent/messages/{id}with backoff until the reply leavespending, or streamGET /agent/sessions/{id}/eventsfor a live transcript.Answer the agent's questions
When the session's
turn_statusisawaiting_input, readquestion.textandquestion.optionsand reply with a normal message in the same session.Collect the ads
GET /agent/sessions/{id}/assetsreturns what the session made, newest first. To stop a turn, callPOST /agent/sessions/{id}/interrupt.
What it costs
- The preset's estimate
- 8 credits per ad, 32 for four versions, 21 each at 2K
- Time
- under 2 min
GPT Image 2.5 Flare
Every planPer image
Native 8 credits · 2K 21 credits · 4K 58 credits
New accounts start with 350 free credits.
See every rate on the pricing pageChecklist
- A Personal Access Token stored as a secret, never in client code.
- Product photos uploaded and ready before the first message.
- A brief that names the product, the ad format and the exact words.
- A handler for
awaiting_inputquestions. - An overall timeout in your code. A polling timeout does not stop the turn; interrupt does.
FAQ
Questions and answers.
- Is there an SDK helper?
- Yes. The TypeScript, Python and Go SDKs include helpers that send a message and wait for the reply with backoff: runAgent, nolgia.agent_run.run and RunAgent.
- Can I run any preset this way?
- Any public preset. The session must name an existing public preset slug, and the API refuses one it does not know.
- Do I need a particular plan?
- The Agent Sessions API talks to your hosted NOLGIA Agent, which comes with Studio plans. Generations and agent turns spend credits from your account.
- Which models does Static ad formats use?
- Static ad formats runs on GPT Image 2.5 Flare. The agent picks the model; you do not pass one.
- Where is the full reference?
- The Agent Sessions API guide and the API reference live at docs.nolgia.ai.

