()
| 75 | return parser.parse_args() |
| 76 | |
| 77 | def main() -> None: |
| 78 | args = parse_arguments() |
| 79 | |
| 80 | if args.inspect_schema: |
| 81 | breadcrumbs = None |
| 82 | if args.schema_breadcrumbs: |
| 83 | try: |
| 84 | breadcrumbs = json.loads(args.schema_breadcrumbs) |
| 85 | except json.JSONDecodeError as exc: |
| 86 | raise SystemExit(f"Invalid --schema-breadcrumbs JSON: {exc}") |
| 87 | try: |
| 88 | schema = build_schema_response(breadcrumbs) |
| 89 | except SchemaResolutionError as exc: |
| 90 | raise SystemExit(f"Failed to resolve schema: {exc}") |
| 91 | print(json.dumps(schema, indent=2, ensure_ascii=False)) |
| 92 | return |
| 93 | |
| 94 | design = load_config( |
| 95 | args.path, |
| 96 | fn_module=args.fn_module, |
| 97 | ) |
| 98 | |
| 99 | task_prompt = input("Please enter the task prompt: ") |
| 100 | |
| 101 | # Create GraphConfig and GraphContext |
| 102 | graph_config = GraphConfig.from_definition( |
| 103 | design.graph, |
| 104 | name=args.name, |
| 105 | output_root=OUTPUT_ROOT, |
| 106 | source_path=str(args.path), |
| 107 | vars=design.vars, |
| 108 | ) |
| 109 | graph_context = GraphContext(config=graph_config) |
| 110 | |
| 111 | task_input = build_task_input_payload( |
| 112 | graph_context, |
| 113 | task_prompt, |
| 114 | args.attachment or [], |
| 115 | ) |
| 116 | |
| 117 | GraphExecutor.execute_graph(graph_context, task_input) |
| 118 | |
| 119 | print(graph_context.final_message()) |
| 120 | |
| 121 | |
| 122 | if __name__ == "__main__": |
no test coverage detected