AgentLang is a very high-level, declarative, open-source programming language for solving complex tasks with the help of interacting AI agents. Agentlang makes it easy to enhance agents with tools, knowledge bases and chat prompts. Agents can also form complex graphs of inter-relationships that allows them to collaborate together in solving difficult problems.
While most AI programming frameworks limit themselves to LLM based text-generation tasks, AgentLang is designed as a complete tool for real-world application development. As a language, AgentLang is data-oriented and declarative, with an abstraction that is closer to natural languages than traditional programming languages. This makes AgentLang a much better fit for LLM-powered code generation. Users can rapidly build business application in AgentLang from high-level specifications - typically more than 10x faster than traditional programming languages.
The AgentLang language specification, its compiler and runtime are open source.
The code you build in AgentLang can be run anywhere using the open source compiler and runtime, thereby avoiding the vendor lock-in of other AI programming platforms.
AgentLang introduces a number of innovative concepts to programming:
- First-class AI Agents - interacting AI Agents is a built-in language concept - developers can choose from one of the built-in agent-types, or easily add their own agent-types.
- Graph-based Hierarchical Data Model - compose the high-level data model of an application as a hierarchical graph of business entities with relationships. Such entities and relationships are first-class constructs in AgentLang.
- Zero-trust Programming - tightly control operations on business entities through declarative access-control encoded directly in the model itself.
- Declarative Dataflow - express business logic as purely-declarative patterns of data.
- Resolvers - use a simple, but powerful mechanism to interface with external systems.
- Interceptors - extend the agentlang runtime with custom capabilities.
- Entity-graph-Database Mapping - take advantage of an abstract persistence layer for fully-automated storage of entity instances.
The following code snippet shows a simple agent that can interact with a human user:
(component :Chat)
{:Agentlang.Core/Agent
{:Name :example-agent
:Input :Chat/Session
:UserInstruction "You are an AI bot who tell jokes"}}
Save this code to a file named chat.al
and it's ready to be run as a highly-scalable service with auto-generated HTTP APIs for interacting with the agent. But before you can actually run it, you need to install AgentLang. The next section will help you with that.
- Java SE 21 or later
- Linux, Mac OSX or a Unix emulator in Windows
- Download and install the AgentLang CLI tool
- Set the
OPENAI_API_KEY
environment variable to a valid API key from OpenAI
Now you can run the chat-agent as,
agent /path/to/chat.al
Once the agent starts running, send it a message with an HTTP POST like,
curl --header "Content-Type: application/json" \
--request POST \
--data '{"Chat/Session": {"UserInstruction": "tell me a joke about AI agents"}}' \
http://localhost:8080/api/Chat/Session
If all goes well, the agent will reply with a joke about itself!
If you are excited about cutting-edge AI and programming language technology, please consider becoming a contributor to the Agentlang project.
There are two main ways you can contribute:
- Try out the language, report bugs and proposals in the project's issue tracker.
- Actively participate in the development of Agentlang and submit your patches as pull requests.
Copyright 2024 Fractl Inc.
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0