Make your Custom Plugins and Agent Instructions more dynamic and personal by using System Variables in TeamAI. These variables automatically insert information like the current date or details about the person using the AI, right into your configurations.
System Variables in Custom Plugins (Tools)
When you build Custom Plugins (the tools your AI can use, like calling an external service), you can use system variables in URLs, headers, or other settings. This helps your plugins adapt to the current situation.
Available System Variables for Custom Plugins:
{{DATE}}
: Inserts the current date (e.g.,2024-07-30
).
{{user.id}}
: Inserts the ID of the person currently interacting with the AI.
{{user.name}}
: Inserts the name of the current user (if available).
{{user.email}}
: Inserts the email of the current user (if available).
{{user}}
: Inserts a complete package of user information as a JSON text string (e.g.,{"id":"user123","name":"Alex","email":"[email protected]"})
. This is handy if the tool needs to send all user details at once.
Example Uses in Custom Plugins:
Logging Plugin Usage with User Context:
Imagine a plugin that calls an external data service. You might want to log who used the plugin and when.
API URL: https://dataservice.example.com/query?data_id=123
You could add details to a logging endpoint or a note field within the request:
POST
to https://mylogging.api/usage_logs
Request Body:
{
"plugin_name": "ExternalDataServicePlugin",
"accessed_by_teamai_user_id": "{{user.id}}",
"accessed_by_teamai_user_email": "{{user.email}}",
"access_date": "{{DATE}}",
"details": "User queried data_id 123"
}
This way, you can track plugin interactions tied back to the specific TeamAI user.
Contextual Data Submission to a User-Aware Endpoint:
If your plugin submits data to an analytics platform or a CRM where you want to associate the activity with the TeamAI user who performed the action:
Request Body:
{
"event_name": "PluginUsed_MyCustomTool",
"timestamp": "{{DATE}}",
"user_context": { // Sending the whole {{user}} object
"teamai_user_profile": {{user}}
},
"event_details": {
"param1": "value1"
}
}
An example usage in the platform would look like:
β
The key is that {{user.id}}
, {{user.name}}
, and {{user.email}}
provide the TeamAI context of the user.