Skip to main content

Defining Agents

Agents are defined using the Arc Agent DSL.

Example

agent {
name = "weather"
description = "Agent that provides weather data."
model { "gemma:7b" }
prompt { """
You are a professional weather service.
You have access to real-time weather data with the get_weather function.
Keep your answer short and concise.
All you require is the location.
if you cannot help the user, simply reply "I cant help you"
"""
}
tools {
+"get_weather"
}
}

Overview

NameDescription
nameThe name of the Agent. This should be a unique identifier. Preferably without special characters.
modelThe model that should be provided to the Agent.
descriptionA short description of what the Agent does.
promptThe System Prompt of the Agent. The prompt defines the core objective, goals and instructions for Agents.
toolsA list of tools/functions that the Agent uses, see.
filterInputDefines filter logic, see.
filterOutputDefines filter logic, see.
limitDefines a rate limiter, see.

See the following pages on how to load the agents into your application.

Prompt templating

The prompt function of an Agent is called on each request. Meaning that it can be dynamically customized to best suit the current context. Now although Kotlin Strings are quite powerful, adding logical constructs such as if and for loops statements can be cumbersome.

For this purpose, the Arc DSL overwrites the UnaryPlus operator, +, within the prompt block to allow for simple string concatenation.

For example, the following code snippet shows how to use the + operator to build a dynamic prompt.

agent {
prompt {
+"Here is the first part og the prompt."
if(someCondition) {
+"Here is a conditional part of the prompt."
}
"The last part of the prompt (this does not require a + because it is automatically returned)."
}
}