contextforge-eval 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- contextforge_eval-0.1.0/LICENSE +201 -0
- contextforge_eval-0.1.0/PKG-INFO +420 -0
- contextforge_eval-0.1.0/README.md +376 -0
- contextforge_eval-0.1.0/context_forge/__init__.py +95 -0
- contextforge_eval-0.1.0/context_forge/core/__init__.py +55 -0
- contextforge_eval-0.1.0/context_forge/core/trace.py +369 -0
- contextforge_eval-0.1.0/context_forge/core/types.py +121 -0
- contextforge_eval-0.1.0/context_forge/evaluation.py +267 -0
- contextforge_eval-0.1.0/context_forge/exceptions.py +56 -0
- contextforge_eval-0.1.0/context_forge/graders/__init__.py +44 -0
- contextforge_eval-0.1.0/context_forge/graders/base.py +264 -0
- contextforge_eval-0.1.0/context_forge/graders/deterministic/__init__.py +11 -0
- contextforge_eval-0.1.0/context_forge/graders/deterministic/memory_corruption.py +130 -0
- contextforge_eval-0.1.0/context_forge/graders/hybrid.py +190 -0
- contextforge_eval-0.1.0/context_forge/graders/judges/__init__.py +11 -0
- contextforge_eval-0.1.0/context_forge/graders/judges/backends/__init__.py +9 -0
- contextforge_eval-0.1.0/context_forge/graders/judges/backends/ollama.py +173 -0
- contextforge_eval-0.1.0/context_forge/graders/judges/base.py +158 -0
- contextforge_eval-0.1.0/context_forge/graders/judges/memory_hygiene_judge.py +332 -0
- contextforge_eval-0.1.0/context_forge/graders/judges/models.py +113 -0
- contextforge_eval-0.1.0/context_forge/harness/__init__.py +43 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/__init__.py +70 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/adapters/__init__.py +13 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/adapters/base.py +67 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/adapters/crewai.py +100 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/adapters/langgraph.py +157 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/adapters/pydanticai.py +105 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/llm/__init__.py +5 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/llm/ollama.py +119 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/models.py +103 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/persona.py +154 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/runner.py +342 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/scenario.py +95 -0
- contextforge_eval-0.1.0/context_forge/harness/user_simulator/simulator.py +307 -0
- contextforge_eval-0.1.0/context_forge/instrumentation/__init__.py +23 -0
- contextforge_eval-0.1.0/context_forge/instrumentation/base.py +307 -0
- contextforge_eval-0.1.0/context_forge/instrumentation/instrumentors/__init__.py +17 -0
- contextforge_eval-0.1.0/context_forge/instrumentation/instrumentors/langchain.py +671 -0
- contextforge_eval-0.1.0/context_forge/instrumentation/instrumentors/langgraph.py +534 -0
- contextforge_eval-0.1.0/context_forge/instrumentation/tracer.py +588 -0
- contextforge_eval-0.1.0/context_forge/py.typed +0 -0
- contextforge_eval-0.1.0/contextforge_eval.egg-info/PKG-INFO +420 -0
- contextforge_eval-0.1.0/contextforge_eval.egg-info/SOURCES.txt +46 -0
- contextforge_eval-0.1.0/contextforge_eval.egg-info/dependency_links.txt +1 -0
- contextforge_eval-0.1.0/contextforge_eval.egg-info/requires.txt +27 -0
- contextforge_eval-0.1.0/contextforge_eval.egg-info/top_level.txt +1 -0
- contextforge_eval-0.1.0/pyproject.toml +92 -0
- contextforge_eval-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: contextforge-eval
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Evaluation framework for context-aware, agentic AI systems
|
|
5
|
+
Author-email: Reelfy <garry@reelfy.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/reelfy/context-forge
|
|
8
|
+
Project-URL: Documentation, https://reelfy.github.io/context-forge
|
|
9
|
+
Project-URL: Repository, https://github.com/reelfy/context-forge
|
|
10
|
+
Keywords: evaluation,agents,llm,langchain,langgraph,testing,trajectory,context-engineering,memory,graders
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: pydantic>=2.0.0
|
|
23
|
+
Requires-Dist: langchain-core>=1.0.0
|
|
24
|
+
Requires-Dist: httpx>=0.27.0
|
|
25
|
+
Requires-Dist: ollama>=0.6.0
|
|
26
|
+
Provides-Extra: langgraph
|
|
27
|
+
Requires-Dist: langgraph>=1.0.0; extra == "langgraph"
|
|
28
|
+
Provides-Extra: crewai
|
|
29
|
+
Requires-Dist: crewai>=0.80.0; extra == "crewai"
|
|
30
|
+
Provides-Extra: pydanticai
|
|
31
|
+
Requires-Dist: pydantic-ai>=0.0.30; extra == "pydanticai"
|
|
32
|
+
Provides-Extra: all
|
|
33
|
+
Requires-Dist: context-forge[crewai,langgraph,pydanticai]; extra == "all"
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
38
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
39
|
+
Provides-Extra: docs
|
|
40
|
+
Requires-Dist: mkdocs>=1.6.0; extra == "docs"
|
|
41
|
+
Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
|
|
42
|
+
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
|
|
43
|
+
Dynamic: license-file
|
|
44
|
+
|
|
45
|
+
# ContextForge
|
|
46
|
+
|
|
47
|
+
**Open-source evaluation framework for context-aware, agentic AI systems**
|
|
48
|
+
|
|
49
|
+
ContextForge is an open-source framework for evaluating **agent behavior and context engineering** in modern AI systems.
|
|
50
|
+
|
|
51
|
+
> We don't just evaluate outputs.
|
|
52
|
+
> We evaluate **how context is built, used, and evolves across agent trajectories**.
|
|
53
|
+
|
|
54
|
+
ContextForge is designed to be:
|
|
55
|
+
- **Framework-agnostic** — works with LangChain, CrewAI, AutoGen, or custom agents
|
|
56
|
+
- **Local-first** — run evaluations on your machine with local LLM judges (Ollama)
|
|
57
|
+
- **CI-safe** — deterministic replay for reliable regression testing
|
|
58
|
+
- **Extensible** — add custom graders, rubrics, and domain-specific evaluation packs
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Key Concepts
|
|
63
|
+
|
|
64
|
+
Before diving in, here are the core ideas behind ContextForge:
|
|
65
|
+
|
|
66
|
+
### Trajectory
|
|
67
|
+
A **trajectory** is the complete sequence of events during an agent run: every LLM call, tool invocation, memory read/write, retrieval step, and state change. Unlike single-turn evaluation, trajectory evaluation captures *how* an agent arrives at its answer — not just *what* it outputs.
|
|
68
|
+
|
|
69
|
+
### Context Engineering
|
|
70
|
+
**Context engineering** is the practice of designing how information flows into and through an agent. It consists of [six interconnected pillars](https://weaviate.io/blog/context-engineering):
|
|
71
|
+
|
|
72
|
+
| Pillar | What It Does | What Can Go Wrong |
|
|
73
|
+
|--------|--------------|-------------------|
|
|
74
|
+
| **Agents** | Orchestrate decisions and task execution | Poor planning, stuck in loops, wrong tool selection |
|
|
75
|
+
| **Query Augmentation** | Refine user input for downstream tasks | Queries that miss intent, over-broad or too narrow |
|
|
76
|
+
| **Retrieval** | Surface relevant information (RAG) | Wrong chunks, irrelevant results, missing context |
|
|
77
|
+
| **Prompting** | Guide how the model uses context | Hallucination, ignoring retrieved data, format errors |
|
|
78
|
+
| **Memory** | Preserve context across interactions | Stale data resurfacing, memory bloat, lost history |
|
|
79
|
+
| **Tools** | Enable real-world actions | Incorrect args, unnecessary calls, missing error handling |
|
|
80
|
+
|
|
81
|
+
ContextForge's graders are designed to evaluate each of these pillars — detecting when agents make poor decisions, when retrieval returns irrelevant results, when memory becomes polluted, or when tools are misused.
|
|
82
|
+
|
|
83
|
+
### Graders
|
|
84
|
+
**Graders** are the evaluation components that analyze traces and produce scores, pass/fail verdicts, and evidence. Each grader targets specific context engineering pillars:
|
|
85
|
+
|
|
86
|
+
| Grader | Type | Status | Pillars Evaluated |
|
|
87
|
+
|--------|------|--------|-------------------|
|
|
88
|
+
| *MemoryCorruptionGrader* | Deterministic | ✅ Available | Memory — detect data loss and corruption |
|
|
89
|
+
| *MemoryHygieneJudge* | LLM-as-judge | ✅ Available | Memory — detect missed facts, hallucinations |
|
|
90
|
+
| *HybridMemoryHygieneGrader* | Hybrid | ✅ Available | Memory — combines deterministic + LLM evaluation |
|
|
91
|
+
| *BudgetGrader* | Deterministic | 🔜 Coming Soon | Agents, Tools — enforce token/tool/time limits |
|
|
92
|
+
| *LoopGrader* | Deterministic | 🔜 Coming Soon | Agents — detect repeated actions or state cycles |
|
|
93
|
+
| *SchemaGrader* | Deterministic | 🔜 Coming Soon | Tools, Prompting — validate tool args and output format |
|
|
94
|
+
| *RetrievalRelevanceGrader* | Deterministic | 🔜 Coming Soon | Retrieval — measure if retrieved chunks were actually used |
|
|
95
|
+
| *ContextWindowGrader* | Deterministic | 🔜 Coming Soon | Retrieval, Memory — detect bloated or irrelevant context |
|
|
96
|
+
| *TrajectoryJudge* | LLM-as-judge | 🔜 Coming Soon | All pillars — qualitative assessment of reasoning and planning |
|
|
97
|
+
|
|
98
|
+
**Deterministic graders** provide fast, reproducible checks with predictable outcomes.
|
|
99
|
+
**LLM-as-judge graders** use a local LLM (Ollama-first) for qualitative evaluation that's harder to express as rules.
|
|
100
|
+
|
|
101
|
+
Graders are **composable** — combine them into evaluation suites that match your quality bar.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Why ContextForge Exists
|
|
106
|
+
|
|
107
|
+
Most AI evaluation tools were built for:
|
|
108
|
+
- single-turn prompts
|
|
109
|
+
- static RAG pipelines
|
|
110
|
+
- isolated model outputs
|
|
111
|
+
|
|
112
|
+
But **agentic systems fail in different ways**:
|
|
113
|
+
- bloated or polluted context windows
|
|
114
|
+
- irrelevant memory resurfacing
|
|
115
|
+
- poor query augmentation
|
|
116
|
+
- unnecessary or incorrect tool usage
|
|
117
|
+
- contradictory context fragments
|
|
118
|
+
- silent degradation across multi-step reasoning
|
|
119
|
+
|
|
120
|
+
These are *context and system failures*, not just model failures.
|
|
121
|
+
|
|
122
|
+
ContextForge exists to make those failures **observable, testable, and comparable**.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Example: Catching Memory Issues
|
|
127
|
+
|
|
128
|
+
Your home energy advisor agent helps users optimize EV charging. A user mentions they now work from home, but the agent gives advice based on their old commute schedule. Why?
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
# ContextForge evaluation output (available now)
|
|
132
|
+
|
|
133
|
+
HybridMemoryHygieneGrader: FAIL
|
|
134
|
+
Evidence:
|
|
135
|
+
[ERROR] missed_fact
|
|
136
|
+
User stated "I work from home now" but this was not saved to memory
|
|
137
|
+
[INFO] llm_summary
|
|
138
|
+
Agent read stale work_schedule="Office 9-5" but user indicated WFH
|
|
139
|
+
|
|
140
|
+
Result: [FAIL] FAILED
|
|
141
|
+
Score: 0.00 / 1.00
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Without trajectory evaluation, you'd only see "agent responded" — missing that it used stale context entirely.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Example: Catching a Loop (Coming Soon)
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
# Planned ContextForge output (LoopGrader + BudgetGrader)
|
|
152
|
+
|
|
153
|
+
LoopGrader: FAIL
|
|
154
|
+
- Agent called `check_order_status` 6 times with identical arguments
|
|
155
|
+
- Steps 4, 7, 12, 15, 19, 23 are duplicates
|
|
156
|
+
|
|
157
|
+
BudgetGrader: FAIL
|
|
158
|
+
- Token usage: 8,432 (limit: 5,000)
|
|
159
|
+
- Tool calls: 14 (limit: 10)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
These graders are on our roadmap and coming soon.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## What You'll Learn
|
|
167
|
+
|
|
168
|
+
After running ContextForge on your agent, you'll be able to answer:
|
|
169
|
+
|
|
170
|
+
- **Efficiency**: Is my agent wasting tokens or making redundant tool calls?
|
|
171
|
+
- **Correctness**: Are tool arguments valid? Is the output schema correct?
|
|
172
|
+
- **Context quality**: Is retrieved information actually being used? Is memory being managed well?
|
|
173
|
+
- **Reliability**: Does my agent behave consistently across runs?
|
|
174
|
+
- **Regression safety**: Did my last change break something that used to work?
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## What Makes ContextForge Different
|
|
179
|
+
|
|
180
|
+
| Capability | Status |
|
|
181
|
+
|----------|--------|
|
|
182
|
+
| Trajectory-based evaluation | ✅ Available |
|
|
183
|
+
| Memory hygiene detection | ✅ Available |
|
|
184
|
+
| Local LLM judges (Ollama) | ✅ Available |
|
|
185
|
+
| Framework-agnostic graders | ✅ Available |
|
|
186
|
+
| LangGraph instrumentation | ✅ Available |
|
|
187
|
+
| Tool orchestration evals | 🔜 Coming Soon |
|
|
188
|
+
| Budget/Loop detection | 🔜 Coming Soon |
|
|
189
|
+
| Deterministic replay (CI) | 🔜 Coming Soon |
|
|
190
|
+
| YAML evaluation config | 🔜 Coming Soon |
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Framework-Agnostic by Design
|
|
195
|
+
|
|
196
|
+
ContextForge separates concerns explicitly:
|
|
197
|
+
|
|
198
|
+
- **Adapters** translate framework-specific events into traces
|
|
199
|
+
- **Traces** are the stable, canonical contract
|
|
200
|
+
- **Graders** operate only on traces — never on framework objects
|
|
201
|
+
|
|
202
|
+
This means:
|
|
203
|
+
- LangGraph, LangChain, AutoGen, CrewAI, smolagents, or custom agents can all use the same graders
|
|
204
|
+
- New frameworks can integrate without changing grader logic
|
|
205
|
+
- Evaluations remain stable even as runtimes evolve
|
|
206
|
+
|
|
207
|
+
If your system can emit events, ContextForge can evaluate it.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Integration Levels
|
|
212
|
+
|
|
213
|
+
ContextForge offers multiple ways to capture agent behavior, from zero-code to explicit control.
|
|
214
|
+
|
|
215
|
+
### Level 1: Zero-Code (via OpenTelemetry) — 🔜 Coming Soon
|
|
216
|
+
If you already use OpenInference or OpenTelemetry for LLM observability, ContextForge will be able to ingest those traces directly.
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Planned: Collect traces from existing OpenTelemetry pipeline
|
|
220
|
+
contextforge collect --otlp-port 4317 --eval evals.yaml
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### Level 2: One-Line Instrumentation
|
|
226
|
+
Add auto-instrumentation to existing frameworks (LangChain, CrewAI, etc.) with one line.
|
|
227
|
+
|
|
228
|
+
```python
|
|
229
|
+
from contextforge.instrumentation import LangChainInstrumentor
|
|
230
|
+
|
|
231
|
+
LangChainInstrumentor().instrument()
|
|
232
|
+
|
|
233
|
+
# Your existing LangChain code works unchanged - all calls are traced
|
|
234
|
+
from langchain_openai import ChatOpenAI
|
|
235
|
+
llm = ChatOpenAI()
|
|
236
|
+
response = llm.invoke("Hello!") # Automatically traced
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Or via environment variable (no code changes):
|
|
240
|
+
```bash
|
|
241
|
+
CONTEXTFORGE_INSTRUMENT_LANGCHAIN=true python my_agent.py
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
### Level 3: Callback Handler
|
|
247
|
+
For frameworks with callback systems, pass the ContextForge handler.
|
|
248
|
+
|
|
249
|
+
```python
|
|
250
|
+
from contextforge.callbacks import ContextForgeHandler
|
|
251
|
+
|
|
252
|
+
handler = ContextForgeHandler()
|
|
253
|
+
chain.invoke(input, config={"callbacks": [handler]})
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
### Level 4: Explicit Tracer API
|
|
259
|
+
For custom agents or when you need full control, use the Tracer API.
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
from context_forge import Tracer
|
|
263
|
+
|
|
264
|
+
with Tracer.run(task="refund_request") as t:
|
|
265
|
+
t.user_input("I want a refund")
|
|
266
|
+
|
|
267
|
+
out = llm.generate(prompt)
|
|
268
|
+
t.llm_call(model="gpt-4", output=out)
|
|
269
|
+
|
|
270
|
+
result = db_query(...)
|
|
271
|
+
t.tool_call("db_query", args, result)
|
|
272
|
+
|
|
273
|
+
t.final_output(out)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Evaluation Configuration — 🔜 Coming Soon
|
|
279
|
+
|
|
280
|
+
Users will define **what to evaluate** declaratively in YAML.
|
|
281
|
+
|
|
282
|
+
```yaml
|
|
283
|
+
# Planned configuration format
|
|
284
|
+
suite: checkout_agent
|
|
285
|
+
graders:
|
|
286
|
+
- budget:
|
|
287
|
+
max_tokens: 5000
|
|
288
|
+
max_tool_calls: 10
|
|
289
|
+
- loops:
|
|
290
|
+
max_repeats: 3
|
|
291
|
+
- memory_hygiene:
|
|
292
|
+
backend: ollama
|
|
293
|
+
model: llama3.2
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Currently available**: Programmatic grader configuration via Python API.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## CI and Regression Testing — 🔜 Coming Soon
|
|
301
|
+
|
|
302
|
+
ContextForge will support:
|
|
303
|
+
- tool call recording and replay
|
|
304
|
+
- deterministic evaluation runs
|
|
305
|
+
- regression diffs between versions
|
|
306
|
+
- JUnit / Markdown / JSON reports
|
|
307
|
+
|
|
308
|
+
**Currently available**: JSON trace export for custom CI integration.
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Project Structure
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
context_forge/
|
|
316
|
+
core/ # trace spec, contracts
|
|
317
|
+
instrumentation/ # adapters & tracer
|
|
318
|
+
harness/ # tasks, scenarios, replay
|
|
319
|
+
graders/ # deterministic + judge-based
|
|
320
|
+
domains/ # industry-specific eval packs
|
|
321
|
+
reports/ # CI & dashboards
|
|
322
|
+
cli/ # contextforge CLI
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Domain Packs
|
|
328
|
+
|
|
329
|
+
ContextForge supports **domain packs** that add:
|
|
330
|
+
- custom graders
|
|
331
|
+
- rubrics
|
|
332
|
+
- task templates
|
|
333
|
+
|
|
334
|
+
Examples:
|
|
335
|
+
- Context engineering (reference domain)
|
|
336
|
+
- Creative AI (Reelfy)
|
|
337
|
+
- Finance & compliance
|
|
338
|
+
- Support automation
|
|
339
|
+
|
|
340
|
+
Domain packs extend ContextForge without bloating the core.
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Project Status
|
|
345
|
+
|
|
346
|
+
🚧 **Alpha (v0.1.0)** — Core instrumentation ready, advanced features in development
|
|
347
|
+
|
|
348
|
+
### ✅ Available Now
|
|
349
|
+
- **Trace capture**: LangGraph/LangChain instrumentation with memory operation tracking
|
|
350
|
+
- **Memory graders**: MemoryCorruptionGrader (deterministic) + MemoryHygieneJudge (LLM-based)
|
|
351
|
+
- **Ollama integration**: Local LLM judges with structured output
|
|
352
|
+
- **Test harness**: User simulation for trajectory generation
|
|
353
|
+
- **189 tests passing**: Solid foundation for production use
|
|
354
|
+
|
|
355
|
+
### 🔜 Coming Soon
|
|
356
|
+
- Additional graders: Budget, Loop, Schema, Retrieval, ContextWindow
|
|
357
|
+
- YAML evaluation configuration
|
|
358
|
+
- CLI tools (`contextforge run`, `contextforge collect`)
|
|
359
|
+
- CI/replay infrastructure
|
|
360
|
+
- OpenTelemetry ingestion
|
|
361
|
+
|
|
362
|
+
APIs are evolving, but trace contracts are stable.
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## Getting Started
|
|
367
|
+
|
|
368
|
+
**New to ContextForge?** See the **[QUICKSTART.md](QUICKSTART.md)** guide and check out the **[examples/](examples/)** directory.
|
|
369
|
+
|
|
370
|
+
---
|
|
371
|
+
|
|
372
|
+
## Specifications
|
|
373
|
+
|
|
374
|
+
ContextForge follows **Spec-Driven Development** with [GitHub Spec-Kit](https://github.com/github/spec-kit). Formal specifications define contracts before implementation.
|
|
375
|
+
|
|
376
|
+
### Feature Specs
|
|
377
|
+
|
|
378
|
+
| Feature | Priority | Description |
|
|
379
|
+
|---------|----------|-------------|
|
|
380
|
+
| [001-trace-capture](specs/001-trace-capture/spec.md) | P1 | Capture agent behavior (instrumentation, OTel, Tracer API) |
|
|
381
|
+
| [002-deterministic-graders](specs/002-deterministic-graders/spec.md) | P1 | Rule-based evaluation (budget, loops, tool schema) |
|
|
382
|
+
| [003-llm-judges](specs/003-llm-judges/spec.md) | P2 | LLM-based quality evaluation (Ollama-first) |
|
|
383
|
+
| [004-eval-configuration](specs/004-eval-configuration/spec.md) | P2 | YAML config for evaluation suites |
|
|
384
|
+
| [005-ci-replay](specs/005-ci-replay/spec.md) | P2 | Record/replay for deterministic CI |
|
|
385
|
+
| [006-reports](specs/006-reports/spec.md) | P2 | JUnit XML, Markdown, JSON output formats |
|
|
386
|
+
| [007-cli](specs/007-cli/spec.md) | P2 | Command-line interface (run, collect, validate) |
|
|
387
|
+
|
|
388
|
+
Each feature directory contains:
|
|
389
|
+
- `spec.md` — User stories, requirements, success criteria
|
|
390
|
+
- After `/speckit.plan`: `plan.md`, `research.md`, `data-model.md`, `contracts/`
|
|
391
|
+
|
|
392
|
+
See [specs/README.md](specs/README.md) for the full spec process and directory structure.
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## License
|
|
397
|
+
|
|
398
|
+
ContextForge is licensed under the **Apache License 2.0**.
|
|
399
|
+
|
|
400
|
+
This enables:
|
|
401
|
+
- free commercial use
|
|
402
|
+
- open contribution
|
|
403
|
+
- patent protection for contributors
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## Origin
|
|
408
|
+
|
|
409
|
+
ContextForge is the first open-source project of **Reelfy**.
|
|
410
|
+
|
|
411
|
+
Reelfy builds creative, agent-driven AI systems where **context quality determines output quality**.
|
|
412
|
+
|
|
413
|
+
ContextForge is framework-neutral and community-driven.
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Vision
|
|
418
|
+
|
|
419
|
+
> If agents are the future of software,
|
|
420
|
+
> **ContextForge is how we evaluate the systems they live in.**
|