-
Notifications
You must be signed in to change notification settings - Fork 0
API Guide
The FastAPI layer is the programmatic one-shot generation interface.
Use the API when you want to integrate UACRAgent into:
- scripts
- automation
- another local application
- a local service workflow
The current API is intended for:
- local use
- trusted callers
- same-machine workflows
It is not intended for public or multi-user deployment in its current form.
uvicorn uacragent.api.main:app --reloadThe API currently reads .env from the server process working directory.
It does not use the desktop and CLI <app_data_dir>/.env lookup order.
API working files are stored under:
<app_data_dir>/api_run/<workspace_id>/
Inside that workspace, the app keeps its own files under:
<workspace>/.uacragent/
That bundle contains things such as:
- copied uploads when enabled
- Chroma vector database
- generated outputs
GET /healthPOST /review
The POST /review endpoint expects:
classified_filescourse_nametask_type- optional course and exam metadata
- optional
effort_level - optional
reasoning_mode - optional
workspace_id - optional
copy_to_workspace
Every file path in classified_files must:
- be absolute
- point to an existing regular file
- resolve under
UACRAGENT_ALLOWED_BASE_DIRif that variable is set
If UACRAGENT_ALLOWED_BASE_DIR is not set:
- the API accepts any absolute existing file path on the host machine
If UACRAGENT_ALLOWED_BASE_DIR is set:
- all request file paths must resolve under that directory tree
This is why the current API is documented as local trusted use only.
{
"classified_files": {
"syllabus": ["C:/course/syllabus.pdf"],
"lecture_note": ["C:/course/notes.pdf"],
"past_exam": ["C:/course/exam1.pdf"]
},
"course_name": "Introduction to Algorithms",
"exam_format": "written",
"exam_type": "final",
"task_type": "review_summary",
"extra_instructions": "",
"effort_level": "medium",
"reasoning_mode": "quick",
"workspace_id": "default",
"copy_to_workspace": true,
"university_name": "University of Toronto",
"major": "Computer Science",
"course_code": "CSC263",
"professor_name": "Dr. Smith",
"semester": "Fall 2024",
"exam_duration": "2 hours",
"exam_info": "Closed book. One formula sheet allowed."
}The API response includes:
planmarkdown_path
markdown_path is the absolute local file path to the generated Markdown file on the same machine running the API server.
In the current local-only design, that is intended for trusted local callers that can open the returned file directly.
copy_to_workspace controls whether source files are copied into:
<workspace>/.uacragent/uploads/
Recommended default:
- keep it at
true
That gives you a more self-contained workspace.
The API exposes both depth controls:
effort_levelreasoning_mode
effort_level controls retrieval and context depth.
reasoning_mode controls the generation pipeline depth.
Supported values:
-
effort_level:low,medium,high -
reasoning_mode:quick,deep
Use:
curl http://127.0.0.1:8000/healthExpected response:
{"status": "ok"}curl -X POST http://127.0.0.1:8000/review \
-H "Content-Type: application/json" \
-d @request.json- keep the API bound to localhost only
- set
UACRAGENT_ALLOWED_BASE_DIRif you want an extra local file-access boundary - keep
copy_to_workspaceenabled unless you have a specific reason not to - treat
markdown_pathas a local host path, not a portable artifact URL