How holmeswww/agentkit works
Project Type and Purpose
• AgentKit is an open-source Python framework (a library + CLI) for constructing LLM-based “agents” as directed acyclic graphs (DAGs) of nodes.
• It is not a web service or monolith; it is a packaged library (src/agentkit), with example clients under examples/, documentation under docs/, and LLM-API adapters for OpenAI, Anthropic, Ollama, etc.
File-Structure Analysis
• Top-level directories:
• src/agentkit: core library
• examples/: sample applications (crafter, prompt-without-coding CLI)
• docs/: Sphinx documentation
• setup.py, requirements.txt: packaging/config
• Core modules in src/agentkit:
• graph.py → Graph class (DAG orchestrator)
• base_node.py, node.py, node_functions.py → Node definitions
• compose_prompt.py → Pre-processing (Compose)
• after_query.py → Post-processing (After-Query)
• llm_api/ → Adapter layer for multiple LLM providers
• utils.py, exceptions.py → supporting utilities
README Insights
• Architecture: each BaseNode runs three phases—Compose → LLM query → AfterQuery—and nodes are linked by graph.add_edge to form a DAG.
• Dynamic graph modification: nodes/edges can be added/removed at runtime based on LLM output.
• Usage: Graph.evaluate() triggers ordered evaluation, tracks token usage per node.