Agent framework with learning capabilities
Project description
llm-gent
Agent framework with trait-based architecture and learning capabilities.
Overview
llm-gent provides a composable framework for building LLM-powered agents. Agents are composed of traits that provide specific capabilities (LLM access, storage, learning, etc.) and can be run standalone or as services via the included HTTP runtime.
Key features:
- Trait-based composition - Mix and match capabilities via traits (LLM, Storage, Rating, Learn)
- Multi-backend LLM support - OpenAI-compatible, Anthropic, and custom backends via llm-infer
- Built-in learning - Collect training data (SFT/DPO) and fine-tune via llm-kelt
- Structured output - Pydantic schema validation with automatic JSON cleanup for small models
- Production ready - HTTP server, PostgreSQL storage, schema migrations
Installation
pip install llm-gent
For HTTP server support:
pip install llm-gent[http]
Quick Start
from appinfra import DotDict
from appinfra.log import LogConfig, LoggerFactory
from llm_gent import Agent, Config, Identity, LLMTrait, DirectiveTrait
# Setup logging
log_config = LogConfig.from_params(level="info", handlers={"console": {"type": "console"}})
lg = LoggerFactory.create_root(log_config)
# Configure LLM backend
llm_config = DotDict({
"default": "local",
"backends": {
"local": {
"type": "openai_compatible",
"base_url": "http://localhost:8000/v1",
"model": "default",
}
},
})
# Create agent with traits
identity = Identity(domain=None, workspace="demo", name="my-agent")
config = Config(identity=identity)
agent = Agent(lg, config)
# Add capabilities via traits
agent.add_trait(DirectiveTrait(agent, directive="You are a helpful assistant."))
agent.add_trait(LLMTrait(agent, llm_config))
# Start and use agent
agent.start()
llm = agent.require_trait(LLMTrait)
result = llm.complete([{"role": "user", "content": "Hello!"}])
print(result.content)
agent.stop()
Core Concepts
Agents
An Agent is a container for traits with lifecycle management. Agents have an identity
(domain/workspace/name) and can be started, stopped, and run in cycles.
Traits
Traits provide specific capabilities to agents:
| Trait | Purpose |
|---|---|
LLMTrait |
LLM completions with multi-backend routing |
DirectiveTrait |
System prompts and agent instructions |
StorageTrait |
PostgreSQL persistence with migrations |
RatingTrait |
Automated LLM-based content evaluation |
LearnTrait |
Training data collection (SFT/DPO) |
ToolsTrait |
Tool/function calling support |
Tools
Built-in tools for agentic workflows:
ShellTool- Execute shell commandsFileReadTool/FileWriteTool- File operationsHTTPFetchTool- HTTP requestsRecallTool/RememberTool- Memory operations
Running as a Service
# Start agent server
llm-gent serve
# Or with specific config
llm-gent -c etc/llm-gent.yaml serve
Related Projects
- llm-infer - LLM inference server and client
- llm-kelt - Training infrastructure (SFT/DPO)
- appinfra - Application infrastructure utilities
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_gent-0.2.0.tar.gz.
File metadata
- Download URL: llm_gent-0.2.0.tar.gz
- Upload date:
- Size: 236.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83659866bb9de706f10fb77627fe171c3ab63543f6a2f096469faef492f81daa
|
|
| MD5 |
bc20cd3535689ec7b4106fe4ffb9c3c5
|
|
| BLAKE2b-256 |
3cc7fafcc335ffcacdbbf85ffdaaa092cecad66a542bdc6ed3d4115549e99fb4
|
Provenance
The following attestation bundles were made for llm_gent-0.2.0.tar.gz:
Publisher:
release.yml on llm-works/llm-gent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_gent-0.2.0.tar.gz -
Subject digest:
83659866bb9de706f10fb77627fe171c3ab63543f6a2f096469faef492f81daa - Sigstore transparency entry: 1109248371
- Sigstore integration time:
-
Permalink:
llm-works/llm-gent@3d910d5d056e79168d11ca065c4bece56b278f94 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/llm-works
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3d910d5d056e79168d11ca065c4bece56b278f94 -
Trigger Event:
push
-
Statement type:
File details
Details for the file llm_gent-0.2.0-py3-none-any.whl.
File metadata
- Download URL: llm_gent-0.2.0-py3-none-any.whl
- Upload date:
- Size: 229.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3d6c655182f2160d4e8388ce2779dddb45e7311d8d90f86ce94114717009c17
|
|
| MD5 |
9f13878bebf8547dda0e961debce632e
|
|
| BLAKE2b-256 |
3e2705f6e0b0333ffb794a5fbc8625b7c3c08c662a17938ccb32670845b9507f
|
Provenance
The following attestation bundles were made for llm_gent-0.2.0-py3-none-any.whl:
Publisher:
release.yml on llm-works/llm-gent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
llm_gent-0.2.0-py3-none-any.whl -
Subject digest:
c3d6c655182f2160d4e8388ce2779dddb45e7311d8d90f86ce94114717009c17 - Sigstore transparency entry: 1109248372
- Sigstore integration time:
-
Permalink:
llm-works/llm-gent@3d910d5d056e79168d11ca065c4bece56b278f94 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/llm-works
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3d910d5d056e79168d11ca065c4bece56b278f94 -
Trigger Event:
push
-
Statement type: