Graph-like planning → context fetching → synthesis agent (library-style).
Project description
fetchgraph
Universal, library-style agent that plans what to fetch, fetches context from pluggable providers, and synthesizes an output.
Pipeline: PLAN → FETCH → (ASSESS/REFETCH)* → SYNTH → VERIFY → (REFINE)* → SAVE
Install (dev)
pip install -e .
Quick Start
from fetchgraph import (
BaseGraphAgent, ContextPacker, BaselineSpec, ContextFetchSpec,
TaskProfile, RawLLMOutput
)
from fetchgraph.core import make_llm_plan_generic, make_llm_synth_generic
# Define providers (implement ContextProvider protocol)
class SpecProvider:
name = "spec"
def fetch(self, feature_name, selectors=None, **kw): return {"content": f"Spec for {feature_name}"}
def serialize(self, obj): return obj.get("content", "") if isinstance(obj, dict) else str(obj)
def dummy_llm(prompt: str, sender: str) -> str:
if sender == "generic_plan":
return '{"required_context":["spec"],"context_plan":[{"provider":"spec","mode":"full"}]}'
if sender == "generic_synth":
return "result: ok"
return ""
profile = TaskProfile(
task_name="Demo",
goal="Produce YAML doc from spec",
output_format="YAML: result: <...>"
)
agent = BaseGraphAgent(
llm_plan=make_llm_plan_generic(dummy_llm, profile, {"spec": SpecProvider()}),
llm_synth=make_llm_synth_generic(dummy_llm, profile),
domain_parser=lambda raw: raw.text, # RawLLMOutput -> Any
saver=lambda feature_name, parsed: None, # save side-effect
providers={"spec": SpecProvider()},
verifiers=[type("Ok",(),{"name":"ok","check":lambda self,out: []})()],
packer=ContextPacker(max_tokens=2000, summarizer_llm=lambda t: t[:200]),
baseline=[BaselineSpec(ContextFetchSpec(provider="spec"))],
)
print(agent.run("FeatureX"))
LICENSE
MIT License
Copyright (c) 2025 ...
Permission is hereby granted, free of charge, to any person obtaining a copy
...
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fetchgraph-0.0.1.tar.gz
(9.1 kB
view details)
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 fetchgraph-0.0.1.tar.gz.
File metadata
- Download URL: fetchgraph-0.0.1.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7dc9e044a1b374b4788437951c1c08854a362e0f85feeae16d768379af17a6d
|
|
| MD5 |
764a2894913d92d35e2a5f279259c712
|
|
| BLAKE2b-256 |
5790322f62016b27f38ef87bfd47dce914ec0b03e9a3cc5bfa9f65c56e8be149
|
File details
Details for the file fetchgraph-0.0.1-py3-none-any.whl.
File metadata
- Download URL: fetchgraph-0.0.1-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6f2c1866e67532380ad89fbb8f284a7106f5000c9c59db7e733c07eb5cb83f8
|
|
| MD5 |
b1b6405becb65b40173713b8093e1e0a
|
|
| BLAKE2b-256 |
ed5ab4ccb9836fb385dff75e77f05cd3358987d7294dde94ff773b261d489a78
|