Namespaces

Learn how AgentML's namespace system extends functionality through modular plugins.

Unified Schema and Namespace Loading

AgentML uses a unified mechanism for extending functionality or loading external specifications, all through the xmlns:* attribute pattern.

How It Works

Loading Code Namespaces

If xmlns:xyz="github.com/...", the runtime interprets this as loading a namespace implementation (a code plugin) for new XML elements.

xmlns:gemini="github.com/agentflare-ai/agentml-go/gemini"

This loads the Gemini namespace, enabling <gemini:generate> tags in the agent.

Loading External Schemas

If xmlns:xyz="./path/to/spec.json" or any path/URL that isn't recognized as a code namespace, the runtime will treat it as loading an external JSON Schema or OpenAPI spec.

xmlns:events="./schemas/events.json"

This allows you to pull in complex schema definitions from separate files to validate events.

Built-in Namespaces

Gemini

Integrates Google's Gemini LLM for text generation and event creation.

github.com/agentflare-ai/agentml-go/gemini

Memory

Provides key-value storage, vector similarity search, and graph database capabilities.

github.com/agentflare-ai/agentml-go/memory

Ollama

Interfaces with Ollama for running local LLM models on your hardware.

github.com/agentflare-ai/agentml-go/ollama

StdIn/StdOut

Simple namespace for console I/O, useful for testing and demos.

github.com/agentflare-ai/agentml-go/stdin

Schema Reuse via JSON Pointers

A major benefit of this approach is that you can keep your event schemas in separate JSON/YAML files and reference them in your AgentML document.

xmlns:events="./schemas/events.json"

event:schema="events:#/components/schemas/FlightRequest"

The prefix before :# (here events:) corresponds to the alias in the xmlns: attribute. This keeps your .aml file much cleaner and promotes reuse and consistency.

Next Steps

Explore the event-driven LLM integration pattern and how to structure prompts effectively.

Event-Driven LLM →