Connect your agent/flow with the nanomon project you’ve just created in Step 1. To do that set the following environment variables in your DSPy project:
We know that when running locally we all want to have control about what are the ports to be used, why and when, because of that we allow you to change the nanomon API Url simply by setting, in your DSPy project the environment variable
NANOMON_API_URL=http://localhost:8000/api/v1 # Or the one you want to
This way the agents will report to the nanomon api that is running in that url you defined.
nanomon_context = NanomonRunContext(default_tags=["dev", "nanomon-tester"]) # add whatever tags you wantconfigure_nanomon(nanomon_context._sink)lm = nanomon_context.instrument_lm(lm) # with lm being your regular DSPy lm# Configure DSPydspy.configure(lm=lm)# Wrap itwith nanomon_context.run( tags=["my-agent-flow"], # an example of a tag of your choice metadata={"user-id": "User ID 12345"} # just an example of how you can use it):# Run your lang graph (or simply your DSPy Predict or ReAct directly)final_state = await graph.ainvoke(initial_state)