"""Create one Agent Runtime instance with no code: it holds Sessions and Memory Bank for the docs assistant.""" import os import sys import vertexai LABEL = "use-agent-platform-models-sessions-and-memory-bank" def memory_config() -> dict: return {"display_name": "docs-helper-memory", "labels": {"aiml-lesson": LABEL}, "context_spec": {"memory_bank_config": { "ttl_config": {"default_ttl": "86400s"}, "customization_configs": [{"memory_topics": [ {"managed_memory_topic": {"managed_topic_enum": "USER_PREFERENCES"}}, {"custom_memory_topic": {"label": "tool_versions", "description": "Which version of a CLI, SDK or service the developer runs, for example 'runs docuctl 1.x'."}}, ]}], }}} def main() -> None: client = vertexai.Client(project=os.environ["GOOGLE_CLOUD_PROJECT"], location=os.environ.get("GOOGLE_CLOUD_LOCATION", "us-central1")) engine = client.agent_engines.create(config=memory_config()) print("created", engine.api_resource.name) print("agent_engine_id", engine.api_resource.name.split("/")[-1], file=sys.stderr) if __name__ == "__main__": main()