Create TIA Agent
This Skill helps you create a new TIA XMPP agent by copying and customizing the mistral-minimal example.
Instructions
When a user wants to create a new agent, follow these steps:
1. Understand Requirements
Ask the user:
- •Agent name: What should the agent be called? (lowercase, no spaces)
- •LLM provider: Which LLM API? (Mistral, Groq, Claude, OpenAI, Ollama, etc.)
- •Location: Where should the new agent directory be created? (default:
../my-agent) - •Server: Which XMPP server? (default:
tensegrity.it) - •Room: Which MUC room to join? (default:
general@conference.tensegrity.it)
2. Copy mistral-minimal Template
cp -r mistral-minimal /path/to/new-agent cd /path/to/new-agent
3. Update Configuration Files
package.json
- •Update
namefield to the agent name - •Verify dependencies (tia-agents, hyperdata-clients, dotenv)
.env
- •Copy
.env.exampleto.env - •Add the required API key (e.g.,
MISTRAL_API_KEY,GROQ_API_KEY, etc.) - •Optionally override XMPP settings
config/agents/*.ttl
- •Rename
mistral2.ttlto<agent-name>.ttl - •Update all occurrences of
mistral2to the new agent name - •Update
xmpp:service,xmpp:domainif using different server - •Update
agent:roomJidif joining different room - •Update
agent:nicknameto desired display name
mistral-example.js
- •Rename to
<agent-name>.jsor keep as-is - •Update
PROFILE_NAMEdefault to match your agent name - •Update package.json
mainandstartscript if renamed
4. Customize the Provider
If using a different LLM provider, edit mistral-provider.js:
For Groq:
import { Groq } from "hyperdata-clients";
export class GroqProvider extends BaseLLMProvider {
initializeClient(apiKey) {
return new Groq({ apiKey });
}
async completeChatRequest({ messages, maxTokens, temperature }) {
return await this.client.client.chat.completions.create({
model: this.model,
messages,
max_tokens: maxTokens,
temperature
});
}
extractResponseText(response) {
return response.choices[0]?.message?.content?.trim() || null;
}
}
For Claude:
import { Claude } from "hyperdata-clients";
export class ClaudeProvider extends BaseLLMProvider {
initializeClient(apiKey) {
return new Claude({ apiKey });
}
async completeChatRequest({ messages, maxTokens, temperature }) {
return await this.client.client.messages.create({
model: this.model,
messages,
max_tokens: maxTokens,
temperature
});
}
extractResponseText(response) {
return response.content[0]?.text?.trim() || null;
}
}
Update the import and class name in the main agent file accordingly.
5. Install and Run
npm install npm start
6. Verify Connection
The agent should:
- •Auto-register with the XMPP server (if no password in secrets.json)
- •Connect and join the specified room
- •Respond when mentioned by name
Test by sending a message in the room: @agent-name hello
Common Customizations
Change System Prompt
Edit the agent's .ttl file:
agent:aiProvider [ a agent:MistralProvider ; agent:model "mistral-small-latest" ; agent:systemPrompt "You are a helpful assistant specializing in..." ; agent:apiKeyEnv "MISTRAL_API_KEY" ] .
Enable Lingue Protocol Features
In the .ttl file:
agent:aiProvider [ a agent:MistralProvider ; agent:lingueEnabled true ; agent:lingueConfidenceMin 0.7 ; agent:ibisSummaryEnabled true ] .
Change Model
Update the model in the .ttl file:
agent:aiProvider [ a agent:MistralProvider ; agent:model "mistral-large-latest" ] .
Or for Groq:
agent:aiProvider [ a agent:GroqProvider ; agent:model "llama-3.3-70b-versatile" ] .
Add Multiple Rooms
Agents can only join one room via the profile, but you can:
- •Create multiple agent profiles (one per room)
- •Run the same agent code with different
AGENT_PROFILEenv vars
Custom Message Handling
Extend the provider's handle method or create a custom provider by extending BaseProvider.
File Structure Reference
my-agent/ ├── config/agents/ │ ├── my-agent.ttl # Agent profile │ ├── mistral-base.ttl # Base profile (keep or customize) │ └── secrets.json # Auto-generated XMPP passwords ├── my-provider.js # LLM provider implementation ├── my-agent.js # Main agent runner ├── package.json # Dependencies and scripts ├── .env # API keys and overrides ├── .env.example # Template └── README.md # Documentation
Troubleshooting
Agent won't connect
- •Check XMPP server settings in
.ttlfile - •Verify
NODE_TLS_REJECT_UNAUTHORIZED=0if using self-signed certs - •Check server is reachable:
telnet tensegrity.it 5222
API errors
- •Verify API key is correct in
.env - •Check API key environment variable name matches
agent:apiKeyEnvin profile - •Ensure API key has necessary permissions
Agent doesn't respond
- •Check the agent joined the room (look for presence in XMPP client)
- •Try mentioning the agent:
@agent-name hello - •Check logs for errors
Profile loading errors
- •Verify
.ttlsyntax (common issue: missing dots at end of statements) - •Check all prefixes are defined
- •Ensure agent resource identifier matches filename
Next Steps
After creating your agent:
- •Customize behavior: Edit system prompts and model parameters
- •Add features: Implement custom handlers in the provider
- •Deploy: Run on a server with
pm2or systemd - •Monitor: Watch logs and chat activity
- •Iterate: Adjust prompts and settings based on behavior
Additional Resources
Examples
See mistral-minimal/README.md for the complete reference implementation.