Skip to content

Running the Agent

Requirements

You can choose between the following model backends for running your agents:

See here for instructions on switching between backends

Note: We're working on adding support for more models and providers in the future. If you have a specific model or provider you'd like to see supported, please let us know by creating an issue in our GitHub repository.

Your first agent template

Create a file named hello.mgx:

---
description: Hello world agent template
---

<<
# Hello World

Tell the user Hello, and welcome them to Margarita!
>>

@effect run

Run it with:

margarita run hello.mgx

The << >> block loads markdown content into the agent's context. @effect run tells the agent to execute with the current context.

Specify the model

Add a model field to the template metadata:

---
model: "gpt-4"
---

<< test >>

@effect run

Naming the Runs

If you supply a parameter after @effect run, that parameter will be used as the name of the run.

---
description: Hello world agent template
---

<<
# Hello World

Tell the user Hello, and welcome them to Margarita!
>>

@effect run Hello World