MCPcopy Create free account
hub / github.com/openai/openai-agents-python / setup_instructions

Function setup_instructions

examples/memory/dapr_session_example.py:299–374  ·  view source on GitHub ↗

Print setup instructions for running the example.

()

Source from the content-addressed store, hash-verified

297
298
299async def setup_instructions():
300 """Print setup instructions for running the example."""
301 print("\n=== Setup Instructions (Multi-store) ===")
302 print("\n1. Create components (Redis + PostgreSQL) in ./components:")
303 print("""
304# Save as components/statestore-redis.yaml
305apiVersion: dapr.io/v1alpha1
306kind: Component
307metadata:
308 name: statestore-redis
309spec:
310 type: state.redis
311 version: v1
312 metadata:
313 - name: redisHost
314 value: localhost:6379
315 - name: redisPassword
316 value: ""
317
318# Save as components/statestore-postgres.yaml
319apiVersion: dapr.io/v1alpha1
320kind: Component
321metadata:
322 name: statestore-postgres
323spec:
324 type: state.postgresql
325 version: v2
326 metadata:
327 - name: connectionString
328 value: "host=localhost user=postgres password=postgres dbname=dapr port=5432"
329""")
330 print(" You can select which one the main demo uses via env var:")
331 print(" export DAPR_STATE_STORE=statestore-redis # or statestore-postgres")
332 print(" Start both Redis and PostgreSQL for this multi-store demo:")
333 print(" docker run -d -p 6379:6379 redis:7-alpine")
334 print(
335 " docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=dapr postgres:16-alpine"
336 )
337
338 print("\n NOTE: Always use secret references for passwords/keys in production!")
339 print(" See: https://docs.dapr.io/operations/components/component-secrets/")
340
341 print("\n2. Start Dapr sidecar:")
342 print(
343 " dapr run --app-id myapp --dapr-http-port 3500 --dapr-grpc-port 50001 --resources-path ./components"
344 )
345 print("\n IMPORTANT: Always specify --dapr-http-port 3500 to avoid connection errors!")
346 print(
347 " If you recreate PostgreSQL while daprd is running, restart daprd or touch the component YAML"
348 )
349 print(
350 " to trigger a reload, otherwise you may see 'relation "
351 + '\\"state\\"'
352 + " does not exist'."
353 )
354
355 print("\n3. Run this example:")
356 print(" python examples/memory/dapr_session_example.py")

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected