| cookbook | ||
| doc | ||
| experiencemaker | ||
| .gitignore | ||
| pyproject.toml | ||
| README.md | ||
Quick Start
Hello Experience Maker
Here is a simple user guide for ExperienceMaker.
Step0: Preparation Work
Prepare LLM & EMBEDDING_MODEL
We need to prepare the API services for the LLM and the Embedding model.
Since we are using an OpenAI-compatible service, we only need to write the OPENAI_API_KEY and OPENAI_BASE_URL into the environment.
export OPENAI_API_KEY="sk-xxx"
export OPENAI_BASE_URL="xxx"
Prepare Vector Store
If you want to use vector store, you need to set up a vector database. Don't forget to set up the ES_HOSTS.
- Elasticsearch quick start
Prepare Your Own Agent
Assume you have a runnable agent. Here, we use a basic LLM combined with a simple react framework including three tools(code, web_search, terminate) as an example.
class YourOwnAgent(...):
...
def think(self, **kwargs) -> bool:
...
def act(self, **kwargs):
...
def run(self, query: str, previous_experience: str):
...
Here is an example code with prompt. To use this simple agent, you will need to set up DASHSCOPE_API_KEY.
export DASHSCOPE_API_KEY="sk-xxx"
Step1: Start ExperienceMaker Http Service
- Install dependencies.
pip install .
- We start our context and summary services in
simplemode. Next, you can use standard HTTP interfaces to call the services.
python -m experiencemaker.em_service \
--port=8001 \
--llm='{"backend": "openai_compatible", "model_name": "qwen3-32b", "temperature": 0.6}' \
--embedding_model='{"backend": "openai_compatible", "model_name": "text-embedding-v4", "dimensions": 1024}' \
--vector_store='{"backend": "elasticsearch"}' \
--context_generator='{"backend": "simple"}' \
--summarizer='{"backend": "simple"}'
Step2: Enhance Your Own Agent
Call the capabilities of ContextGenerator and Summarizer through EMClient.
from experiencemaker.em_client import EMClient
em_client = EMClient(base_url="http://0.0.0.0:8001")
Assume you have a list of messages generated by an agent; you can use the summarizer to generate experiences from them.
request = SummarizerRequest(trajectories=[Trajectory(query=query, steps=messages, answer=messages[-1].content, done=True)], workspace_id="w_1234")
response = em_client.call_summarizer(request)
for experience in response.experiences:
print(experience.model_dump_json())
Assume you have a query; you can use the context generator to generate a new query from the query and the related experiences.
request = ContextGeneratorRequest(trajectory=Trajectory(query=query), retrieve_top_k=1, workspace_id="w_1234")
response = em_client.call_context_generator(request)
new_query = f"{response.context_msg.content}\n\nUser Question\n{query}"
The complete code can be found in the implementation of YourOwnAgentEnhanced.